Greetings!

"H. Peter Anvin" <[EMAIL PROTECTED]> writes:

> Scott McDermott wrote:
> > 
> > Camm Maguire on Tue  7/03 17:59 -0500:
> > > --- autofs-3.1.4.orig/samples/rc.autofs.in
> > > +++ autofs-3.1.4/samples/rc.autofs.in
> > > @@ -106,7 +106,10 @@
> > >           if [ ! -z "$dir" -a ! -z "$map" \
> > >                       -a x`echo "$map" | cut -c1` != 'x-' ]
> > >           then
> > > -             map=`echo "$map" | sed -e 's/^auto_/auto./'`
> > > +             if echo $map | grep ^auto_ >/dev/null && \
> > 
> > Not all maps are named auto*.  Try "egrep '^[[:alnum:]]+_'"
> > 
> > But now that I think of it, there is really no reason for this line at
> > all.
> > 
> 

The reason I put this line here is to avoid the time-consuming ypcat
for irrelevant map entries.  Just a performance line, inspired by your
previous note at how long ypcat can take, and my own subsequent tests.

OK, so its all underscores and not just auto_.  I just looked at the
initial sed.  Please see revision below.

> The transformation _ -> . (which I think should be done for all
> underscores) should be done for "yp" (not "file", not "program", not
> "nisplus") maps only.
> 

OK, so if expanded for all underscores, doesn't the placing of this
replacement only affect "yp" maps as written?  The only place the
string "yp" is emmited as an automount argument is in this block.

In other words, the way this is setup to begin with, all maps
'ypcated' from auto.master are assumed to be yp maps, no?


> > > +             [ $(ypcat $map 2>/dev/null | head | wc -l) -eq 0 ] ; then
> > 
> > Please do not use $() as this is bash-only.  Not everyone has bash
> > installed, although I will grant you that most people in the GNU
> > universe do :) I have run into people that use zsh as their /bin/sh,
> > for example.
> > 
> 
> Actually $() is POSIX.
> 

And also, the top of the file is already
#! /bin/bash

But I'll be happy to replace with `` just to get something going.
The advantage of $() is possible nesting, of course.

Please see below.  Any further comments most appreciated!

>       -hpa
> 
> -- 
> <[EMAIL PROTECTED]> at work, <[EMAIL PROTECTED]> in private!
> "Unix gives you enough rope to shoot yourself in the foot."


Thanks!


-- 
Camm Maguire                                            [EMAIL PROTECTED]
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah


--- autofs-3.1.4.orig/samples/rc.autofs.in
+++ autofs-3.1.4/samples/rc.autofs.in
@@ -106,7 +106,10 @@
            if [ ! -z "$dir" -a ! -z "$map" \
                        -a x`echo "$map" | cut -c1` != 'x-' ]
            then
-               map=`echo "$map" | sed -e 's/^auto_/auto./'`
+               if echo $map | grep _ >/dev/null && \
+               [ `ypcat $map 2>/dev/null | head | wc -l` -eq 0 ] ; then
+                   map=`echo "$map" | sed -e 's/_/./g'`
+               fi
                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')"

Reply via email to