refactoring changes from sequpgrade (endReturn, ...) and some modernizations
This commit is contained in:
@@ -1,36 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
toolName=openvpn
|
||||
toolDeps=openvpn
|
||||
toolDefaultConf="/etc/default/openvpn"
|
||||
toolUserScriptsLoc="/usr/lib/openvpn"
|
||||
readonly toolName=openvpn
|
||||
readonly toolDeps=openvpn
|
||||
readonly toolDefaultConf="/etc/default/openvpn"
|
||||
readonly toolUserScriptsLoc="/usr/lib/openvpn"
|
||||
|
||||
# Get script working directory
|
||||
# (when called from a different directory)
|
||||
WDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >>/dev/null 2>&1 && pwd)"
|
||||
APTOPT=
|
||||
CONFIG=0
|
||||
SCRIPT_FILE=$(basename -- $0)
|
||||
SCRIPT_NAME=${SCRIPT_FILE%%.*}
|
||||
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
|
||||
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
|
||||
CONFIG_DIR="$WDIR/$SCRIPT_NAME"
|
||||
sq_aptOpt=
|
||||
|
||||
seq_config() {
|
||||
#echo "Called once before executing steps."
|
||||
## e.g. to source a config file manually:
|
||||
#. "$CONFIG_FILE"
|
||||
## or to use sequencer api with global config file:
|
||||
#initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
|
||||
## or to use sequencer api with profile config file support:
|
||||
#initSeqConfig -p "$SCRIPT_NAME" "$CONFIG_FILE_TEMPLATE"
|
||||
#if [ $? -eq 0 ] ; then
|
||||
# CONFIG=1
|
||||
#else
|
||||
# # End if no configuration file exists
|
||||
# dry || return -1
|
||||
#fi
|
||||
quiet && APTOPT="-y"
|
||||
interactive || sq_aptOpt="-y"
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -38,7 +16,7 @@ step_1_info() { echo "Install $toolName"; }
|
||||
step_1_alias() { echo "install"; }
|
||||
step_1() {
|
||||
exe apt update
|
||||
exe apt install $toolDeps $APTOPT
|
||||
exe apt install $toolDeps $sq_aptOpt
|
||||
}
|
||||
|
||||
step_2_info() { echo "Install customized helper scripts to $toolUserScriptsLoc"; }
|
||||
@@ -46,7 +24,7 @@ step_2() {
|
||||
exep "mkdir \"$toolUserScriptsLoc\" 2>>/dev/null"
|
||||
[ $? -ne 0 ] && \
|
||||
warning "$toolUserScriptsLoc already exists. Not overwriting existing files."
|
||||
exe cp -n "$CONFIG_DIR"/* "$toolUserScriptsLoc"
|
||||
exe cp -n "${seq_origin}/${seq_fileName}"/* "$toolUserScriptsLoc"
|
||||
}
|
||||
|
||||
step_10_info() { echo "Open openvpn system start configuration"; }
|
||||
@@ -55,5 +33,7 @@ step_10() {
|
||||
exe vi "$toolDefaultConf"
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2034 # Appears unused
|
||||
readonly sqr_minVersion=16
|
||||
# shellcheck disable=SC1091 # Don't follow this source
|
||||
. /usr/local/bin/sequencer.sh
|
||||
|
Reference in New Issue
Block a user