mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-18 19:00:15 +00:00
Fix for #1204
Added -y to $UPDATE_PKG_CACHE updatePackageCache() no longer checks if apt update was run, it will always update package cache since its a requirement Replaced all updates using ${UPDATE_PKG_CACHE} with updatePackageCache()
This commit is contained in:
parent
9499b5282c
commit
7095357f92
1 changed files with 5 additions and 17 deletions
|
@ -31,7 +31,7 @@ debianOvpnUserGroup="openvpn:openvpn"
|
||||||
PKG_MANAGER="apt-get"
|
PKG_MANAGER="apt-get"
|
||||||
PKG_CACHE="/var/lib/apt/lists/"
|
PKG_CACHE="/var/lib/apt/lists/"
|
||||||
### FIXME: quoting UPDATE_PKG_CACHE and PKG_INSTALL hangs the script, shellcheck SC2086
|
### FIXME: quoting UPDATE_PKG_CACHE and PKG_INSTALL hangs the script, shellcheck SC2086
|
||||||
UPDATE_PKG_CACHE="${PKG_MANAGER} update"
|
UPDATE_PKG_CACHE="${PKG_MANAGER} update -y"
|
||||||
PKG_INSTALL="${PKG_MANAGER} --yes --no-install-recommends install"
|
PKG_INSTALL="${PKG_MANAGER} --yes --no-install-recommends install"
|
||||||
PKG_COUNT="${PKG_MANAGER} -s -o Debug::NoLocking=true upgrade | grep -c ^Inst || true"
|
PKG_COUNT="${PKG_MANAGER} -s -o Debug::NoLocking=true upgrade | grep -c ^Inst || true"
|
||||||
|
|
||||||
|
@ -399,24 +399,12 @@ verifyFreeDiskSpace(){
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePackageCache(){
|
updatePackageCache(){
|
||||||
#Running apt-get update/upgrade with minimal output can cause some issues with
|
|
||||||
#requiring user input
|
|
||||||
|
|
||||||
#Check to see if apt-get update has already been run today
|
|
||||||
#it needs to have been run at least once on new installs!
|
|
||||||
timestamp=$(stat -c %Y ${PKG_CACHE})
|
|
||||||
timestampAsDate=$(date -d @"${timestamp}" "+%b %e")
|
|
||||||
today=$(date "+%b %e")
|
|
||||||
|
|
||||||
|
|
||||||
if [ ! "${today}" == "${timestampAsDate}" ]; then
|
|
||||||
#update package lists
|
#update package lists
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo -ne "::: ${PKG_MANAGER} update has not been run today. Running now...\\n"
|
echo -ne "::: Package Cache update is needed, running ${UPDATE_PKG_CACHE} ...\\n"
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
$SUDO ${UPDATE_PKG_CACHE} &> /dev/null & spinner $!
|
$SUDO ${UPDATE_PKG_CACHE} &> /dev/null & spinner $!
|
||||||
echo " done!"
|
echo " done!"
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyPackageUpdatesAvailable(){
|
notifyPackageUpdatesAvailable(){
|
||||||
|
@ -1206,7 +1194,7 @@ installOpenVPN(){
|
||||||
|
|
||||||
echo "::: Updating package cache..."
|
echo "::: Updating package cache..."
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
$SUDO ${UPDATE_PKG_CACHE} &> /dev/null & spinner $!
|
updatePackageCache
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# grepcidr is used to redact IPs in the debug log whereas expect is used
|
# grepcidr is used to redact IPs in the debug log whereas expect is used
|
||||||
|
@ -1274,7 +1262,7 @@ installWireGuard(){
|
||||||
|
|
||||||
echo "::: Updating package cache..."
|
echo "::: Updating package cache..."
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
$SUDO ${UPDATE_PKG_CACHE} &> /dev/null & spinner $!
|
updatePackageCache
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# qrencode is used to generate qrcodes from config file, for use with mobile clients
|
# qrencode is used to generate qrcodes from config file, for use with mobile clients
|
||||||
|
@ -1293,7 +1281,7 @@ installWireGuard(){
|
||||||
|
|
||||||
echo "::: Updating package cache..."
|
echo "::: Updating package cache..."
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
$SUDO ${UPDATE_PKG_CACHE} &> /dev/null & spinner $!
|
updatePackageCache
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PIVPN_DEPS=(wireguard-tools qrencode)
|
PIVPN_DEPS=(wireguard-tools qrencode)
|
||||||
|
|
Loading…
Reference in a new issue