Update step configuration handling
This commit is contained in:
@@ -17,35 +17,45 @@ dockerDnsEntry=
|
||||
|
||||
# Get script working directory
|
||||
# (when called from a different directory)
|
||||
WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
|
||||
CONFIG_FILE="$WDIR/${toolName}.cfg"
|
||||
CONFIG_FILE_DEFAULT="${CONFIG_FILE}.example"
|
||||
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"
|
||||
|
||||
step_config() {
|
||||
if [ ! -s "$CONFIG_FILE" ] && [ ! -s "$CONFIG_FILE_DEFAULT" ] ; then
|
||||
echoerr " [E] No configuration \"$CONFIG_FILE_DEFAULT\" or \"$CONFIG_FILE\" found"
|
||||
exit 1;
|
||||
fi
|
||||
if [ -s "$CONFIG_FILE" ] ; then
|
||||
. "$CONFIG_FILE"
|
||||
## 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
|
||||
echoerr " [W] User configuration \"$CONFIG_FILE\" not found. Using \"$CONFIG_FILE_DEFAULT\""
|
||||
. "$CONFIG_FILE_DEFAULT"
|
||||
# End if no configuration file exists
|
||||
[ $DRY -eq 0 ] && return -1
|
||||
fi
|
||||
|
||||
## Apt cmdline option to suppress user interaction
|
||||
[ $QUIET -ne 0 ] && APTOPT="-y"
|
||||
|
||||
dockerDnsEntry="DOCKER_OPTS=\"--dns $dockerDns1 --dns $dockerDns2\""
|
||||
|
||||
## Return of non zero value will abort the sequence
|
||||
return 0
|
||||
}
|
||||
|
||||
step_1_info() { echo "Install Docker dependencies"; }
|
||||
step_1_alias() { ALIAS="install"; }
|
||||
step_1() {
|
||||
local aptOption=
|
||||
exe apt update
|
||||
if [ $QUIET -ne 0 ] ; then
|
||||
aptOption="-y"
|
||||
else
|
||||
aptOption=""
|
||||
fi
|
||||
exe apt install $dockerDeps $aptOption
|
||||
exe apt install $dockerDeps $APTOPT
|
||||
endReturn -o $? "Docker dependencies installation failed"
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user