Date: Mon, 04 Jan 1999 11:22:55 -0500 From: Rajesh Vaidheeswarran <rv@fore.com> To: Alexander Indenbaum <baum@actcom.co.il> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Sun automount -> Amd (4.4BSD Automounter) map convertor Message-ID: <199901041622.LAA00395@agastya.eng.fore.com> In-Reply-To: Message from Alexander Indenbaum <baum@actcom.co.il> of "Sun, 03 Jan 1999 16:56:29 %2B0200." <Pine.SUN.3.96-heb-2.07.990103165553.28279B-100000@actcom.co.il>
next in thread | previous in thread | raw e-mail | index | archive | help
-- using MH template repl.format --
In a previous message, Alexander Indenbaum writes:
> Hi!
>
> I'm looking for script which will convert Sun automount map into
> Amd (4.4BSD Automounter) map to be used in NIS Makefile.
>
> Does such tool exist?
Yes.
rv
#!/usr/bin/env perl
#
# Convert Sun automount map format to amd format
#
# This program expects maps with the format
#
# dir [ -options ] machine:/path [ # optional comment ]
# ...
#
# and generates an equivalent amd map as follows:
#
# # generated by sun2amd on Fri May 21 9:16:56 1993
#
# /defaults \
# type:=nfs;opts:=rw,grpid,nosuid,utimeout=600
#
# ## optional comment
# ## options: -options
# dir \
# hostd==machine.larc.nasa.gov;type:=link;fs:=/path || \
# domain==larc.nasa.gov;rhost:=machine;rfs:=/path || \
# rhost:=machine.larc.nasa.gov;rfs:=/path
# ...
#
# You should set the DOMAIN and DEFAULT variables to your preferences.
#
# $Id: sun2amd,v 1.4 1993/05/24 21:10:05 mike Exp mike $
#
require "ctime.pl";
# amd domain name (doesn't have to be the DNS domain; isn't overloading great!)
# Should be what you will pass to amd via the -d command-line switch.
$DOMAIN='fore.com';
# amd default settings; consult the docs for what you can/should do here.
# Note, in particular, that if your disk mount points follow a common scheme
# you can specify ``rfs:=/common/path/${key}'' and not have to insert that
# line (twice) in every entry below!
$DEFAULTS='type:=nfs;opts:=rw,grpid,nosuid,utimeout=600';
# print comment header and default string
printf "# generated by sun2amd on %s\n", &ctime(time);
printf "/defaults \\\n %s\n\n", $DEFAULTS;
# loop through map
$has_options = 0;
while (<>) {
if (m,^(\w\S*)(\s+\-\w\S*\s+|\s+)(\w[^:]*):(\/\S*)\s*(.*),) {
($dir, $options, $machine, $path, $rest) = ($1, $2, $3, $4, $5);
print "#$rest\n" if ($rest =~ m/\w/);
if ($options =~ m/-/) {
$options =~ s/ //g;
print "## options: $options\n";
$has_options++;
}
print "$dir \\\n";
printf " hostd==%s.%s;type:=link;fs:=%s || \\\n",
$machine, $DOMAIN, $path;
printf " domain==%s;rhost:=%s;rfs:=%s || \\\n",
$DOMAIN, $machine, $path;
printf " rhost:=%s.%s;rfs:=%s\n\n", $machine, $DOMAIN, $path;
}
}
if ($has_options) {
print STDERR <<"OPTION_NOTE";
NOTE: $has_options entries had custom options which you will need to correct by
hand. Search for the string \"## options:\" in the new map to find them.
OPTION_NOTE
}
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901041622.LAA00395>
