]> git.pld-linux.org Git - packages/autofs.git/blobdiff - autofs.init
- updated to 5.1.7
[packages/autofs.git] / autofs.init
index 6370f0a699f500954f970632c4ed707baaa4bff8..8416ac46c42161f95b2621f82eb7c848739ff039 100644 (file)
@@ -47,27 +47,30 @@ getmounts()
 if [ -f /etc/autofs/auto.master ]; then
        cat /etc/autofs/auto.master | sed -e '/^#/d' -e '/^$/d'| (
        while read dir map options; do
-               if [ ! -z "$dir" -a ! -z "$map" \
-                  -a x`echo "$map" | cut -c1` != 'x-' ]; then
-                       maptype=`echo $map | cut -f1 -d:`
-                       if [ "$maptype" = "$map" ]; then
-                       map=`echo "/etc/autofs/$map" | sed -e 's:^/etc\/autofs//:/:'`
+               if [ ! -z "$dir" -a ! -z "$map" -a x`echo "$map" | cut -c1` != 'x-' ]; then
+                   :
+               else
+                   continue
+               fi
+
+               maptype=${map%%:*}
+               if [ "$maptype" = "$map" ]; 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 --timeout $TIMEOUT $dir program $map $options"
+                               echo "$DAEMON --timeout ${TIMEOUT} ${OPTIONS} $dir program $map $options"
                        elif [ -f $map ]; then
-                               echo "$DAEMON --timeout $TIMEOUT $dir file $map $options"
+                               echo "$DAEMON --timeout ${TIMEOUT} ${OPTIONS} $dir file $map $options"
                        else
-                               echo "$DAEMON --timeout $TIMEOUT $dir `basename $map` $options"
+                               echo "$DAEMON --timeout ${TIMEOUT} ${OPTIONS} $dir `basename $map` $options"
                        fi
-                       else
-                               map=`echo $map | cut -f2- -d:`
-                               if [ ! -z "$map" ]; then
-                                       if [ "$maptype" = "file" ]; then
-                                               map=`echo "/etc/autofs/$map" | sed -e 's:^/etc\/autofs//:/:'`
-                                       fi
-                                       echo "$DAEMON --timeout $TIMEOUT $dir $maptype $map $options"
+               else
+                       map=${map#*/}
+                       if [ "$map" ]; then
+                               if [ "$maptype" = "file" ]; then
+                                       map=`echo "/etc/autofs/$map" | sed -e 's:^/etc/autofs//:/:'`
                                fi
+                               echo "$DAEMON --timeout $TIMEOUT ${OPTIONS} $dir $maptype $map $options"
                        fi
                fi
        done
@@ -93,7 +96,7 @@ if is_yes $USE_YP; then
                                options=`echo "$options" | sed -e '
                                  s/--*t\(imeout\)*[ \t]*[0-9][0-9]*//g
                                  s/\(^\|[ \t]\)-/\1/g'`
-                               echo "$DAEMON --timeout $TIMEOUT $mountoptions \
+                               echo "$DAEMON --timeout $TIMEOUT ${OPTIONS} $mountoptions \
                                  $dir yp $map $options"
                        fi
                done
@@ -102,23 +105,22 @@ if is_yes $USE_YP; then
 fi
 }
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/autofs ]; then
                msg_starting automounter
                busy
-               getmounts | sh
+#              getmounts | sh
+               $DAEMON --timeout $TIMEOUT /etc/autofs/auto.master
                RETVAL=$?
                [ $RETVAL -eq 0 ] && ok || fail
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/autofs
        else
                msg_already_running automounter
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/autofs ]; then
                msg_stopping automounter
                killproc automount
@@ -126,21 +128,30 @@ case "$1" in
        else
                msg_not_running automounter
        fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
        ;;
-  restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
+  stop)
+       stop
        ;;
-  status)
-       nls "Configured Mount Points:"
-       getmounts
-       echo ""
-       nls "Active Mount Points:"
-       ps axw|grep "[0-9]:[0-9][0-9] /usr/sbin/automount " | (
-               while read pid tt stat time command; do echo $command; done
-       )
+  restart|force-reload)
+       stop
+       start
        ;;
+#  status)
+#      nls "Configured Mount Points:"
+#      getmounts
+#      echo ""
+#      nls "Active Mount Points:"
+#      ps axw|grep "[0-9]:[0-9][0-9] /usr/sbin/automount " | (
+#              while read pid tt stat time command; do echo $command; done
+#      )
+#      ;;
   *)
        msg_usage "$0 {start|stop|restart|force-reload|status}"
        exit 3
This page took 0.313387 seconds and 4 git commands to generate.