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