Check for failed SIZE calculation in sysresccd-custom
authorW. Trevor King <wking@drexel.edu>
Wed, 24 Mar 2010 11:43:50 +0000 (07:43 -0400)
committerW. Trevor King <wking@drexel.edu>
Wed, 24 Mar 2010 11:43:50 +0000 (07:43 -0400)
Also removed redundant "exit 1" calls after help_readman calls.

portage-overlay/sys-apps/sysresccd-scripts/files/sysresccd-custom

index f765335dd343bb576b16cef53ff73f084801e409..2cd848478cbdeea8330464a62f4a7c6e61fafecd 100755 (executable)
@@ -73,15 +73,17 @@ die()
 # $1 == MB required by the function
 check_freespace()
 {
-       SIZE=`(\df -m -P ${WORKDIR}) | grep " ${WORKDIR}$" | tail -n 1 | awk '{print $4}'`
-
-       if [ $SIZE -gt $1 ]
+       SIZE=`(df -m -P ${WORKDIR}) | grep " ${WORKDIR}$" | tail -n 1 | awk '{print $4}'`
+       if [ -z "$SIZE" ]
+       then
+               help_readman "Could not determine amount of room in ${WORKDIR}"
+       fi
+       if [ "$SIZE" -gt $1 ]
        then
                echo "there is enough estimated free space here ($SIZE MB) -> ok"
        else
                echo "${PROG}: not enough room in ${WORKDIR}"
                help_readman "You only have $SIZE MB free, and the script needs at least $1 MB free"
-               exit 1
        fi
 }
 
@@ -272,7 +274,6 @@ fi
 if [ ! -d "${WORKDIR}" ]
 then
        help_readman "${PROG}: You need to mount a partition with free space on ${WORKDIR}"
-       exit 1
 fi
 
 case "${COMMAND}" in