mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-28 11:57:28 +00:00
ad8bcc147f
Sponsored by: Juniper Networks
73 lines
2.2 KiB
Plaintext
Executable File
73 lines
2.2 KiB
Plaintext
Executable File
#!@PERL@ -w
|
|
#
|
|
# Convert Sun automount map format to amd format
|
|
#
|
|
# Package: am-utils-6.x
|
|
# Author: Mike Walker <mike@tab00.larc.nasa.gov>
|
|
# Erez Zadok <ezk@cs.columbia.edu>
|
|
#
|
|
# This program expects maps with the format
|
|
#
|
|
# dir [ -options ] machine:/path [ # optional comment ]
|
|
# ...
|
|
#
|
|
# and generates an equivalent amd map as follows:
|
|
#
|
|
# # generated by automountamd on Fri May 21 9:16:56 1993
|
|
#
|
|
# /defaults \
|
|
# type:=nfs;opts:=rw,grpid,nosuid,utimeout=600
|
|
#
|
|
# 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: automount2amd.in,v 1.2 2002/01/15 18:25:25 ezk Exp $
|
|
#
|
|
|
|
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, if any.
|
|
$DOMAIN='';
|
|
|
|
# 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 automount2amd on %s\n", &ctime(time);
|
|
printf "/defaults \\\n %s\n\n", $DEFAULTS;
|
|
|
|
# loop through map
|
|
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/);
|
|
print "$dir \\\n";
|
|
if ($options =~ m/-/) {
|
|
$options =~ s/\s//g;
|
|
$options =~ s/^-//g;
|
|
printf( " -addopts:=$options \\\n");
|
|
}
|
|
if (defined($DOMAIN) && $DOMAIN ne "") {
|
|
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;
|
|
} else {
|
|
printf(" host==%s;type:=link;fs:=%s \\\n",
|
|
$machine, $path);
|
|
printf " rhost:=%s;rfs:=%s\n\n", $machine, $path;
|
|
}
|
|
}
|
|
}
|