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:
Promofaux 2016-01-24 17:53:27 +00:00
parent 8ecf8eb76c
commit 736edf44e4

View file

@ -296,14 +296,24 @@ stopServices(){
checkForDependencies(){ checkForDependencies(){
echo ":::" echo ":::"
#update package lists #Check to see if apt-get update has already been run today
echo -n "::: Updating package list before install...." timestamp=$(stat -c %Y /var/cache/apt/)
$SUDO apt-get -qq update > /dev/null & spinner $! timestampAsDate=$(date -d @$timestamp "+%b %e")
echo " done!" today=$(date "+%b %e")
echo -n "::: Upgrading installed apt-get packages...."
$SUDO apt-get -y -qq upgrade > /dev/null & spinner $! if [ ! "$today" == "$timestampAsDate" ]; then
echo " done!" #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 ":::"
echo "::: Checking dependencies:" echo "::: Checking dependencies:"