Store versions as key/value pairs rather than space delimeted values

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
Adam Warner 2022-08-22 18:53:46 +01:00
parent 4cf3280500
commit 5421aad03e
No known key found for this signature in database
GPG key ID: 872950F3ECF2B173
3 changed files with 50 additions and 35 deletions

View file

@ -90,16 +90,17 @@ getRemoteVersion(){
local version
local cachedVersions
local arrCache
cachedVersions="/etc/pihole/GitHubVersions"
cachedVersions="/etc/pihole/versions"
#If the above file exists, then we can read from that. Prevents overuse of GitHub API
if [[ -f "$cachedVersions" ]]; then
IFS=' ' read -r -a arrCache < "$cachedVersions"
source "$cachedVersions"
case $daemon in
"pi-hole" ) echo "${arrCache[0]}";;
"AdminLTE" ) [[ "${INSTALL_WEB_INTERFACE}" == true ]] && echo "${arrCache[1]}";;
"FTL" ) [[ "${INSTALL_WEB_INTERFACE}" == true ]] && echo "${arrCache[2]}" || echo "${arrCache[1]}";;
"pi-hole" ) echo "${GITHUB_CORE_VERSION}";;
"AdminLTE" ) [[ "${INSTALL_WEB_INTERFACE}" == true ]] && echo "${GITHUB_WEB_VERSION}";;
"FTL" ) echo "${GITHUB_FTL_VERSION}";;
esac
return 0