From 73c85ae68a931f777173b9d394f803c9a62104d2 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sun, 2 Oct 2016 10:30:55 +0100 Subject: [PATCH 1/7] remove duplicate calls to installConfigs --- automated install/basic-install.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 46abeb62..c9c16e8a 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -820,7 +820,6 @@ installPihole() { getGitFiles installScripts installConfigs - installConfigs CreateLogFile configureSelinux installPiholeWeb @@ -837,7 +836,6 @@ updatePihole() { getGitFiles installScripts installConfigs - installConfigs CreateLogFile configureSelinux installPiholeWeb From 7684069d0b7012190f6efea8af7d6552830682de Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sun, 2 Oct 2016 10:33:04 +0100 Subject: [PATCH 2/7] verifyFreeDiskSpace BEFORE installing any dependencies --- automated install/basic-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index c9c16e8a..7388dcd7 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -926,13 +926,13 @@ if [[ -f ${setupVars} ]];then fi # Start the installer +# Verify there is enough disk space for the install +verifyFreeDiskSpace # Install packages used by this installation script installerDependencies if [[ ${useUpdateVars} == false ]]; then welcomeDialogs - # Verify there is enough disk space for the install - verifyFreeDiskSpace ${SUDO} mkdir -p /etc/pihole/ # Find IP used to route to outside world From 6c2ff950ee5ab0a353515b2ba363eabafbd7605b Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sun, 2 Oct 2016 10:33:59 +0100 Subject: [PATCH 3/7] remote duplicate ${SUDO} mkdir /etc/pihole --- automated install/basic-install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 7388dcd7..5455de53 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -933,7 +933,6 @@ installerDependencies if [[ ${useUpdateVars} == false ]]; then welcomeDialogs - ${SUDO} mkdir -p /etc/pihole/ # Find IP used to route to outside world findIPRoute From 4e262d81f04374c7cba1d017757b02a157ac46de Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sun, 2 Oct 2016 10:39:09 +0100 Subject: [PATCH 4/7] wrap these vars in {} to matcht he rest of the script --- automated install/basic-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 5455de53..c372c410 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -166,9 +166,9 @@ verifyFreeDiskSpace() { fi # - Insufficient free disk space - elif [[ $existing_free_kilobytes -lt $required_free_kilobytes ]]; then + elif [[ ${existing_free_kilobytes} -lt ${required_free_kilobytes} ]]; then - whiptail --msgbox --backtitle "Insufficient Disk Space" --title "Insufficient Disk Space" "\nYour system appears to be low on disk space. pi-hole recomends a minimum of $required_free_kilobytes KiloBytes.\nYou only have $existing_free_kilobytes KiloBytes free.\n\nIf this is a new install you may need to expand your disk.\n\nTry running:\n 'sudo raspi-config'\nChoose the 'expand file system option'\n\nAfter rebooting, run this installation again.\n\ncurl -L install.pi-hole.net | bash\n" $r $c + whiptail --msgbox --backtitle "Insufficient Disk Space" --title "Insufficient Disk Space" "\nYour system appears to be low on disk space. pi-hole recomends a minimum of $required_free_kilobytes KiloBytes.\nYou only have $existing_free_kilobytes KiloBytes free.\n\nIf this is a new install you may need to expand your disk.\n\nTry running:\n 'sudo raspi-config'\nChoose the 'expand file system option'\n\nAfter rebooting, run this installation again.\n\ncurl -L install.pi-hole.net | bash\n" ${r} ${c} echo "$existing_free_kilobytes is less than $required_free_kilobytes" echo "Insufficient free space, exiting..." exit 1 From 6f780316c4a6c5904b7751b5bcd56a291d986334 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sun, 2 Oct 2016 11:09:14 +0100 Subject: [PATCH 5/7] remove whiptail dependency from verifyFreeDiskSpace. Add argument detection to skip disk space. This is because curling to bash does not support waiting for user input. --- automated install/basic-install.sh | 33 +++++++++++++++++------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index c372c410..f70aeed0 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -149,27 +149,27 @@ verifyFreeDiskSpace() { # 50MB is the minimum space needed (45MB install (includes web admin bootstrap/jquery libraries etc) + 5MB one day of logs.) # - Fourdee: Local ensures the variable is only created, and accessible within this function/void. Generally considered a "good" coding practice for non-global variables. + echo "::: Verifying free disk space..." local required_free_kilobytes=51200 local existing_free_kilobytes=$(df -Pk | grep -m1 '\/$' | awk '{print $4}') # - Unknown free disk space , not a integer if ! [[ "$existing_free_kilobytes" =~ ^([0-9])+$ ]]; then - - whiptail --title "Unknown free disk space" --yesno "We were unable to determine available free disk space on this system.\n\nYou may override this check and force the installation, however, it is not recommended.\n\nWould you like to continue with the installation?" --defaultno --backtitle "Pi-hole" ${r} ${c} - local choice=$? - if (( $choice != 0 )); then - - echo "non-integer value from existing_free_kilobytes ($existing_free_kilobytes)" - echo "Unknown free space, user aborted, exiting..." - exit 1 - - fi - + echo "::: Unknown free disk space!" + echo "::: We were unable to determine available free disk space on this system." + echo "::: You may override this check and force the installation, however, it is not recommended" + echo "::: To do so, pass the argument '--force' to the install script" + echo "::: eg. curl -L https://install.pi-hole.net | bash /dev/stdin --force" + exit 1 # - Insufficient free disk space elif [[ ${existing_free_kilobytes} -lt ${required_free_kilobytes} ]]; then + echo "::: Insufficient Disk Space!" + echo "::: Your system appears to be low on disk space. pi-hole recommends a minimum of $required_free_kilobytes KiloBytes." + echo "::: You only have $existing_free_kilobytes KiloBytes free." + echo "::: If this is a new install you may need to expand your disk." + echo "::: Try running 'sudo raspi-config', and choose the 'expand file system option'" + echo "::: After rebooting, run this installation again. (curl -L https://install.pi-hole.net | bash)" - whiptail --msgbox --backtitle "Insufficient Disk Space" --title "Insufficient Disk Space" "\nYour system appears to be low on disk space. pi-hole recomends a minimum of $required_free_kilobytes KiloBytes.\nYou only have $existing_free_kilobytes KiloBytes free.\n\nIf this is a new install you may need to expand your disk.\n\nTry running:\n 'sudo raspi-config'\nChoose the 'expand file system option'\n\nAfter rebooting, run this installation again.\n\ncurl -L install.pi-hole.net | bash\n" ${r} ${c} - echo "$existing_free_kilobytes is less than $required_free_kilobytes" echo "Insufficient free space, exiting..." exit 1 @@ -927,7 +927,12 @@ fi # Start the installer # Verify there is enough disk space for the install -verifyFreeDiskSpace +if [ $1 = "--force" ]; then + echo "::: --force passed to script, skipping free disk space verification!" +else + verifyFreeDiskSpace +fi + # Install packages used by this installation script installerDependencies From aca5064743ed9639ca69eb03c031de51147fc22d Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sun, 2 Oct 2016 11:16:48 +0100 Subject: [PATCH 6/7] --force seems to light. lets try --i_do_not_follow_recommendations --- automated install/basic-install.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index f70aeed0..08c2bd6a 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -158,8 +158,8 @@ verifyFreeDiskSpace() { echo "::: Unknown free disk space!" echo "::: We were unable to determine available free disk space on this system." echo "::: You may override this check and force the installation, however, it is not recommended" - echo "::: To do so, pass the argument '--force' to the install script" - echo "::: eg. curl -L https://install.pi-hole.net | bash /dev/stdin --force" + echo "::: To do so, pass the argument '--i_do_not_follow_recommendations' to the install script" + echo "::: eg. curl -L https://install.pi-hole.net | bash /dev/stdin --i_do_not_follow_recommendations" exit 1 # - Insufficient free disk space elif [[ ${existing_free_kilobytes} -lt ${required_free_kilobytes} ]]; then @@ -927,8 +927,9 @@ fi # Start the installer # Verify there is enough disk space for the install -if [ $1 = "--force" ]; then - echo "::: --force passed to script, skipping free disk space verification!" +if [ $1 = "--i_do_not_follow_recommendations" ]; then + echo "::: ----i_do_not_follow_recommendations passed to script" + echo "::: skipping free disk space verification!" else verifyFreeDiskSpace fi From c281b4790583527d22ee8841833fcec3990e3327 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sun, 2 Oct 2016 12:44:33 +0100 Subject: [PATCH 7/7] Mover {SUDO} mkdir -p /etc/pihole/ back to the beginning. --- automated install/basic-install.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 08c2bd6a..4d8c602a 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -804,7 +804,6 @@ installPihole() { checkForDependencies # done stopServices setUser - ${SUDO} mkdir -p /etc/pihole/ if [ ! -d "/var/www/html" ]; then ${SUDO} mkdir -p /var/www/html fi @@ -939,7 +938,7 @@ installerDependencies if [[ ${useUpdateVars} == false ]]; then welcomeDialogs - + ${SUDO} mkdir -p /etc/pihole/ # Find IP used to route to outside world findIPRoute # Find interfaces and let the user choose one