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
This commit is contained in:
@@ -59,7 +59,7 @@ endCheckEmpty() {
|
|||||||
errorText=$2
|
errorText=$2
|
||||||
fi
|
fi
|
||||||
if [ -z $ref ] ; then
|
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
|
exit 666
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -70,10 +70,19 @@ existsFunction() {
|
|||||||
return $NOTFOUND
|
return $NOTFOUND
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# saveReturn <ERRNO>
|
||||||
|
# Function returns with <ERRNO> in case step wants additional evaluation
|
||||||
saveReturn() {
|
saveReturn() {
|
||||||
if [ $1 -ne 0 ] ; then
|
if [ $1 -ne 0 ] ; then
|
||||||
ERNO=$1
|
ERNO=$1
|
||||||
fi
|
fi
|
||||||
|
return $ERNO
|
||||||
|
}
|
||||||
|
|
||||||
|
# getReturn
|
||||||
|
# Returns latest saved $ERNO
|
||||||
|
getReturn() {
|
||||||
|
return $ERNO
|
||||||
}
|
}
|
||||||
|
|
||||||
# endReturn [-f] [MESSAGE]
|
# endReturn [-f] [MESSAGE]
|
||||||
@@ -104,9 +113,9 @@ endReturn() {
|
|||||||
if [[ ( $ERNO -ne 0 && $QUIET -ne 0 ) || ( $ERNO -ne 0 && $forceExit -ne 0 ) ]] ; then
|
if [[ ( $ERNO -ne 0 && $QUIET -ne 0 ) || ( $ERNO -ne 0 && $forceExit -ne 0 ) ]] ; then
|
||||||
echo
|
echo
|
||||||
if [ "$endMessage" != "" ]; then
|
if [ "$endMessage" != "" ]; then
|
||||||
echo -e " [E] $endMessage"
|
echo -e " [E] $endMessage\n Sequence stopped"
|
||||||
else
|
else
|
||||||
echo -e " [E] Return value $ERNO detected.\n Aborting installation."
|
echo -e " [E] Return value $ERNO detected.\n Sequence stopped"
|
||||||
fi
|
fi
|
||||||
exit $ERNO
|
exit $ERNO
|
||||||
fi
|
fi
|
||||||
@@ -117,15 +126,15 @@ endReturn() {
|
|||||||
else
|
else
|
||||||
echo " [W] Return value $ERNO detected."
|
echo " [W] Return value $ERNO detected."
|
||||||
fi
|
fi
|
||||||
read -p "End installation: [y]/n? " answer
|
read -p "End sequence: [y]/n? " answer
|
||||||
case $answer in
|
case $answer in
|
||||||
[nN])
|
[nN])
|
||||||
echo
|
echo
|
||||||
echo " [I] Continuing installation..."
|
echo " [I] Continuing sequence..."
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo
|
echo
|
||||||
echo " [E] Installation aborted"
|
echo " [E] Sequence stopped"
|
||||||
exit $ERNO;
|
exit $ERNO;
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -254,7 +263,7 @@ execute() {
|
|||||||
step_$1 $1 $STEP_ARGS
|
step_$1 $1 $STEP_ARGS
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo Aborting installation at step $1
|
echo " [I] Stopping sequence at step $1"
|
||||||
exit 1;
|
exit 1;
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -292,7 +301,7 @@ checkStep() {
|
|||||||
|
|
||||||
# continous <Starting Step Number>
|
# continous <Starting Step Number>
|
||||||
# (max $MAX_STEP)
|
# (max $MAX_STEP)
|
||||||
# execute installation continously from given starting step
|
# execute sequence continously from given starting step
|
||||||
continous() {
|
continous() {
|
||||||
local step=0
|
local step=0
|
||||||
|
|
||||||
@@ -548,6 +557,8 @@ main() {
|
|||||||
|
|
||||||
parseAlias
|
parseAlias
|
||||||
|
|
||||||
|
echo " [I] Staring sequence $(realpath $0) ..."
|
||||||
|
|
||||||
# check if more than one step is given and select execution mode
|
# check if more than one step is given and select execution mode
|
||||||
if [ "${#START[@]}" -gt "1" ]; then
|
if [ "${#START[@]}" -gt "1" ]; then
|
||||||
selection "${START[@]}"
|
selection "${START[@]}"
|
||||||
|
Reference in New Issue
Block a user