mirror of
https://github.com/zuno/slackpkgplus
synced 2024-12-26 09:58:43 +01:00
Catch errors and return exit status: 1 for warning, 2 for fatal
This commit is contained in:
parent
0749b5944c
commit
968f53ca6c
1 changed files with 4 additions and 1 deletions
|
@ -152,6 +152,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
# Get the current exit-code so that we can check if cleanup is
|
# Get the current exit-code so that we can check if cleanup is
|
||||||
# called in response of a CTRL+C (ie. $?=130) or not.
|
# called in response of a CTRL+C (ie. $?=130) or not.
|
||||||
local lEcode=$?
|
local lEcode=$?
|
||||||
|
local retval=0
|
||||||
|
|
||||||
if [ "$CMD" == "info" ];then
|
if [ "$CMD" == "info" ];then
|
||||||
DETAILED_INFO=${DETAILED_INFO:-none}
|
DETAILED_INFO=${DETAILED_INFO:-none}
|
||||||
|
@ -189,6 +190,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
echo -e "\n\n=============================================================================="
|
echo -e "\n\n=============================================================================="
|
||||||
fi
|
fi
|
||||||
if [ -e $TMPDIR/error.log ]; then
|
if [ -e $TMPDIR/error.log ]; then
|
||||||
|
retval=1
|
||||||
echo " WARNING! One or more errors occurred while slackpkg was running"
|
echo " WARNING! One or more errors occurred while slackpkg was running"
|
||||||
echo "------------------------------------------------------------------------------"
|
echo "------------------------------------------------------------------------------"
|
||||||
cat $TMPDIR/error.log
|
cat $TMPDIR/error.log
|
||||||
|
@ -203,6 +205,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
echo "=============================================================================="
|
echo "=============================================================================="
|
||||||
fi
|
fi
|
||||||
if [ -s $TMPDIR/fatal.log ]; then
|
if [ -s $TMPDIR/fatal.log ]; then
|
||||||
|
retval=2
|
||||||
echo
|
echo
|
||||||
echo "=============================================================================="
|
echo "=============================================================================="
|
||||||
echo
|
echo
|
||||||
|
@ -218,7 +221,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
if [ $VERBOSE -lt 3 ];then
|
if [ $VERBOSE -lt 3 ];then
|
||||||
rm -rf $TMPDIR
|
rm -rf $TMPDIR
|
||||||
fi
|
fi
|
||||||
exit
|
exit $retval
|
||||||
} # END function cleanup()
|
} # END function cleanup()
|
||||||
|
|
||||||
# -- handle the event $1 that occured on packages $SHOWLIST
|
# -- handle the event $1 that occured on packages $SHOWLIST
|
||||||
|
|
Loading…
Reference in a new issue