Also removed redundant "exit 1" calls after help_readman calls.
# $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
}
if [ ! -d "${WORKDIR}" ]
then
help_readman "${PROG}: You need to mount a partition with free space on ${WORKDIR}"
- exit 1
fi
case "${COMMAND}" in