Use DEFAULT vars

This commit is contained in:
Jeremy Gardais 2022-01-27 09:45:06 +01:00
parent a810e2ce75
commit bea6477709
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 10 additions and 7 deletions

View File

@ -30,12 +30,16 @@ readonly COLOR_DEBUG="${PURPLE}"
script_wd=$(dirname "${0}")
adguard_repo_url="https://github.com/AdguardTeam/AdGuardHome"
# Default values for some vars
readonly ADGUARD_BIN_DEFAULT="/opt/adguard/AdGuardHome/AdGuardHome"
readonly ADGUARD_NEW_VERSION_FILE_DEFAULT="/tmp/.adguard.upgrade"
# }}}
usage() { # {{{
cat <<- EOF
usage: $PROGNAME [-b|-d|-f|-h]
usage: $PROGNAME [-b|-d|-f|-h|-u]
Compare current version of an installed AdGuard Home bin and the last available.
EXAMPLE:
@ -48,11 +52,11 @@ EXAMPLE:
OPTIONS:
-b,--bin
Specify the path of AdGuard Home's binary
(default: /opt/adguard/AdGuardHome/AdGuardHome).
(default: ${ADGUARD_BIN_DEFAULT}).
-f,--file
Set the path to the temp file that will be create and
that should be monitored (default: /tmp/.adguard.upgrade).
that should be monitored (default: ${ADGUARD_NEW_VERSION_FILE_DEFAULT}).
-d,--debug
Enable debug messages.
@ -117,14 +121,13 @@ define_vars() { # {{{
## If adguard_bin wasn't defined (argument,...) {{{
if [ -z "${adguard_bin}" ]; then
### Use default value
adguard_bin="/opt/adguard/AdGuardHome/AdGuardHome"
adguard_bin="${ADGUARD_BIN_DEFAULT}"
fi
## }}}
## If adguard_new_version_file wasn't defined (argument,...) {{{
if [ -z "${adguard_new_version_file}" ]; then
### Store it in /tmp directory
adguard_new_version_file="/tmp/.adguard.upgrade"
### Use default value
adguard_new_version_file="${ADGUARD_NEW_VERSION_FILE_DEFAULT}"
fi
## }}}