I am having trouble with the samples/rc.autofs script.
At office, we have Solaris servers. The NIS server exports a NIS
auto.master map. I am trying to install my own Linux box. The NIS
master map looks like this:
/home /etc/auto.home
/- /etc/auto.direct
On linux, autofs reads the local master map first, then the NIS
master map.
First line, first problem:
/home /etc/auto.home
On Solaris, the local auto_home contains
+auto_home
On Linux, this can't be done without rewriting automount.
Anyway autofs presently cannot hande local maps inside a NIS
master map.
Second line, second problem:
/- /etc/auto.direct
On Solaris, the /etc/auto.direct map can be handled.
On Linux, it can't. I can create an empty local /etc/auto.direct
or not, but a useless /- directory will be created anyway.
What can be done?
To correct the second problem, I can modify autofs to filter out
the entries of the NIS master map with a /- directory or with
auto[_\.]direct in the map name.
To correct the first problem, I can create a local
/etc/master.map
This local master map will contain a reference to a NIS auto.home:
/home auto.home
But for this NIS map to be handled from within a local master map,
I will have to complete the first part of the getmounts() function.
However, if I do this, the NIS master map will be processed after
my local master map has been processed. I am afraid that line
/home /etc/auto.home
from the NIS master map will supersede line
/home auto.home
from my local master map.
So the only solution to the first problem appears to be _not_ to
read the NIS master map _if_ a local master map exists. Note that
this would also be a solution to the second problem.
This would mean changing from
< fi
<
< #
< # Check for YellowPage maps to be loaded
< #
< if [ -e /usr/bin/ypcat ] && [ `ypcat -k auto.master 2>/dev/null | wc -l` -gt 0 ]
to
>
> #
> # Check for YellowPage maps to be loaded
> #
> elif [ -e /usr/bin/ypcat ] && [ `ypcat -k auto.master 2>/dev/null | wc -l` -gt 0 ]
I would also have to allow NIS maps inside a local master map. Here is
how I imagine it, modifying the first part of getmounts():
elif [ -f $map ]; then
echo "/usr/sbin/automount $mountoptions $dir file $map $options $localoptions"
> elif [ -x /usr/bin/ypcat ] && ypcat -k $map >/dev/null 2>&1 ; then
> echo "/usr/sbin/automount $mountoptions $dir yp $map $options $localoptions"
else
echo "/usr/sbin/automount $mountoptions $dir `basename $map` $options
$localoptions"
Is this acceptable? I am afraid this is too different from the
present behaviour, and not very interesting for a Linux-only
network :-( Apart from extending automount itself, I cannot find
another solution. Is this of interest to the Linux community, or I
am better off hacking my own autofs for my own private use?