changed the way missing variables are handled; thanks to slakmagik for the suggestions

This commit is contained in:
chess.griffin 2008-03-30 00:36:29 +00:00
parent 96e4fbd924
commit 38e42516d8

View file

@ -43,17 +43,20 @@ if [ ! -e $SBOPKG_CONF ]; then
echo "Please create it and run $SCRIPT again." 1>&2 echo "Please create it and run $SCRIPT again." 1>&2
exit 1 exit 1
else else
for i in RSYNCMIRROR SLACKVER LOCALREPO SRCDIR TMP KEEPLOG . $SBOPKG_CONF
do for VAR in RSYNCMIRROR SLACKVER LOCALREPO SRCDIR TMP KEEPLOG; do
grep "^$i=.\{1,\}" "$SBOPKG_CONF" > /dev/null if [ -z "${!VAR}" ]; then
if [ "$?" != 0 ]; then MISSING+="$VAR "
echo "$SCRIPT: Can't find variable $i declared in" fi
echo "$SCRIPT: $SBOPKG_CONF." done
echo "Please declare it and run $SCRIPT again." if [ "$MISSING" ]; then
echo "$SCRIPT: Can't find a value for variable(s):"
echo "$MISSING"
echo "Please correct this error and run $SCRIPT again."
exit 1 exit 1
fi fi
. $SBOPKG_CONF #. $SBOPKG_CONF
done #done
fi fi
if [ ! -d "$SRCDIR" ]; then if [ ! -d "$SRCDIR" ]; then
echo "Creating local cache directory $SRCDIR to keep \ echo "Creating local cache directory $SRCDIR to keep \