mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Always update package cache where we can.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
This commit is contained in:
parent
c5f5252145
commit
4eedf8a746
1 changed files with 5 additions and 12 deletions
|
@ -79,7 +79,6 @@ if [[ $(command -v apt-get) ]]; then
|
||||||
#Debian Family
|
#Debian Family
|
||||||
#############################################
|
#############################################
|
||||||
PKG_MANAGER="apt-get"
|
PKG_MANAGER="apt-get"
|
||||||
PKG_CACHE="/var/lib/apt/lists/"
|
|
||||||
UPDATE_PKG_CACHE="${PKG_MANAGER} update"
|
UPDATE_PKG_CACHE="${PKG_MANAGER} update"
|
||||||
PKG_INSTALL="${PKG_MANAGER} --yes --no-install-recommends install"
|
PKG_INSTALL="${PKG_MANAGER} --yes --no-install-recommends install"
|
||||||
# grep -c will return 1 retVal on 0 matches, block this throwing the set -e with an OR TRUE
|
# grep -c will return 1 retVal on 0 matches, block this throwing the set -e with an OR TRUE
|
||||||
|
@ -108,8 +107,8 @@ elif [ $(command -v rpm) ]; then
|
||||||
else
|
else
|
||||||
PKG_MANAGER="yum"
|
PKG_MANAGER="yum"
|
||||||
fi
|
fi
|
||||||
PKG_CACHE="/var/cache/${PKG_MANAGER}"
|
# Fedora and family update cache on every PKG_INSTALL call, no need for a separate update.
|
||||||
UPDATE_PKG_CACHE="${PKG_MANAGER} check-update"
|
UPDATE_PKG_CACHE=":"
|
||||||
PKG_INSTALL="${PKG_MANAGER} install -y"
|
PKG_INSTALL="${PKG_MANAGER} install -y"
|
||||||
PKG_COUNT="${PKG_MANAGER} check-update | egrep '(.i686|.x86|.noarch|.arm|.src)' | wc -l"
|
PKG_COUNT="${PKG_MANAGER} check-update | egrep '(.i686|.x86|.noarch|.arm|.src)' | wc -l"
|
||||||
INSTALLER_DEPS=(git iproute net-tools newt procps-ng)
|
INSTALLER_DEPS=(git iproute net-tools newt procps-ng)
|
||||||
|
@ -718,19 +717,13 @@ update_pacakge_cache() {
|
||||||
#Running apt-get update/upgrade with minimal output can cause some issues with
|
#Running apt-get update/upgrade with minimal output can cause some issues with
|
||||||
#requiring user input (e.g password for phpmyadmin see #218)
|
#requiring user input (e.g password for phpmyadmin see #218)
|
||||||
|
|
||||||
#Check to see if apt-get update has already been run today
|
#Update package cache on apt based OSes. Do this every time since
|
||||||
#it needs to have been run at least once on new installs!
|
#it's quick and packages can be updated at any time.
|
||||||
timestamp=$(stat -c %Y ${PKG_CACHE})
|
|
||||||
timestampAsDate=$(date -d @"${timestamp}" "+%b %e")
|
|
||||||
today=$(date "+%b %e")
|
|
||||||
|
|
||||||
if [ ! "${today}" == "${timestampAsDate}" ]; then
|
|
||||||
#update package lists
|
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo -n "::: ${PKG_MANAGER} update has not been run today. Running now..."
|
echo -n "::: Updating local cache of available packages..."
|
||||||
${UPDATE_PKG_CACHE} &> /dev/null
|
${UPDATE_PKG_CACHE} &> /dev/null
|
||||||
echo " done!"
|
echo " done!"
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
notify_package_updates_available() {
|
notify_package_updates_available() {
|
||||||
|
|
Loading…
Reference in a new issue