Updater implementation for FTL

This commit is contained in:
DL6ER 2017-02-22 10:43:13 +01:00
parent dcb9797f35
commit af2893d2ce
No known key found for this signature in database
GPG key ID: 00135ACBD90B28DD
2 changed files with 28 additions and 2 deletions

View file

@ -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!"

View file

@ -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}')