Remove duplicate code. get_binary_name is now in the install script
Add some "version" checking to ftl download when using an alt branch, uses checksum
Greatly simplify update process. Source pihole-FTL version checker from basic-install.sh
Always run install script to finalise changes.
Install script now outputs versions after an update
(This is a Squash of previous work into one commit)
Signed-off-by: Adam Warner <adamw@rner.email>
#In the next section we check to see if FTL is already installed (in case of pihole -r).
#If the installed version matches the latest version, then check the installed sha1sum of the binary vs the remote sha1sum. If they do not match, then download
echo -e "${INFO} Checking for existing FTL binary..."
FTLcheckUpdate()
{
localftlLoc=$(which pihole-FTL 2>/dev/null)
local ftlBranch
@ -1910,8 +1903,26 @@ FTLdetect() {
ftlBranch="master"
fi
local remoteSha1
local localSha1
if[[ ! "${ftlBranch}"=="master"]];then
FTLinstall "${binary}"||return1
if[[${ftlLoc}]];then
# We already have a pihole-FTL binary downloaded.
# Alt branches don't have a tagged version against them, so just confirm the checksum of the local vs remote to decide whether we download or not
echo -e "${INFO} Checksum correct. No need to download!"
return1
fi
fi
else
# Install FTL
FTLinstall "${binary}"||return1
return0
fi
fi
}
# Detect suitable FTL binary platform
FTLdetect(){
echo""
echo -e "${INFO} FTL Checks..."
get_binary_name
#In the next section we check to see if FTL is already installed (in case of pihole -r).
#If the installed version matches the latest version, then check the installed sha1sum of the binary vs the remote sha1sum. If they do not match, then download
echo -e "${INFO} Checking for existing FTL binary..."
if FTLcheckUpdate ;then
FTLinstall "${binary}"||return1
fi
echo""
}
@ -2225,6 +2249,10 @@ main() {
echo -e "\\n ${INFO} The install log is located at: ${installLogLoc}