full step execution support (selective or continous), profile support, addConf, seq template from own file

WIP helpApi, small refactoring of globals
This commit is contained in:
2022-05-28 23:54:07 +02:00
parent 373cc8e8b6
commit 51e3d774bd
2 changed files with 604 additions and 69 deletions

View File

@@ -2,35 +2,31 @@
readonly toolName=mytool
# Get script working directory
# (when called from a different directory and even when called via symlink)
readonly sq_dir="$(cd "$(dirname -- "$(realpath ${BASH_SOURCE[0]})")" >>/dev/null 2>&1 && pwd)"
readonly sq_scriptFile=$(basename -- $0)
readonly sq_scriptName=${sq_scriptFile%%.*}
readonly sq_configFileName="${sq_scriptName}.cfg"
readonly sq_configFileTemplate="$sq_dir/${sq_configFileName}.example"
# Already defined by sequencer.sh, but may be overwritten
#readonly seq_configName="${sq_scriptName}.cfg"
#readonly seq_configTemplate="${seq_origin}/${sq_configName}.example"
sq_aptOpt=
sq_config=0
step_config() {
seq_config() {
## Called once before executing steps.
## e.g. to source a config file manually:
#. "$sq_config_FILE"
#. "${seq_origin}/${seq_configName}"
## or to use sequencer api with profile config file support:
#initSeqConfig -p "$sq_scriptName" "$sq_configFileTemplate"
#if initSeqConfig -p "${seq_fileName}" "${seq_configTemplate}" ; then
## or to use sequencer api with global config file:
#initSeqConfig "$sq_configFileName" "$sq_configFileTemplate"
#if [ $? -eq 0 ] ; then
#if initSeqConfig "${seq_configName}" "${seq_configTemplate}" ; then
# sq_config=1
#else
# # End if no configuration file exists
# [ $DRY -eq 0 ] && return -1
# dry || return -1
#fi
## Apt cmdline option to suppress user interaction
[ $QUIET -ne 0 ] && sq_aptOpt="-y"
interactive || sq_aptOpt="-y"
## Return of non zero value will abort the sequence
return 0
@@ -39,13 +35,13 @@ step_config() {
step_1_info() { echoinfoArgs "[OPTIONS]"; echo "My custom step"; }
step_1_alias() { echo "begin"; }
step_1() {
echo "Doing something for step $1 ..."
echo "Command line arguments starting with argument 2: $@"
info "Doing something for step $1 ..."
warning "Command line arguments starting with argument 2: $*"
# Use exe for regular command
# Use exep "command" for commands containing pipes or redirects
exe ls
exep "dmesg | head"
}
VERSION_SEQREV=16
readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh