Output error if step_config fails

Small enhancement of the template
This commit is contained in:
2021-03-27 05:33:38 +00:00
parent 86cee821ba
commit 260daa009c

View File

@@ -9,7 +9,7 @@
VERSION_REV=12
VERSION_MAJOR=2
VERSION_MINOR=0
VERSION_MINOR=1
## Start of generic script part
@@ -816,11 +816,13 @@ CONFIG_FILE_NAME="\${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="\$WDIR/\${CONFIG_FILE_NAME}.example"
step_config() {
echo "Called once before executing steps."
## 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
@@ -829,7 +831,11 @@ step_config() {
# # End if no configuration file exists
# [ \$DRY -eq 0 ] && return -1
#fi
#[ \$QUIET -ne 0 ] && APTOPT="-y"
## Apt cmdline option to suppress user interaction
[ \$QUIET -ne 0 ] && APTOPT="-y"
## Return of non zero value will abort the sequence
return 0
}
@@ -1101,7 +1107,7 @@ main() {
parseAlias
# run configuration for seq only if available and if first step is valid
# run configuration for sequence only if available and if first step is valid
existsFunction step_config
if [ $? -eq 0 ] ; then
if [ $SEQ_CONFIG_EDIT -ne 0 ] ; then
@@ -1112,9 +1118,12 @@ main() {
fi
checkStep "${START[0]}"
if [ $? -ne 0 ] ; then
if [ $QUIET -ne 2 ] ; then echo " [I] Configuring sequence (step_config) ..." ; fi
echoseq " [I] Configuring sequence (step_config)"
step_config "${STEP_ARGS[@]}"
[ $? -ne 0 ] && exit 1
if [ $? -ne 0 ]; then
echoerr " [E] Configuring sequence failed"
exit 1
fi
else
return 1
fi