Browse Source
Don't run `apt update` if it's been run recently (#4135 )
When installing or searching for packages, the `apt update` will run only if it
was not executed within the last 5 minutes. Command `pkg upgrade` will
always execute `apt update` to ensure that latest package versions were
picked during upgrade.
android-5
Efreak
5 years ago
committed by
Leonid Plyushch
No known key found for this signature in database
GPG Key ID: 45F2964132545795
2 changed files with
18 additions and
11 deletions
packages/termux-tools/build.sh
packages/termux-tools/pkg
@ -1,7 +1,7 @@
TERMUX_PKG_HOMEPAGE = https://termux.com/
TERMUX_PKG_DESCRIPTION = "Basic system tools for Termux"
TERMUX_PKG_LICENSE = "GPL-3.0"
TERMUX_PKG_VERSION = 0.71
TERMUX_PKG_VERSION = 0.72
TERMUX_PKG_SKIP_SRC_EXTRACT = true
TERMUX_PKG_PLATFORM_INDEPENDENT = true
TERMUX_PKG_ESSENTIAL = true
@ -19,28 +19,35 @@ show_help() {
}
assert_not_root() {
if [ $(id -u) -eq 0 ]
then
echo "This must NOT be run as root as it will break your environment (root will be required for nearly everything due to changed file permissions)"
exit 1
fi
if [ $(id -u) -eq 0 ]; then
echo "This must NOT be run as root as it will break your environment (root will be required for nearly everything due to changed file permissions)"
exit 1
fi
}
if [ $# = 0 ]; then show_help; fi
check_pkgcache() {
if [ -z "$(find @TERMUX_PREFIX@/var/cache/apt/pkgcache.bin -mmin -5)" ]; then
apt update
fi
}
if [ $# = 0 ]; then
show_help
fi
CMD="$1"
shift 1
case "$CMD" in
f*) dpkg -L "$@";;
h*) show_help;;
add|i*) assert_not_root; apt update; apt install "$@";;
add|i*) assert_not_root; check_pkgcach e; apt install "$@";;
list-a*) apt list "$@";;
list-i*) apt list --installed "$@";;
rei*) assert_not_root; apt install --reinstall "$@";;
se*) assert_not_root; apt updat e; apt search "$@";;
se*) assert_not_root; check_pkgcach e; apt search "$@";;
sh*) apt show "$@";;
un*|rem*|rm|del*) assert_not_root; apt remove "$@";;
up*) assert_not_root; apt update; apt full-upgrade "$@";;
*) echo "Unknown command: '$CMD' (run 'pkg help' for usage information)";;
*) echo "Unknown command: '$CMD' (run 'pkg help' for usage information)"; exit 1; ;
esac