From: Stef Bon Subject: Re: Proposed update to auto.smb Date: Mon, 3 Nov 2008 15:48:56 +0100 Message-ID: <200811031548.56591.stef@bononline.nl> References: <1225679565.2911.31.camel@zeus.themaw.net> <1225681504.2911.41.camel@zeus.themaw.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7565060713117480073==" Return-path: In-Reply-To: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: autofs-bounces@linux.kernel.org Errors-To: autofs-bounces@linux.kernel.org To: autofs@linux.kernel.org Cc: Ian Kent --===============7565060713117480073== Content-Type: multipart/alternative; boundary="Boundary-00=_Y9wDJC4ipdhrL2R" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-00=_Y9wDJC4ipdhrL2R Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit On Monday 03 November 2008 15:16:33 Jeff Moyer wrote: > Ian Kent writes: > > On Mon, 2008-11-03 at 11:32 +0900, Ian Kent wrote: > >> Hi all, > >> > >> Stef Bon has reported some difficulty with the current auto.smb. > > -opts="-fstype=cifs" > > + > > +FILESYSTEM="cifs" > > + > > So, umm, when is $FILESYSTEM not going to be cifs? > That's a good one. I thought it's a good thing to still support smbfs, which is not cifs obviously. > > +if [ "$FILESYSTEM" != "cifs" ]; then > > + opts="-fstype=$FILESYSTEM,guest" > > +else > > + for P in /bin /sbin /usr/bin /usr/sbin > > + do > > + if [ -x $P/nmblookup ]; then > > + NMBLOOKUP=$P/nmblookup > > + break > > + fi > > + done > > + > > + if [ ! -x "$NMBLOOKUP" ]; then > > + exit 1 > > + fi > > Is it possible to not have the nmblookup program? It seems to me it > would be safer to at least try the mount w/o the ip address if you can't > obtain one. Yes, that's also good choice. Now the script fails when nmblookup is not found, which is not always necessary. > > > + > > + ipaddress=$($NMBLOOKUP $key --debug-level=0 2>>/dev/null | grep '<00>' > > | awk '{ print $1 }') + if [ -z "$ipaddress" ]; then > > + exit 1 > > + fi > > + > > + opts="-fstype=cifs,guest,ip=$ipaddress" > > +fi > > > > for P in /bin /sbin /usr/bin /usr/sbin > > do > > Can we compress these two loops that do the same thing (determine the > path to the samba/cifs binaries)? Yes possibly. But the loop to find nmblookup is only done when using cifs (see above..). Also, when combined, the loop should not stop when only one is found, but both. But yes it's possible to create one loop with some if and thens. Stef --Boundary-00=_Y9wDJC4ipdhrL2R Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 7bit On Monday 03 November 2008 15:16:33 Jeff Moyer wrote:
> Ian Kent <raven@themaw.net> writes:
> > On Mon, 2008-11-03 at 11:32 +0900, Ian Kent wrote:
> >> Hi all,
> >>
> >> Stef Bon has reported some difficulty with the current auto.smb.
> > -opts="-fstype=cifs"
> > +
> > +FILESYSTEM="cifs"
> > +
>
> So, umm, when is $FILESYSTEM not going to be cifs?
>
That's a good one. I thought it's a good thing to still support
smbfs, which is not cifs obviously.


> > +if [ "$FILESYSTEM" != "cifs" ]; then
> > + opts="-fstype=$FILESYSTEM,guest"
> > +else
> > + for P in /bin /sbin /usr/bin /usr/sbin
> > + do
> > + if [ -x $P/nmblookup ]; then
> > + NMBLOOKUP=$P/nmblookup
> > + break
> > + fi
> > + done
> > +
> > + if [ ! -x "$NMBLOOKUP" ]; then
> > + exit 1
> > + fi
>
> Is it possible to not have the nmblookup program? It seems to me it
> would be safer to at least try the mount w/o the ip address if you can't
> obtain one.


Yes, that's also good choice. Now the script fails when nmblookup is not found, which is not always necessary.


>
> > +
> > + ipaddress=$($NMBLOOKUP $key --debug-level=0 2>>/dev/null | grep '<00>'
> > | awk '{ print $1 }') + if [ -z "$ipaddress" ]; then
> > + exit 1
> > + fi
> > +
> > + opts="-fstype=cifs,guest,ip=$ipaddress"
> > +fi
> >
> > for P in /bin /sbin /usr/bin /usr/sbin
> > do
>
> Can we compress these two loops that do the same thing (determine the
> path to the samba/cifs binaries)?


Yes possibly. But the loop to find nmblookup is only done when using cifs (see above..). Also, when combined, the loop should not stop when only one is found, but both. But yes it's possible to create one loop with some if and thens.


Stef


--Boundary-00=_Y9wDJC4ipdhrL2R-- --===============7565060713117480073== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ autofs mailing list autofs@linux.kernel.org http://linux.kernel.org/mailman/listinfo/autofs --===============7565060713117480073==--