1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-11-18 06:08:21 +00:00

Proper error handling

This commit is contained in:
DL6ER 2017-02-13 11:33:09 +01:00
parent fbe3dc0dcd
commit 07e37d7fc3
No known key found for this signature in database
GPG Key ID: BB8EC0BC77973A30

View File

@ -1026,8 +1026,9 @@ installPihole() {
fi
installCron
installLogrotate
FTLdownload
FTLinstall
if FTLdownload; then
FTLinstall
fi
configureFirewall
finalExports
#runGravity
@ -1059,8 +1060,9 @@ updatePihole() {
fi
installCron
installLogrotate
FTLdownload
FTLinstall
if FTLdownload; then
FTLinstall
fi
finalExports #re-export setupVars.conf to account for any new vars added in new versions
#runGravity
}
@ -1185,10 +1187,13 @@ FTLdownload() {
latesttag=$(curl -s https://api.github.com/repos/pi-hole/FTL/releases/latest | grep "tag_name" | sed "s/.*: \"//;s/\",//;")
if [ ! "${latesttag}" ]; then
echo "Error in getting latest release tag from GitHub"
return 0
return 1
fi
if curl -sSL --fail "https://github.com/pi-hole/FTL/releases/download/${latesttag}/${binary}" -o "/opt/pihole/pihole-FTL"; then
return 0
else
return 1
fi
curl -sSL "https://github.com/pi-hole/FTL/releases/download/${latesttag}/${binary}" -o "/opt/pihole/pihole-FTL"
return 0
}
FTLinstall() {