Bump sequencer revision to 6

Adding optional message for endReturnto replace predefined one
This commit is contained in:
2019-11-20 23:08:44 +01:00
parent b79ae416e6
commit f5193f46ee

View File

@@ -6,7 +6,7 @@
## Version information ## Version information
VERSION_REV=5 VERSION_REV=6
VERSION_MAJOR=0 VERSION_MAJOR=0
VERSION_MINOR=0 VERSION_MINOR=0
@@ -76,26 +76,56 @@ saveReturn() {
fi fi
} }
# endReturn [-f] # endReturn [-f] [MESSAGE]
# -f : force exit with $ERNO without user input # -f : force exit with $ERNO without user input
# MESSAGE : Custom error message
#
endReturn() { endReturn() {
if [[ ( $ERNO -ne 0 && $QUIET -ne 0 ) || ( $ERNO -ne 0 && ! -z $1 && $1 == "-f" ) ]] ; then local forceExit=0
local endMessage=""
for arg in "$@" ; do
case "$1" in
-f)
forceExit=1
skipStep=0
shift
;;
"")
break
;;
*)
endMessage="$@"
break
;;
esac
done
if [[ ( $ERNO -ne 0 && $QUIET -ne 0 ) || ( $ERNO -ne 0 && $forceExit -ne 0 ) ]] ; then
echo echo
echo -e " [E] Return value $ERNO detected.\nAborting installation." if [ "$endMessage" != "" ]; then
echo -e " [E] $endMessage"
else
echo -e " [E] Return value $ERNO detected.\n Aborting installation."
fi
exit $ERNO exit $ERNO
fi fi
if [ $ERNO -ne 0 ] ; then if [ $ERNO -ne 0 ] ; then
echo echo
echo " [E] Return value $ERNO detected." if [ "$endMessage" != "" ]; then
echo -e " [W] $endMessage"
else
echo " [W] Return value $ERNO detected."
fi
read -p "End installation: [y]/n? " answer read -p "End installation: [y]/n? " answer
case $answer in case $answer in
[nN]) [nN])
echo echo
echo Continuing installation... echo " [I] Continuing installation..."
;; ;;
*) *)
echo echo
echo Installation aborted echo " [E] Installation aborted"
exit $ERNO; exit $ERNO;
;; ;;
esac esac
@@ -355,7 +385,7 @@ displayHelp() {
fi fi
stepsFound=1 stepsFound=1
done done
if [ $stepsFound -eq 0 ] ; then if [ $stepsFound -eq 0 ] ; then
echo -e "\n It seems ${0##*/} was called directly." echo -e "\n It seems ${0##*/} was called directly."
echo -e " Please create a sequence script first.\n" echo -e " Please create a sequence script first.\n"