From c7de26455b98d5ba1c34aa30e8463ad42f24bf62 Mon Sep 17 00:00:00 2001 From: Martin Winkler Date: Thu, 21 Nov 2019 23:30:08 +0100 Subject: [PATCH] new function getReturn which return latest value previously saved by saveReturn function saveReturn returns with the same errno it saved refactor documentation replace installation with sequence and aborted with stopped New starting output with absolute path to seq --- sequencer/sequencer.sh | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/sequencer/sequencer.sh b/sequencer/sequencer.sh index 3c5c76d..9bda6a8 100755 --- a/sequencer/sequencer.sh +++ b/sequencer/sequencer.sh @@ -59,7 +59,7 @@ endCheckEmpty() { errorText=$2 fi if [ -z $ref ] ; then - echo -e " [E] $errorText must not be empty.\nAborting installation." + echo -e " [E] $errorText must not be empty.\n Sequence stopped." exit 666 fi } @@ -70,10 +70,19 @@ existsFunction() { return $NOTFOUND } +# saveReturn +# Function returns with in case step wants additional evaluation saveReturn() { if [ $1 -ne 0 ] ; then ERNO=$1 fi + return $ERNO +} + +# getReturn +# Returns latest saved $ERNO +getReturn() { + return $ERNO } # endReturn [-f] [MESSAGE] @@ -104,9 +113,9 @@ endReturn() { if [[ ( $ERNO -ne 0 && $QUIET -ne 0 ) || ( $ERNO -ne 0 && $forceExit -ne 0 ) ]] ; then echo if [ "$endMessage" != "" ]; then - echo -e " [E] $endMessage" + echo -e " [E] $endMessage\n Sequence stopped" else - echo -e " [E] Return value $ERNO detected.\n Aborting installation." + echo -e " [E] Return value $ERNO detected.\n Sequence stopped" fi exit $ERNO fi @@ -117,15 +126,15 @@ endReturn() { else echo " [W] Return value $ERNO detected." fi - read -p "End installation: [y]/n? " answer + read -p "End sequence: [y]/n? " answer case $answer in [nN]) echo - echo " [I] Continuing installation..." + echo " [I] Continuing sequence..." ;; *) echo - echo " [E] Installation aborted" + echo " [E] Sequence stopped" exit $ERNO; ;; esac @@ -254,7 +263,7 @@ execute() { step_$1 $1 $STEP_ARGS ;; *) - echo Aborting installation at step $1 + echo " [I] Stopping sequence at step $1" exit 1; ;; esac @@ -292,7 +301,7 @@ checkStep() { # continous # (max $MAX_STEP) -# execute installation continously from given starting step +# execute sequence continously from given starting step continous() { local step=0 @@ -548,6 +557,8 @@ main() { parseAlias + echo " [I] Staring sequence $(realpath $0) ..." + # check if more than one step is given and select execution mode if [ "${#START[@]}" -gt "1" ]; then selection "${START[@]}"