From af2893d2ce3b4279d74f67813ca0a10e2a3a4e98 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 22 Feb 2017 10:43:13 +0100 Subject: [PATCH] Updater implementation for FTL --- advanced/Scripts/update.sh | 27 +++++++++++++++++++++++++++ automated install/basic-install.sh | 3 +-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh index 10847ead..b5a7e1a4 100755 --- a/advanced/Scripts/update.sh +++ b/advanced/Scripts/update.sh @@ -75,6 +75,18 @@ GitCheckUpdateAvail() { fi } +FTLcheckUpdate() { + + local FTLversion=$(/usr/bin/pihole-FTL tag) + local FTLlatesttag=$(curl -sI https://github.com/pi-hole/FTL/releases/latest | grep 'Location' | awk -F '/' '{print $NF}' | tr -d '\r\n') + + if [[ "${FTLversion}" != "${FTLlatesttag}" ]]; then + return 0 + else + return 1 + fi +} + main() { local pihole_version_current local web_version_current @@ -96,6 +108,21 @@ main() { echo "::: Pi-hole Core: up to date" fi + if FTLcheckUpdate ; then + FTL_update=true + echo "::: FTL: update available" + else + FTL_update=false + echo "::: FTL: up to date" + fi + + if ${FTL_update}; then + echo ":::" + echo "::: FTL out of date" + FTLdetect + echo ":::" + fi + if [[ ${INSTALL_WEB} == true ]]; then if ! is_repo "${ADMIN_INTERFACE_DIR}" ; then echo "::: Critical Error: Web Admin repo is missing from system!" diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 3f8122cd..e784ab18 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1157,8 +1157,7 @@ FTLinstall() { local binary="${1}" local latesttag local orig_dir - echo ":::" - echo -n "::: Installing FTL... " + echo -n "::: Installing FTL... " orig_dir="${PWD}" latesttag=$(curl -sI https://github.com/pi-hole/FTL/releases/latest | grep "Location" | awk -F '/' '{print $NF}')