enhance(main/termux-tools:termux-change-repo): fail if apt isn't installed

This commit is contained in:
Maxython 2022-06-12 01:44:47 +03:00
parent 3ee0b7b09d
commit caebbaa479
2 changed files with 15 additions and 1 deletions

View File

@ -2,7 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://termux.org/
TERMUX_PKG_DESCRIPTION="Basic system tools for Termux"
TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=0.186
TERMUX_PKG_VERSION=0.187
TERMUX_PKG_SKIP_SRC_EXTRACT=true
TERMUX_PKG_PLATFORM_INDEPENDENT=true
TERMUX_PKG_ESSENTIAL=true

View File

@ -1,5 +1,8 @@
#!@TERMUX_PREFIX@/bin/bash
# Setup TERMUX_APP_PACKAGE_MANAGER
source "@TERMUX_PREFIX@/bin/termux-setup-package-manager" || exit 1
if [ "$1" == "--help" ] || [ "$1" == "-help" ]; then
echo "Script for redirecting subscribed repositories to mirrors."
echo "You can choose between mirrors listed at"
@ -196,6 +199,17 @@ replace_repository() {
fi
}
if ! command -v apt 1>/dev/null; then
echo "Error: changing mirrors can't execute because apt is not installed."
exit 1
fi
if [ "$TERMUX_APP_PACKAGE_MANAGER" = "pacman" ]; then
read -p "Warning: termux-change-repo can only change mirrors for apt, is that what you intended? [y|n] " -n 1 -r
echo
[[ ${REPLY} =~ ^[Nn]$ ]] && exit
fi
TEMPFILE="$(mktemp @TERMUX_PREFIX@/tmp/mirror.XXXXXX)"
REPOSITORIES=()