From 01d7fc0ac9f68d9c6172d7e860288fcf7e743662 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 25 Jan 2016 10:07:12 +0000 Subject: [PATCH] Removed apt-get update/upgrade, instead checking for updates availible and advising user to update/upgrade after installation of pi-hole. Addresses issue #218 --- automated install/basic-install.sh | 35 ++++++++++++++++-------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index d9e448a9..09fe2eb3 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -293,24 +293,27 @@ 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") + + #Running apt-get update/upgrade with minimal output can cause some issues with + #requiring user input (e.g password for phpmyadmin see #218) + #We'll change the logic up here, to check to see if there are any updates availible and + # if so, advise the user to run apt-get update/upgrade at their own discretion + 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 -n "::: Checking apt-get for upgraded packages...." + updatesToInstall=$(sudo apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst) & spinner $! + echo " done!" + + if [ updatesToInstall > 0 ]; then + echo "::: There are $updatesToInstall updates availible for your pi!" + echo "::: Please consider running 'sudo apt-get update', followed by 'sudo apt-get upgrade'" + echo "::: after pi-hole has finished installing. + echo ":::" + echo "::: Continuing with pi-hole installation..." + else + echo "::: Your pi is up to date! Continuing with pi-hole installation..." + fi echo ":::" echo "::: Checking dependencies:"