Subject: Re: amd and nis?
To: None <netbsd-help@netbsd.org>
From: Alexander Klink <aklink@igd.fhg.de>
List: netbsd-help
Date: 04/22/2005 11:13:20
--ikeVEW9yuYc//A+q
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Apr 22, 2005 at 10:35:58AM +0200, Alexander Klink wrote:
> P.S.: For the convenience of users who will be looking in the archive
> later, I've attached my script. Of course you'll need to change the
> global section and maybe the ypcat command (I only mount rw mountable
> exports and don't convert any options, so if you need something fancy,
> this might not work).
... here it is.

	Alex

--ikeVEW9yuYc//A+q
Content-Type: text/x-perl; charset=us-ascii
Content-Disposition: attachment; filename="auto.master2amd.conf.pl"

#!/usr/pkg/bin/perl
#
# uses the auto.master file to convert autofs (SunOS-style automounter
# maps) to amd.conf and corresponding amd maps
# 
# Alexander Klink, 22.04.2005
# public domain
open(CONF, ">/etc/amd.conf");
print CONF << "XEOF";
[ global ]
nis_domain = igd.fhg.de
search_path = /etc/amd
browsable_dirs = yes

XEOF

open(YP, "ypcat -k auto.master|grep rw|");
while (<YP>) {
	@data = split(/\s/);
	$mountpoint = $data[0];
	$mapname = $data[1];
	$outmap = $mapname;
	$outmap =~ s/^auto\./amd\./;
	`ypcat -k $mapname|/usr/local/bin/automount2amd > /etc/amd/$outmap`;
	print CONF "[ $mountpoint ]\nmap_name = $outmap\n\n";
}
close(YP);
close(CONF);


--ikeVEW9yuYc//A+q--