diff --git a/build-package.sh b/build-package.sh index ea2b499f58..236b7bdfe1 100755 --- a/build-package.sh +++ b/build-package.sh @@ -350,7 +350,7 @@ if [ "$TERMUX_ON_DEVICE_BUILD" = "true" ]; then # Target architecture must be same as for environment used currently. case "$TERMUX_APP_PACKAGE_MANAGER" in "apt") TERMUX_ARCH=$(dpkg --print-architecture);; - "pacman") TERMUX_ARCH=$(pacman-conf | grep Architecture | sed 's/Architecture = //g');; + "pacman") TERMUX_ARCH=$(pacman-conf Architecture);; esac export TERMUX_ARCH fi diff --git a/scripts/setup-termux.sh b/scripts/setup-termux.sh index 824f1fe236..426dba3213 100755 --- a/scripts/setup-termux.sh +++ b/scripts/setup-termux.sh @@ -18,7 +18,7 @@ PACKAGES+=" asciidoctor" PACKAGES+=" autoconf" PACKAGES+=" automake" PACKAGES+=" bc" -PACKAGES+=" bison" +PACKAGES+=" byacc" PACKAGES+=" bsdtar" # Needed to create pacman packages PACKAGES+=" cmake" PACKAGES+=" ed" @@ -45,6 +45,17 @@ PACKAGES+=" valac" PACKAGES+=" xmlto" # Needed by git's manpage generation PACKAGES+=" zip" -apt update -apt dist-upgrade -y -apt install -y $PACKAGES +# Definition of a package manager +. $(dirname "$(realpath "$0")")/properties.sh +source "$TERMUX_PREFIX/bin/termux-setup-package-manager" || true + +if [ "$TERMUX_APP_PACKAGE_MANAGER" = "apt" ]; then + apt update + apt dist-upgrade -y + apt install -y $PACKAGES +elif [ "$TERMUX_APP_PACKAGE_MANAGER" = "pacman" ]; then + pacman -Syu $PACKAGES --needed --noconfirm +else + echo "Error: no package manager defined" + exit 1 +fi