Rework the /var/run on tmpfs patch and print an error if for some
authornbk <nbk>
Sat, 2 Sep 2006 11:17:16 +0000 (11:17 +0000)
committernbk <nbk>
Sat, 2 Sep 2006 11:17:16 +0000 (11:17 +0000)
reason /var/run is not writable.

debian/freeradius.init

index 6753503..e39a366 100755 (executable)
@@ -20,13 +20,17 @@ test -f $PROGRAM || exit 0
 # /var/run may be a tmpfs
 if [ ! -d /var/run/freeradius ]; then
        install -o freerad -g freerad -m 0755 -d /var/run/freeradius
+       if [ $? -ne 0 ]; then
+               echo "Error creating the /var/run/freeradius directory."
+               exit 1
+       fi
 fi
 
 case "$1" in
        start)
                echo -n "Starting $DESCR: "
                start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $PROGRAM
-               if [ $? = 0 ]; then
+               if [ $? -eq 0 ]; then
                        echo "$PROG."
                else
                        echo "(failed!  run '$PROGRAM -x' to find out why.)"
@@ -48,7 +52,7 @@ case "$1" in
                start-stop-daemon --stop --signal 1 --oknodo --quiet --pidfile $PIDFILE
                sleep 2
                [ -r $PIDFILE ] && kill -0 $(cat $PIDFILE) > /dev/null 2>&1
-               if [ $? = 0 ]; then
+               if [ $? -eq 0 ]; then
                        echo "."
                else
                        echo " failed! ($PROG has died)"