mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-21 23:00:18 +00:00
Add checking for availability of ftl.pi-hole.net when using FTL from a custom branch. If the server is down (or the user is offline, cannot resolve the domain, etc.), we fail early and hard instead of possibly corrupting the installation
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
9a3affd81e
commit
31a8f150b2
3 changed files with 51 additions and 19 deletions
|
@ -164,7 +164,9 @@ checkout() {
|
|||
path="${2}/${binary}"
|
||||
oldbranch="$(pihole-FTL -b)"
|
||||
|
||||
if check_download_exists "$path"; then
|
||||
check_download_exists "$path"
|
||||
local ret=$?
|
||||
if [ $ret -eq 0 ]; then
|
||||
echo " ${TICK} Branch ${2} exists"
|
||||
echo "${2}" > /etc/pihole/ftlbranch
|
||||
chmod 644 /etc/pihole/ftlbranch
|
||||
|
@ -175,11 +177,19 @@ checkout() {
|
|||
# Update local and remote versions via updatechecker
|
||||
/opt/pihole/updatecheck.sh
|
||||
else
|
||||
echo " ${CROSS} Requested branch \"${2}\" is not available"
|
||||
ftlbranches=( $(git ls-remote https://github.com/pi-hole/ftl | grep 'heads' | sed 's/refs\/heads\///;s/ //g' | awk '{print $2}') )
|
||||
echo -e " ${INFO} Available branches for FTL are:"
|
||||
for e in "${ftlbranches[@]}"; do echo " - $e"; done
|
||||
exit 1
|
||||
if [[ $ret -eq 1 ]]; then
|
||||
echo " ${CROSS} Requested branch \"${2}\" is not available"
|
||||
ftlbranches=( $(git ls-remote https://github.com/pi-hole/ftl | grep 'heads' | sed 's/refs\/heads\///;s/ //g' | awk '{print $2}') )
|
||||
echo -e " ${INFO} Available branches for FTL are:"
|
||||
for e in "${ftlbranches[@]}"; do echo " - $e"; done
|
||||
exit 1
|
||||
elif [[ $ret -eq 2 ]]; then
|
||||
printf " %b Unable to download from ftl.pi-hole.net. Please check your Internet connection and try again later.\\n" "${CROSS}"
|
||||
exit 1
|
||||
else
|
||||
printf " %b Unknown error. Please contact Pi-hole Support\\n" "${CROSS}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue