Hi,

I've modified the autofs startup script to support Sun style external
map substitution.

You can put something like

+auto_foo

in you maps and the auto_foo file or NIS map will be inlined. It _seems_
to work on my site. Sorry for any stupid mistakes, but I'm not in
any way a sh hacker.

Please CC any answers to me as I'm not a member of this list.

//Mattias

--- autofs      Sun Oct  3 19:39:36 1999
+++ autofs.orig Fri Sep 17 18:13:28 1999
@@ -6,16 +6,14 @@
 #
 #      rc file for automount using a Sun-style "master map".
 #      We first look for a local /etc/auto.master, then a YP
-#      map with that name. Sun-style external maps are
-#       supported (ie +some_map will be replaced by the
-#       file /etc/some_map or the NIS map some_map).
+#      map with that name
 #
 # chkconfig: - 72 08
 # description: automatically mounts filesystems when you use \
 #   them, and unmounts them later when you are not using them.
 # processname: automount
 #   Note that there may be multiple processes names automount
-# config: /etc/$mastermap
+# config: /etc/auto.master
 #   Note that all other config files are automatically reloaded
 #   and may be different on different systems; we can ignore them
 #   here
@@ -32,11 +30,6 @@
 localoptions=''
 
 #
-# This is the name of the (NIS or file) master map.
-#
-mastermap='auto.master'
-
-#
 #      This function will build a list of automount commands to execute in
 #      order # to activate all the mount points. It is used to figure out
 #      the difference of automount points in case of a reload
@@ -46,14 +39,10 @@
 #
 #      Check for local maps to be loaded
 #
-basemap=$1
-if [ -f /etc/$basemap ] ; then
-    cat /etc/$basemap | sed -e '/^#/d' -e '/^$/d'| (
+if [ -f /etc/auto.master ] ; then
+    cat /etc/auto.master | sed -e '/^#/d' -e '/^$/d'| (
        while read dir map options ;  do
-           # deal with external maps
-           if echo $dir | grep '^\+.*' >/dev/null 2>&1 ; then
-               getmounts `echo $dir | sed s/.*+//`
-           elif [ ! -z "$dir" -a ! -z "$map" \
+           if [ ! -z "$dir" -a ! -z "$map" \
                        -a x`echo "$map" | cut -c1` != 'x-' ]
            then
                # special: treat -t or --timeout (or any reasonable derivative)
@@ -93,15 +82,15 @@
 #
 #      Check for YellowPage maps to be loaded
 #
-if [ -e /usr/bin/ypcat ] && [ `ypcat -k $basemap 2>/dev/null | wc -l` -gt 0 ]
+if [ -e /usr/bin/ypcat ] && [ `ypcat -k auto.master 2>/dev/null | wc -l` -gt 0 ]
 then
-    ypcat -k $basemap | (
+    ypcat -k auto.master | (
        while read dir map options
        do
            if [ ! -z "$dir" -a ! -z "$map" \
                        -a x`echo "$map" | cut -c1` != 'x-' ]
            then
-               #map=`echo "$map" | sed -e 's/^auto_/auto./'`
+               map=`echo "$map" | sed -e 's/^auto_/auto./'`
                if echo $options | grep -- '-t' >/dev/null 2>&1 ; then
                    mountoptions="--timeout $(echo $options | \
                      sed 's/^.*-t\(imeout\)*[ \t]*\([0-9][0-9]*\).*$/\2/g')"
@@ -124,7 +113,7 @@
        # Check if the automounter is already running?
        if [ ! -f /var/lock/subsys/automount ]; then
            echo 'Starting automounter: '
-           getmounts $mastermap | sh
+           getmounts | sh
            touch /var/lock/subsys/automount
        fi
        ;;
@@ -137,10 +126,10 @@
                echo "Automounter not running"
                exit 1
        fi
-       echo "Checking for changes to /etc/$mastermap ...."
+       echo "Checking for changes to /etc/auto.master ...."
        TMP1=`mktemp /tmp/autofs.XXXXXX` || { echo "could not make temp file" >&2; 
exit 1; }
        TMP2=`mktemp /tmp/autofs.XXXXXX` || { echo "could not make temp file" >&2; 
exit 1; }
-       getmounts $mastermap >$TMP1
+       getmounts >$TMP1
        ps ax|grep "[0-9]:[0-9][0-9] /usr/sbin/automount " | (
            while read pid tt stat time command; do
                echo "$command" >>$TMP2
@@ -160,7 +149,7 @@
        ;;
   status)
        echo "Configured Mount Points:"
-       getmounts $mastermap
+       getmounts
        echo ""
        echo "Active Mount Points:"
        ps ax|grep "[0-9]:[0-9][0-9] /usr/sbin/automount " | (

Reply via email to