1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 23:08:07 +00:00

Set missing data to N/A

Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
Christian König 2022-10-06 21:55:49 +02:00
parent a478f2460b
commit 79c0b446e1
No known key found for this signature in database

View File

@ -25,41 +25,41 @@ fi
getLocalVersion() { getLocalVersion() {
case ${1} in case ${1} in
"Pi-hole" ) echo "${CORE_VERSION}";; "Pi-hole" ) echo "${CORE_VERSION:=N/A}";;
"AdminLTE" ) [ "${INSTALL_WEB_INTERFACE}" = true ] && echo "${WEB_VERSION}";; "AdminLTE" ) [ "${INSTALL_WEB_INTERFACE}" = true ] && echo "${WEB_VERSION:=N/A}";;
"FTL" ) echo "${FTL_VERSION}";; "FTL" ) echo "${FTL_VERSION:=N/A}";;
esac esac
} }
getLocalHash() { getLocalHash() {
case ${1} in case ${1} in
"Pi-hole" ) echo "${CORE_HASH}";; "Pi-hole" ) echo "${CORE_HASH:=N/A}";;
"AdminLTE" ) [ "${INSTALL_WEB_INTERFACE}" = true ] && echo "${WEB_HASH}";; "AdminLTE" ) [ "${INSTALL_WEB_INTERFACE}" = true ] && echo "${WEB_HASH:=N/A}";;
"FTL" ) echo "${FTL_HASH}";; "FTL" ) echo "${FTL_HASH:=N/A}";;
esac esac
} }
getRemoteHash(){ getRemoteHash(){
case ${1} in case ${1} in
"Pi-hole" ) echo "${GITHUB_CORE_HASH}";; "Pi-hole" ) echo "${GITHUB_CORE_HASH:=N/A}";;
"AdminLTE" ) [ "${INSTALL_WEB_INTERFACE}" = true ] && echo "${GITHUB_WEB_HASH}";; "AdminLTE" ) [ "${INSTALL_WEB_INTERFACE}" = true ] && echo "${GITHUB_WEB_HASH:=N/A}";;
"FTL" ) echo "${GITHUB_FTL_HASH}";; "FTL" ) echo "${GITHUB_FTL_HASH:=N/A}";;
esac esac
} }
getRemoteVersion(){ getRemoteVersion(){
case ${1} in case ${1} in
"Pi-hole" ) echo "${GITHUB_CORE_VERSION}";; "Pi-hole" ) echo "${GITHUB_CORE_VERSION:=N/A}";;
"AdminLTE" ) [ "${INSTALL_WEB_INTERFACE}" = true ] && echo "${GITHUB_WEB_VERSION}";; "AdminLTE" ) [ "${INSTALL_WEB_INTERFACE}" = true ] && echo "${GITHUB_WEB_VERSION:=N/A}";;
"FTL" ) echo "${GITHUB_FTL_VERSION}";; "FTL" ) echo "${GITHUB_FTL_VERSION:=N/A}";;
esac esac
} }
getLocalBranch(){ getLocalBranch(){
case ${1} in case ${1} in
"Pi-hole" ) echo "${CORE_BRANCH}";; "Pi-hole" ) echo "${CORE_BRANCH:=N/A}";;
"AdminLTE" ) [ "${INSTALL_WEB_INTERFACE}" = true ] && echo "${WEB_BRANCH}";; "AdminLTE" ) [ "${INSTALL_WEB_INTERFACE}" = true ] && echo "${WEB_BRANCH:=N/A}";;
"FTL" ) echo "${FTL_BRANCH}";; "FTL" ) echo "${FTL_BRANCH:=N/A}";;
esac esac
} }
@ -73,7 +73,7 @@ versionOutput() {
[ "$2" = "-l" ] || [ "$2" = "--latest" ] || [ -z "$2" ] && latest=$(getRemoteVersion "${1}") [ "$2" = "-l" ] || [ "$2" = "--latest" ] || [ -z "$2" ] && latest=$(getRemoteVersion "${1}")
if [ "$2" = "--hash" ]; then if [ "$2" = "--hash" ]; then
[ "$3" = "-c" ] || [ "$3" = "--current" ] || [ -z "$3" ] && curHash=$(getLocalHash "${1}") && branch=$(getLocalBranch "${1}") [ "$3" = "-c" ] || [ "$3" = "--current" ] || [ -z "$3" ] && curHash=$(getLocalHash "${1}") && branch=$(getLocalBranch "${1}")
[ "$3" = "-l" ] || [ "$3" = "--latest" ] || [ -z "$3" ] && latHash=$(getRemoteHash "${1}") [ "$3" = "-l" ] || [ "$3" = "--latest" ] || [ -z "$3" ] && latHash=$(getRemoteHash "${1}") && branch=$(getLocalBranch "${1}")
fi fi
if [ -n "$current" ] && [ -n "$latest" ]; then if [ -n "$current" ] && [ -n "$latest" ]; then
output="${1} version is $branch $current (Latest: $latest)" output="${1} version is $branch $current (Latest: $latest)"