mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-24 13:50:17 +00:00
Added date check before running apt-get update/upgrade. Wont run apt-get update/upgrade if it has already been run today
This commit is contained in:
parent
8ecf8eb76c
commit
736edf44e4
1 changed files with 18 additions and 8 deletions
|
@ -296,14 +296,24 @@ stopServices(){
|
|||
|
||||
|
||||
checkForDependencies(){
|
||||
echo ":::"
|
||||
#update package lists
|
||||
echo -n "::: Updating package list before install...."
|
||||
$SUDO apt-get -qq update > /dev/null & spinner $!
|
||||
echo " done!"
|
||||
echo -n "::: Upgrading installed apt-get packages...."
|
||||
$SUDO apt-get -y -qq upgrade > /dev/null & spinner $!
|
||||
echo " done!"
|
||||
echo ":::"
|
||||
#Check to see if apt-get update has already been run today
|
||||
timestamp=$(stat -c %Y /var/cache/apt/)
|
||||
timestampAsDate=$(date -d @$timestamp "+%b %e")
|
||||
today=$(date "+%b %e")
|
||||
|
||||
if [ ! "$today" == "$timestampAsDate" ]; then
|
||||
#update package lists
|
||||
echo -n "::: Updating package list before install...."
|
||||
$SUDO apt-get -qq update > /dev/null & spinner $!
|
||||
echo " done!"
|
||||
echo -n "::: Upgrading installed apt-get packages...."
|
||||
$SUDO apt-get -y -qq upgrade > /dev/null & spinner $!
|
||||
echo " done!"
|
||||
else
|
||||
echo "::: Apt-get update already run today, any more would be overkill..."
|
||||
fi
|
||||
|
||||
|
||||
echo ":::"
|
||||
echo "::: Checking dependencies:"
|
||||
|
|
Loading…
Reference in a new issue