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_REV=5
VERSION_REV=6
VERSION_MAJOR=0
VERSION_MINOR=0
@@ -76,26 +76,56 @@ saveReturn() {
fi
}
# endReturn [-f]
# endReturn [-f] [MESSAGE]
# -f : force exit with $ERNO without user input
# MESSAGE : Custom error message
#
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
if [ "$endMessage" != "" ]; then
echo -e " [E] $endMessage"
else
echo -e " [E] Return value $ERNO detected.\n Aborting installation."
fi
exit $ERNO
fi
if [ $ERNO -ne 0 ] ; then
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
case $answer in
[nN])
echo
echo Continuing installation...
echo " [I] Continuing installation..."
;;
*)
echo
echo Installation aborted
echo " [E] Installation aborted"
exit $ERNO;
;;
esac