[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#280809: Bug#278229: autofs: Error message when starting



On Wed, Dec 08, 2004 at 11:20:19AM +0100, Anders Boström wrote:
>  SHG> Take a look at the patch for #280209 -- this is a duplicate, and the patch
>  SHG> there should help for this bug as well, of course. If it helps people, I'll
>  SHG> put it into the next upload of autofs.
> The patch in 280209 is broken, it don't work at all if options is used
> in the nis-map auto.master. Take a look at this:

It's supposed to be 280809, not 280209 -- I posted to the wrong bug.

> /usr/sbin/automount --timeout=300 /home yp auto_home -rsize=32768,wsize=32768,intr,-proto=udp,intr,vers=3 
> /usr/sbin/automount --timeout=300 /neti yp auto_neti -rsize=32768,wsize=32768,intr,-intr,vers=3 
> /usr/sbin/automount --timeout=300 /nfs2 yp auto_nfs2 -rsize=32768,wsize=32768,intr,-proto=udp,intr,vers=2 

Ah, so obviously I must remove the last - as well. Try the included patch
instead.

/* Steinar */
-- 
Homepage: http://www.sesse.net/
--- debian/autofs/etc/init.d/autofs	2004-12-08 02:22:14.000000000 +0100
+++ /etc/init.d/autofs	2004-12-08 12:21:35.000000000 +0100
@@ -105,15 +105,23 @@
     else
         map="$1"
     fi
-    /usr/bin/ypcat -k "$map" 2> /dev/null | sed -e '/^#/d' -e '/^$/d'
+    
+    # Append the map's options at the _start_ if there are any options already
+    # (ie. myopt -> $2,myopt), otherwise just append them at the end.
+    /usr/bin/ypcat -k "$map" 2> /dev/null |
+      sed -e '/^#/d' -e '/^$/d' \
+          -e "s/^[ \t]*\([^ \t]\+\)[ \t]\+\([^ \t]\+\)[ \t]\+-\([^ \t]\+\)/\1 \2 $2,\3/" \
+	  -e "s/^[ \t]*\([^ \t]\+\)[ \t]\+\([^ \t]\+\)[ \t]*$/\1 \2 $2/"
 }
 function getfilemounts()
 {
     if [ -f /etc/auto.master ] ; then
         cat /etc/auto.master | grep -v '^\+' | sed -e '/^#/d' -e '/^$/d'
-        for nismap in `cat /etc/auto.master | grep '^\+' | sed -e '/^#/d' -e '/^$/d'`; do
-            catnismap `echo "$nismap" | sed -e 's/^\+//'`
-        done
+	cat /etc/auto.master | grep '^\+' | sed -e '/^#/d' -e '/^$/d' | (
+        while read map options; do
+	    catnismap `echo "$map" | sed -e 's/^\+//'` $options
+	done
+	)
     fi
 }
 function getnismounts()

Reply to: