diff --git a/scripts/bin/check-pie.sh b/scripts/bin/check-pie.sh index 3eff38d42d..1116fabeed 100755 --- a/scripts/bin/check-pie.sh +++ b/scripts/bin/check-pie.sh @@ -1,6 +1,7 @@ #!/bin/sh # check-pie.sh - script to detect non-PIE binaries (which does not work on Android) +: "${TERMUX_SCRIPTDIR:="$(realpath "$(dirname "$(readlink -f "$0")")/../..")"}" . $(dirname "$(realpath "$0")")/properties.sh cd ${TERMUX_PREFIX}/bin diff --git a/scripts/build-bootstraps.sh b/scripts/build-bootstraps.sh index 7c5c5ca5e8..08e8823fff 100755 --- a/scripts/build-bootstraps.sh +++ b/scripts/build-bootstraps.sh @@ -12,6 +12,7 @@ version=0.1.0 set -e +: "${TERMUX_SCRIPTDIR:="$(realpath "$(dirname "$(readlink -f "$0")")/..")"}" . $(dirname "$(realpath "$0")")/properties.sh BOOTSTRAP_TMPDIR=$(mktemp -d "${TMPDIR:-/tmp}/bootstrap-tmp.XXXXXXXX") diff --git a/scripts/generate-bootstraps.sh b/scripts/generate-bootstraps.sh index 1d85d52434..1af1dfd354 100755 --- a/scripts/generate-bootstraps.sh +++ b/scripts/generate-bootstraps.sh @@ -5,6 +5,7 @@ set -e +: "${TERMUX_SCRIPTDIR:="$(realpath "$(dirname "$(readlink -f "$0")")/..")"}" . $(dirname "$(realpath "$0")")/properties.sh BOOTSTRAP_TMPDIR=$(mktemp -d "${TMPDIR:-/tmp}/bootstrap-tmp.XXXXXXXX") trap 'rm -rf $BOOTSTRAP_TMPDIR' EXIT diff --git a/scripts/lint-packages.sh b/scripts/lint-packages.sh index 65e7ccfcd1..ed8212ece6 100755 --- a/scripts/lint-packages.sh +++ b/scripts/lint-packages.sh @@ -115,6 +115,7 @@ lint_package() { TERMUX_PKG_API_LEVEL=24 if [ -f "$REPO_DIR/scripts/properties.sh" ]; then + : "${TERMUX_SCRIPTDIR:=$REPO_DIR}" . "$REPO_DIR/scripts/properties.sh" fi diff --git a/scripts/list-versions.sh b/scripts/list-versions.sh index 31d6ce9cfb..ef5cbfcb3d 100755 --- a/scripts/list-versions.sh +++ b/scripts/list-versions.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash SCRIPT_DIR=$(dirname "$(realpath "$0")") +: "${TERMUX_SCRIPTDIR:="$(realpath "$SCRIPT_DIR/..")"}" . "$SCRIPT_DIR"/properties.sh check_package() { # path diff --git a/scripts/properties.sh b/scripts/properties.sh index 1e9452a4d2..046acc7dd8 100644 --- a/scripts/properties.sh +++ b/scripts/properties.sh @@ -3,6 +3,8 @@ # coreutils and are clearly not a default part of most Linux installations, # or sourcing any other script in our build directories. +: "${TERMUX_SCRIPTDIR:?TERMUX_SCRIPTDIR not set for properties.sh}" + TERMUX_SDK_REVISION=9123335 TERMUX_ANDROID_BUILD_TOOLS_VERSION=33.0.1 # when changing the above: @@ -18,8 +20,6 @@ TERMUX_NDK_VERSION=$TERMUX_NDK_VERSION_NUM$TERMUX_NDK_REVISION # and update SHA256 sums in scripts/setup-android-sdk.sh # check all packages build and run correctly and bump if needed -: "${TERMUX_SCRIPTDIR:=$(pwd)}" - : "${TERMUX_JAVA_HOME:=/usr/lib/jvm/java-8-openjdk-amd64}" export JAVA_HOME=${TERMUX_JAVA_HOME} diff --git a/scripts/setup-android-sdk.sh b/scripts/setup-android-sdk.sh index 7bb6359971..fc28210c09 100755 --- a/scripts/setup-android-sdk.sh +++ b/scripts/setup-android-sdk.sh @@ -3,6 +3,7 @@ set -e -u : "${TERMUX_PKG_TMPDIR:="/tmp"}" +: "${TERMUX_SCRIPTDIR:="$(realpath "$(dirname "$(readlink -f "$0")")/..")"}" # Install desired parts of the Android SDK: . $(cd "$(dirname "$0")"; pwd)/properties.sh diff --git a/scripts/setup-archlinux.sh b/scripts/setup-archlinux.sh index fca629d12f..1113dc8e25 100755 --- a/scripts/setup-archlinux.sh +++ b/scripts/setup-archlinux.sh @@ -52,6 +52,7 @@ else fi $SUDO pacman -Syq --needed --noconfirm $PACKAGES +: "${TERMUX_SCRIPTDIR:="$(realpath "$(dirname "$(readlink -f "$0")")/..")"}" . $(dirname "$(realpath "$0")")/properties.sh $SUDO mkdir -p $TERMUX_PREFIX $SUDO chown -R $(whoami) /data diff --git a/scripts/setup-cgct.sh b/scripts/setup-cgct.sh index fbf6efbab3..5d3d7fa93d 100755 --- a/scripts/setup-cgct.sh +++ b/scripts/setup-cgct.sh @@ -2,6 +2,7 @@ # setup CGCT - Cross Gnu Compiler for Termux # compile glibc-based binaries for Termux +: "${TERMUX_SCRIPTDIR:="$(realpath "$(dirname "$(readlink -f "$0")")/..")"}" . $(dirname "$(realpath "$0")")/properties.sh . $(dirname "$(realpath "$0")")/build/termux_download.sh diff --git a/scripts/setup-termux-glibc.sh b/scripts/setup-termux-glibc.sh index ef96c79b04..ac72ad87f4 100755 --- a/scripts/setup-termux-glibc.sh +++ b/scripts/setup-termux-glibc.sh @@ -1,5 +1,6 @@ #!/bin/bash +: "${TERMUX_SCRIPTDIR:="$(realpath "$(dirname "$(readlink -f "$0")")/..")"}" . $(dirname "$(realpath "$0")")/properties.sh source "$TERMUX_PREFIX/bin/termux-setup-package-manager" || true diff --git a/scripts/setup-termux.sh b/scripts/setup-termux.sh index 426dba3213..26b25e36ef 100755 --- a/scripts/setup-termux.sh +++ b/scripts/setup-termux.sh @@ -46,6 +46,7 @@ PACKAGES+=" xmlto" # Needed by git's manpage generation PACKAGES+=" zip" # Definition of a package manager +: "${TERMUX_SCRIPTDIR:="$(realpath "$(dirname "$(readlink -f "$0")")/..")"}" . $(dirname "$(realpath "$0")")/properties.sh source "$TERMUX_PREFIX/bin/termux-setup-package-manager" || true diff --git a/scripts/setup-ubuntu.sh b/scripts/setup-ubuntu.sh index b308222868..70222807f3 100755 --- a/scripts/setup-ubuntu.sh +++ b/scripts/setup-ubuntu.sh @@ -323,6 +323,7 @@ rm -f /tmp/py2-get-pip.py $SUDO locale-gen --purge en_US.UTF-8 echo -e 'LANG="en_US.UTF-8"\nLANGUAGE="en_US:en"\n' | $SUDO tee -a /etc/default/locale +: "${TERMUX_SCRIPTDIR:="$(realpath "$(dirname "$(readlink -f "$0")")/..")"}" . $(dirname "$(realpath "$0")")/properties.sh $SUDO mkdir -p $TERMUX_PREFIX $SUDO chown -R $(whoami) /data