refactoring changes from sequpgrade (endReturn, ...) and some modernizations

This commit is contained in:
2023-01-03 15:49:08 +01:00
parent 215135e8aa
commit 3c22d5729f
69 changed files with 553 additions and 654 deletions

View File

@@ -1,34 +1,26 @@
#!/bin/bash
toolName=redis
toolDeps=redis-server
# Get script working directory
# (when called from a different directory)
WDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >>/dev/null 2>&1 && pwd)"
CONFIG=0
SCRIPT_NAME=$(basename -- $0)
SCRIPT_NAME=${SCRIPT_NAME%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
readonly toolName=redis
readonly toolDeps=redis-server
sq_aptOpt=
seq_config() {
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then
CONFIG=1
if ! initSeqConfig "${seq_configName:?}" "${seq_configTemplate:?}" ; then
# End if no configuration file exists
dry || return 1
fi
## Apt cmdline option to suppress user interaction
interactive || sq_aptOpt="-y"
return 0
}
step_1_info() { echo "Install $toolName"; }
step_1_alias() { echo "install"; }
step_1() {
local aptOpt=
if quiet;then
aptOpt="-y"
fi
exe apt update
exe apt install $toolDeps $aptOpt
exe apt install $toolDeps $sq_aptOpt
}
step_2_info() { echo "Installation notes"; }
@@ -64,7 +56,7 @@ requirepass verystrongpassword
NOTES_EOF
}
step_10_info() {
step_10_info() {
echo "Execute redis-cli commands"
echoinfo " [CLI COMMAND]"
echoinfo " e.g. info"
@@ -82,5 +74,7 @@ step_10() {
fi
}
# shellcheck disable=SC2034 # Appears unused
readonly sqr_minVersion=16
# shellcheck disable=SC1091 # Don't follow this source
. /usr/local/bin/sequencer.sh