From bca23dd896e743575e3b9925e3c63f320e421f09 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 15 Apr 2018 18:25:35 +0100 Subject: [PATCH 1/3] Allow passing of --check-only to update script. Don't run installer for updating web files, it's handled by getGitFiles. I think this works... Signed-off-by: Adam Warner --- advanced/Scripts/update.sh | 14 +++++++++++++- pihole | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh index 9dbdb680..f0deab2b 100755 --- a/advanced/Scripts/update.sh +++ b/advanced/Scripts/update.sh @@ -19,6 +19,9 @@ readonly PI_HOLE_FILES_DIR="/etc/.pihole" # shellcheck disable=SC2034 PH_TEST=true +# when --check-only is passed to this script, it will not perform the actual update +CHECK_ONLY=false + # shellcheck disable=SC1090 source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh" # shellcheck disable=SC1091 @@ -140,6 +143,11 @@ main() { exit 0 fi + if [[ "${CHECK_ONLY}" == true ]]; then + echo "" + exit 0 + fi + if [[ "${core_update}" == true ]]; then echo "" echo -e " ${INFO} Pi-hole core files out of date, updating local repo." @@ -159,7 +167,7 @@ main() { echo -e " ${INFO} FTL out of date, it will be updated by the installer." fi - if [[ "${FTL_update}" == true || "${core_update}" == true || "${web_update}" == true ]]; then + if [[ "${FTL_update}" == true || "${core_update}" == true ]]; then ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --reconfigure --unattended || \ echo -e "${basicError}" && exit 1 fi @@ -167,4 +175,8 @@ main() { exit 0 } +if [[ "$1" == "--check-only" ]]; then + CHECK_ONLY=true +fi + main diff --git a/pihole b/pihole index 4c824242..8ae85f00 100755 --- a/pihole +++ b/pihole @@ -71,7 +71,7 @@ flushFunc() { } updatePiholeFunc() { - "${PI_HOLE_SCRIPT_DIR}"/update.sh + "${PI_HOLE_SCRIPT_DIR}"/update.sh "$@" exit 0 } @@ -644,7 +644,7 @@ case "${1}" in "-wild" | "wildcard" ) wildcardFunc "$@";; "-d" | "debug" ) debugFunc "$@";; "-f" | "flush" ) flushFunc "$@";; - "-up" | "updatePihole" ) updatePiholeFunc;; + "-up" | "updatePihole" ) updatePiholeFunc "$@";; "-r" | "reconfigure" ) reconfigurePiholeFunc;; "-g" | "updateGravity" ) updateGravityFunc "$@";; "-c" | "chronometer" ) chronometerFunc "$@";; From 33148ba8328a1646f4ed1b36a5a736a66a24b94d Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 15 Apr 2018 18:30:13 +0100 Subject: [PATCH 2/3] Add help text to pihole command to document new flag Signed-off-by: Adam Warner --- pihole | 1 + 1 file changed, 1 insertion(+) diff --git a/pihole b/pihole index 8ae85f00..3a15df7b 100755 --- a/pihole +++ b/pihole @@ -620,6 +620,7 @@ Options: -q, query Query the adlists for a specified domain Add '-h' for more info on query usage -up, updatePihole Update Pi-hole subsystems + Add '--check-only' to exit script before update is performed. -v, version Show installed versions of Pi-hole, Admin Console & FTL Add '-h' for more info on version usage uninstall Uninstall Pi-hole from your system From e49a9096a52124fbb61e1195f5d949156ad5e03d Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 15 Apr 2018 18:37:32 +0100 Subject: [PATCH 3/3] accidentally a 'shift' Signed-off-by: Adam Warner --- pihole | 1 + 1 file changed, 1 insertion(+) diff --git a/pihole b/pihole index 3a15df7b..cb75861b 100755 --- a/pihole +++ b/pihole @@ -71,6 +71,7 @@ flushFunc() { } updatePiholeFunc() { + shift "${PI_HOLE_SCRIPT_DIR}"/update.sh "$@" exit 0 }