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