Version remote check returns -1 on failure to detect curl silent failing. Update detects loss of contact to GitHub or fallthrough condition and reports to user.

This commit is contained in:
Dan Schaper 2016-11-02 12:07:59 -07:00
parent 3d43e1568c
commit f7266ef4c8
2 changed files with 17 additions and 13 deletions

View file

@ -58,10 +58,10 @@ coreOutput() {
if [[ "${latest}" == true && "${current}" == false ]]; then
piholeVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/pi-hole/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//')
echo ${piholeVersionLatest}
echo ${piholeVersionLatest:-"-1"}
elif [[ "${latest}" == false && "${current}" == true ]]; then
piholeVersion=$(cd /etc/.pihole/ && git describe --tags --abbrev=0)
echo ${piholeVersion}
echo ${piholeVersion:-"-1"}
else
piholeVersion=$(cd /etc/.pihole/ && git describe --tags --abbrev=0)
piholeVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/pi-hole/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//')