]> git.pld-linux.org Git - packages/autofs.git/blobdiff - autofs.init
- spec adapterized.
[packages/autofs.git] / autofs.init
index 6bb58969e24c02e67da05772ef30f66a5eaae132..0cd4433de010acd716f6b11e79a4f96edd3cbaa2 100644 (file)
 # Get network config
 . /etc/sysconfig/network
 
+# Demon specified configuration.
+[ -f /etc/sysconfig/autofs ] && . /etc/sysconfig/autofs
+
 # Check that networking is up.
-if [ "${NETWORKING}" = "no" ]; then
-       echo "WARNING: Networking is down. Autofs service can't be runed."
-       exit 1
+if is_no "${NETWORKING}"; then
+        # nls "ERROR: Networking is down. %s can't be run." <service>
+        msg_Network_Down automounter
+        exit 1
 fi
-
-DAEMON=usr/sbin/automount
-
-#      We can add local options here
-#      e.g. localoptions='rsize=8192,wsize=8192'
-#
-localoptions=''
+                       
+DAEMON=/usr/sbin/automount
 
 #
 #      This function will build a list of automount commands to execute in
@@ -53,11 +52,11 @@ then
                map=`echo "/etc/autofs/$map" | sed -e 's:^/etc\/autofs//:/:'`
                options=`echo "$options" | sed -e 's/\(^\|[ \t]\)-/\1/g'`
                if [ -x $map ]; then
-                   echo "$DAEMON $daemonoptions $dir program $map $options $localoptions"
+                   echo "$DAEMON --timeout $TIMEOUT $dir program $map $options"
                elif [ -f $map ]; then
-                   echo "$DAEMON $daemonoptions $dir file $map $options $localoptions"
+                   echo "$DAEMON --timeout $TIMEOUT $dir file $map $options"
                else
-                   echo "$DAEMON $daemonoptions $dir `basename $map` $options $localoptions"
+                   echo "$DAEMON --timeout $TIMEOUT $dir `basename $map` $options"
                fi
            fi
        done
@@ -83,7 +82,7 @@ then
                 options=`echo "$options" | sed -e '
                   s/--*t\(imeout\)*[ \t]*[0-9][0-9]*//g
                   s/\(^\|[ \t]\)-/\1/g'`
-               echo "$DAEMON $daemonoptions $mountoptions $dir yp $map $options $localoptions"
+               echo "$DAEMON --timeout $TIMEOUT $mountoptions $dir yp $map $options"
            fi
        done
     )
@@ -97,28 +96,31 @@ case "$1" in
   start)
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/automount ]; then
-               show Starting automounter
+                msg_starting automounter
                busy
                if getmounts | sh; then
                    deltext;ok
                else
                    deltext;ok
                fi
+                RETVAL=$?
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/automount
        else
-           echo "automount already is running"
+                msg_Already_Running automounter
+               exit 1
        fi
-       touch /var/lock/subsys/automount
        ;;
   stop)
-       show Stopping automounter
-       killproc automount -TERM
-       rm -f /var/lock/subsys/automount
+        if [ -f /var/lock/subsys/automount ]; then
+                msg_stopping automount -TERM
+                killproc automount
+                rm -f /var/lock/subsys/automount >/dev/null 2>&1
+        else
+                msg_Not_Running automounter
+                exit 1
+        fi
        ;;
-  restart|reload)
-       if [ ! -f /var/lock/subsys/automount ]; then
-               echo "Automounter not running"
-               exit 1
-       fi
+  restart)
        $0 stop
        $0 start
        ;;
@@ -132,8 +134,8 @@ case "$1" in
        )
        ;;
   *)
-       echo "Usage: $0 {start|stop|restart|reload|status}"
+       msg_Usage: "$0 {start|stop|restart|status}"
        exit 1
 esac
 
-exit 0
+exit $RETVAL
This page took 0.034776 seconds and 4 git commands to generate.