|
|
@ -2030,21 +2030,9 @@ FTLcheckUpdate() {
|
|
|
|
# Alt branches don't have a tagged version against them, so just
|
|
|
|
# Alt branches don't have a tagged version against them, so just
|
|
|
|
# confirm the checksum of the local vs remote to decide whether we
|
|
|
|
# confirm the checksum of the local vs remote to decide whether we
|
|
|
|
# download or not
|
|
|
|
# download or not
|
|
|
|
remoteSha1=$(curl -sSL --fail "https://ftl.pi-hole.net/${ftlBranch}/${binary}.sha1" | cut -d ' ' -f 1)
|
|
|
|
printf " %b FTL binary already installed. Confirming Checksum...\\n" "${INFO}"
|
|
|
|
localSha1=$(sha1sum "${ftlLoc}" | cut -d ' ' -f 1)
|
|
|
|
checkSumFile="https://ftl.pi-hole.net/${ftlBranch}/${binary}.sha1"
|
|
|
|
|
|
|
|
# Continue further down...
|
|
|
|
# Check we downloaded a valid checksum (no 404 or other error like
|
|
|
|
|
|
|
|
# no DNS resolution)
|
|
|
|
|
|
|
|
if [[ ! "${remoteSha1}" =~ ^[a-f0-9]{40}$ ]]; then
|
|
|
|
|
|
|
|
printf " %b Remote checksum not available, trying to download binary from ftl.pi-hole.net.\\n" "${CROSS}"
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
elif [[ "${remoteSha1}" != "${localSha1}" ]]; then
|
|
|
|
|
|
|
|
printf " %b Checksums do not match, downloading from ftl.pi-hole.net.\\n" "${INFO}"
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
printf " %b Checksum of installed binary matches remote. No need to download!\\n" "${INFO}"
|
|
|
|
|
|
|
|
return 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
@ -2066,15 +2054,25 @@ FTLcheckUpdate() {
|
|
|
|
|
|
|
|
|
|
|
|
# Check if the installed version matches the latest version
|
|
|
|
# Check if the installed version matches the latest version
|
|
|
|
if [[ "${FTLversion}" != "${FTLlatesttag}" ]]; then
|
|
|
|
if [[ "${FTLversion}" != "${FTLlatesttag}" ]]; then
|
|
|
|
# If the installed version does not match the latest version, then download
|
|
|
|
# If the installed version does not match the latest version,
|
|
|
|
|
|
|
|
# then download
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
else
|
|
|
|
# If the installed version matches the latest version, then
|
|
|
|
# If the installed version matches the latest version, then
|
|
|
|
# check the installed sha1sum of the binary vs the remote
|
|
|
|
# check the installed sha1sum of the binary vs the remote
|
|
|
|
# sha1sum. If they do not match, then download
|
|
|
|
# sha1sum. If they do not match, then download
|
|
|
|
printf " %b Latest FTL Binary already installed (%s). Confirming Checksum...\\n" "${INFO}" "${FTLlatesttag}"
|
|
|
|
printf " %b Latest FTL binary already installed (%s). Confirming Checksum...\\n" "${INFO}" "${FTLlatesttag}"
|
|
|
|
|
|
|
|
checkSumFile="https://github.com/pi-hole/FTL/releases/download/${FTLversion%$'\r'}/${binary}.sha1"
|
|
|
|
|
|
|
|
# Continue further down...
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
remoteSha1=$(curl -sSL --fail "https://github.com/pi-hole/FTL/releases/download/${FTLversion%$'\r'}/${binary}.sha1" | cut -d ' ' -f 1)
|
|
|
|
# If we reach this point, we need to check the checksum of the local vs
|
|
|
|
|
|
|
|
# remote to decide whether we download or not
|
|
|
|
|
|
|
|
remoteSha1=$(curl -sSL --fail "${checkSumFile}" | cut -d ' ' -f 1)
|
|
|
|
localSha1=$(sha1sum "${ftlLoc}" | cut -d ' ' -f 1)
|
|
|
|
localSha1=$(sha1sum "${ftlLoc}" | cut -d ' ' -f 1)
|
|
|
|
|
|
|
|
|
|
|
|
# Check we downloaded a valid checksum (no 404 or other error like
|
|
|
|
# Check we downloaded a valid checksum (no 404 or other error like
|
|
|
@ -2085,15 +2083,10 @@ FTLcheckUpdate() {
|
|
|
|
elif [[ "${remoteSha1}" != "${localSha1}" ]]; then
|
|
|
|
elif [[ "${remoteSha1}" != "${localSha1}" ]]; then
|
|
|
|
printf " %b Corruption detected, redownloading binary...\\n" "${CROSS}"
|
|
|
|
printf " %b Corruption detected, redownloading binary...\\n" "${CROSS}"
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
printf " %b Checksum correct. No need to download!\\n" "${INFO}"
|
|
|
|
printf " %b Checksum correct. No need to download!\\n" "${INFO}"
|
|
|
|
return 1
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Detect suitable FTL binary platform
|
|
|
|
# Detect suitable FTL binary platform
|
|
|
|