From 01d7fc0ac9f68d9c6172d7e860288fcf7e743662 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 25 Jan 2016 10:07:12 +0000 Subject: [PATCH 1/6] 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:" From 32389e4ab80079e5ee49606503f0d653d82ffefe Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Mon, 25 Jan 2016 02:27:44 -0800 Subject: [PATCH 2/6] Terminate string with missing quote --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 09fe2eb3..06fffd8e 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -308,7 +308,7 @@ checkForDependencies(){ 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 "::: after pi-hole has finished installing." echo ":::" echo "::: Continuing with pi-hole installation..." else From e99be28a73c1ba49d377ce6cace15fb5a1451b7e Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Mon, 25 Jan 2016 02:31:03 -0800 Subject: [PATCH 3/6] Variable missing $ --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 06fffd8e..de9cfed3 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -305,7 +305,7 @@ checkForDependencies(){ updatesToInstall=$(sudo apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst) & spinner $! echo " done!" - if [ updatesToInstall > 0 ]; then + 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." From 4cedca342748df3dd5363a88cb003e8c08c7a762 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 25 Jan 2016 12:47:03 +0000 Subject: [PATCH 4/6] add in a prompt to give users the option to quit installation or continue --- automated install/basic-install.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index de9cfed3..0feb5e8d 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -310,7 +310,16 @@ checkForDependencies(){ 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..." + #add in a prompt to give users the option to quit installation or continue + echo -n "::: Would you like to continue with the pi-hole installation? (Y/n):" + read answer + + case "$answer" in + [yY][eE][sS]|[yY] ) echo "::: Continuing!;; + * ) echo "::: Quitting install, please run 'curl -L install.pi-hole.net | bash' after updating packages!" + exit 0;; + esac + else echo "::: Your pi is up to date! Continuing with pi-hole installation..." fi From 354a42dd00502735238920ddfdae9e8af9b11b41 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 25 Jan 2016 12:49:04 +0000 Subject: [PATCH 5/6] close quotes on line 318!!! --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 0feb5e8d..d96a4416 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -315,7 +315,7 @@ checkForDependencies(){ read answer case "$answer" in - [yY][eE][sS]|[yY] ) echo "::: Continuing!;; + [yY][eE][sS]|[yY] ) echo "::: Continuing!";; * ) echo "::: Quitting install, please run 'curl -L install.pi-hole.net | bash' after updating packages!" exit 0;; esac From 2b99fa81f337bb166f04f33f75a4e2aa2b7f665e Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 25 Jan 2016 16:08:48 +0000 Subject: [PATCH 6/6] Tidy up output lines around new code --- automated install/basic-install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index d96a4416..a8676721 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -300,11 +300,12 @@ checkForDependencies(){ # if so, advise the user to run apt-get update/upgrade at their own discretion today=$(date "+%b %e") - + echo ":::" echo -n "::: Checking apt-get for upgraded packages...." updatesToInstall=$(sudo apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst) & spinner $! echo " done!" + echo ":::" 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'"