- Move some functions from checkout to basic-install
- provide helpful error message on downlaod not existing
Signed-off-by: Adam Warner <adamw@rner.email>
echo -e "${INFO} FTL:\\t\\t${COL_LIGHT_GREEN}up to date${COL_NC}"
;;
2)
echo -e "${INFO} FTL:\\t\\t${COL_LIGHT_RED}Branch is not available.${COL_NC}\\n\\t\\t\\tUse ${COL_LIGHT_GREEN}pihole checkout ftl [branchname]${COL_NC} to switch to a valid branch."
;;
*)
echo -e "${INFO} FTL:\\t\\t${COL_LIGHT_RED}Something has gone wrong, contact support${COL_NC}"
esac
FTL_update=false
echo -e "${INFO} FTL:\\t\\t${COL_LIGHT_GREEN}up to date${COL_NC}"
str="Switching to branch: '${branch}' from '${oldbranch}'"
echo -ne "${INFO}$str"
git checkout "${branch}" --quiet ||return1
echo -e "${OVER}${TICK}$str"
git_pull=$(git pull ||return 1)
if[["$git_pull"== *"up-to-date"* ]];then
echo -e "${INFO}${git_pull}"
else
echo -e "$git_pull\\n"
fi
return0
}
clone_or_update_repos(){
# If the user wants to reconfigure,
if[["${reconfigure}"==true]];then
@ -1977,6 +2057,15 @@ FTLcheckUpdate()
fi
if[[ ! "${ftlBranch}"=="master"]];then
#Check whether or not the binary for this FTL branch actually exists. If not, then there is no update!
local path
path="${ftlBranch}/${binary}"
# shellcheck disable=SC1090
if ! check_download_exists "$path";then
echo -e "${INFO} Branch \"${ftlBranch}\" is not available.\\n ${INFO} Use ${COL_LIGHT_GREEN}pihole checkout ftl [branchname]${COL_NC} to switch to a valid branch."
return2
fi
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