scripts/setup-termux.sh: adding the ability to install packages via pacman (#16368)

build-package.sh: improved work with pacman-conf
This commit is contained in:
Ivan Max 2023-04-23 17:59:02 +00:00 committed by GitHub
parent 2534d50092
commit cd151f2841
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 5 deletions

View File

@ -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

View File

@ -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