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

@ -297,6 +297,12 @@ stopServices(){
checkForDependencies(){
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 $!
@ -304,6 +310,10 @@ checkForDependencies(){
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:"