Subject: Re: amd
To: None <earle@isolar.Tujunga.CA.US>
From: Matt Ragan <matt@ibmoto.com>
List: current-users
Date: 01/21/1996 10:35:14
Greg Earle wrote:
>I suspect I'm not the only one in this boat.  I have 2 NetBSD machines, on
>different subnets, living inside two different NIS/automount worlds.  Every
>other machine in those worlds uses "automount" (even the SGIs and the HP).
>
>So we use "automount" with a SunOS machine serving NIS auto.* maps.  Since
>changing all of them to use "amd" is *not* an option, I would really like
>to hear from somebody who's cobbled together an "amd" setup to live in an
>all-automounter world, using NIS automount maps.

This is the setup I use:

In your NIS Makefile, put this in to build the amd.master map from the 
auto.master map:

amd.master: amd.master.time

amd.master.time:  $(DIR)/auto.master
    -@if [ -f $(DIR)/auto.master ]; then \
        sed -e "/^#/d" -e s/#.*$$// -e s/auto/amd/ $(DIR)/auto.master \
        | awk '{ printf("%s %s\n", $$1, $$2 ) }' \
        | $(MAKEDBM) - $(YPDBDIR)/amd.master; \
        touch amd.master.time; \
        echo "updated amd.master"; \
        if [ ! $(NOPUSH) ]; then \
            $(YPPUSH) amd.master; \
            echo "pushed amd.master"; \
        else \
        : ; \
        fi \
    else \
        echo "couldn't find $(DIR)/auto.master"; \
    fi

Then repeat this for whatever other automount maps you have:
amd.home: amd.home.time

amd.home.time:  $(DIR)/auto.home
    -@if [ -f $(DIR)/auto.home ]; then \
        sed -e "/^#/d" -e s/#.*$$// $(DIR)/auto.home \
        | $(AUTO2AMD) | $(MAKEDBM) - $(YPDBDIR)/amd.home; \
        touch amd.home.time; \
        echo "updated amd.home"; \
        if [ ! $(NOPUSH) ]; then \
            $(YPPUSH) amd.home; \
            echo "pushed amd.home"; \
        else \
        : ; \
        fi \
    else \
        echo "couldn't find $(DIR)/auto.home"; \
    fi

where AUTO2AMD is defined at the top of the makefile to point to wheverever
this perl script lives:

#!/usr/local/bin/perl

while (<>) {
        chop;
        next if /^#/;
        ($key, $middle, $directory) = /(^\S+)\s+([^:]+):(.*)/;
        if (!(($options, $host) = ($middle =~ /(^\S+)\s+(\S+)/))) {
                $host = $middle;
                $options = "";
        }
        $host =~ s/\$NET/\${cluster}/;
        $host =~ s/&/\${key}/;
        if (!(($dir, $subdir) = ($directory =~ /(^\S+):(\S+)/))) {
                $dir = $directory;
                $subdir = "";
        }
        print "$key             type:=nfs;rhost:=$host;rfs:=$dir";
        print ";sublink:=$subdir" if $subdir !~ /^$/;
        print ";opts=resvport,intr";
        print "\n";
}

Note that you may be able to delete the 'resvport' option, but our servers 
won't work without it.  You will also probably want to delete (or modify)
the:

        $host =~ s/\$NET/\${cluster}/;

line, since we define the NET variable on our automount command line to be the
subnet that the host is one, and we have DNS CNAMES to point 'server-$NET'
to the correct one of the twelve interfaces on each of our Auspexes.  Under
AMD, this get changed its $cluster variable, and the AMD clients are
started with the -c options set to the subnet value, which accomplishes
the same thing.

-- 
--------------------------------------------------------------------------
Matt Ragan  (matt@ibmoto.com)  Motorola/IBM Somerset PowerPC Design Center
Network Administrator          Systems/Network Engineering  (512) 795-7298
9737 Great Hills Trail         Austin, Tx  78759        FAX (512) 795-7519
--------------------------------------------------------------------------