termux-tools: pkg: ensure that pkgcache exists before attempting to check modification time

This commit is contained in:
Leonid Pliushch 2021-06-30 10:59:44 +03:00
parent 94540654db
commit f7142c23db
No known key found for this signature in database
GPG Key ID: 45F2964132545795
2 changed files with 2 additions and 2 deletions

View File

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

View File

@ -90,7 +90,7 @@ select_mirror() {
# Mirrors are rotated if 6 hours timeout has been passed or mirror is no longer accessible.
local pkgcache="@TERMUX_CACHE_DIR@/apt/pkgcache.bin"
if (( $(last_modified "$pkgcache") <= 6 * 3600 )); then
if [ -e "$pkgcache" ] && (( $(last_modified "$pkgcache") <= 6 * 3600 )); then
if [ -n "$current_mirror" ]; then
echo -n "Checking availability of current mirror: "
if check_mirror "$current_mirror"; then