Hi all,
I'm new to this list and also as a user of Linux's automounter. I
found it very interesting to read the discussion about the future
version of automount that took place in this list some days ago
because I administer a network of several different flavors of UNIX
(Solaris, SunOS, HP-UX, AIX, and OSF) and we're starting to configure
the first Linuxes by demand of some users.
I'm not new to Linux since I use it at home for two years, but
configuring it in our network means that it needs to use the services
already provided by the other UNIXes which can be difficult sometimes.
One of these services is the automounter NIS maps that the other
UNIXes use. In these maps we make extensive use of replicated
file-systems mainly to avoid the necessity of internetwork NFS mounts.
We use a few direct maps with very few entries, but they're really
useful. Both of these features aren't supported in the current
version of Linux's automount.
Another minor difference between Sun's automounter and Linux's is that
the former uses the /etc/nsswitch.conf file to decide where to get the
maps from while the current Linux's rc.autofs script uses a fixed
approach. It first reads the file /etc/auto.master and looks the
referenced maps first as a program file, then as a readable file, and,
at last, as a YP map. Then it reads the auto.master YP map and looks
the referenced maps as YP maps only.
I took some time trying to find a way to circumvent the current
Linux's automounter limitations in order to make our Linux systems
more consistent with the rest of the UNIX boxes. The result was a
slightly rewritten rc.autofs and a perl script called automap.
The new rc.autofs uses the /etc/nsswitch.conf to decide where to get
the maps from and knows how to interact with automap to setup the base
directories and the symbolic links needed to fake the direct maps
entries.
The automap script is responsible for preprocessing Sun maps pruning
replicated servers and faking indirect mounts for direct maps.
As an example of how they're used, let's say we have an indirect YP
map with replicated servers called auto.indirect and two direct YP
maps auto.direct.common and auto.direct.linux. In a Solaris machine
with a `automount: files nis' entry in /etc/nsswitch.conf we'd have a
/etc/auto_master or a auto.master YP map with the following entries:
/tools auto.indirect
/- auto.direct
auto.direct would be the actual YP map and auto.direct could be a
readable file /etc/auto.direct that includes the two direct YP maps as
follows:
+auto.direct.common
+auto.direct.linux
If i want to configure a Linux machine to use the same YP maps I don't
need to change anything in auto.master. I only need to create two
shell scripts called /etc/auto.indirect and /etc/auto.direct making
both executables. They can be as follows:
$ cat /etc/auto.indirect
#!/bin/sh
/sbin/automap "$1" -yp auto.indirect
$ cat /etc/auto.direct
#!/bin/sh
/sbin/automap "$1" -yp auto.direct.common -yp auto.direct.linux
$
In essence, what's needed it to transform each direct map or any map
with replicated servers in a program map that just calls /sbin/automap
with the appropriate arguments.
Those willing to take a look at the scripts can fetch them from
http://www.cpqd.com.br/~gustavo/docs/automap.tar.gz. I'd like to
receive criticisms about them. They're actually working well but
there's surely home for improvements.
Ah! And thank you all for making such a good base on which to work!
Gustavo.
Faking replicated servers and direct maps automatically
Gustavo Leite de Mendonca Chaves Thu, 4 Mar 1999 12:54:46 -0500
