3 # Convert Sun automount map format to amd format
5 # Package: am-utils-6.x
6 # Author: Mike Walker <mike@tab00.larc.nasa.gov>
7 # Erez Zadok <ezk@cs.columbia.edu>
9 # This program expects maps with the format
11 # dir [ -options ] machine:/path [ # optional comment ]
14 # and generates an equivalent amd map as follows:
16 # # generated by automountamd on Fri May 21 9:16:56 1993
19 # type:=nfs;opts:=rw,grpid,nosuid,utimeout=600
22 # hostd==machine.larc.nasa.gov;type:=link;fs:=/path || \
23 # domain==larc.nasa.gov;rhost:=machine;rfs:=/path || \
24 # rhost:=machine.larc.nasa.gov;rfs:=/path
27 # You should set the DOMAIN and DEFAULT variables to your preferences.
29 # Id: automount2amd.in,v 1.2 2002/01/15 18:25:25 ezk Exp
34 # amd domain name (doesn't have to be the DNS domain; isn't overloading great!)
35 # Should be what you will pass to amd via the -d command-line switch, if any.
38 # amd default settings; consult the docs for what you can/should do here.
39 # Note, in particular, that if your disk mount points follow a common scheme
40 # you can specify ``rfs:=/common/path/${key}'' and not have to insert that
41 # line (twice) in every entry below!
42 $DEFAULTS='type:=nfs;opts:=rw,grpid,nosuid,utimeout=600';
45 # print comment header and default string
46 printf "# generated by automount2amd on %s\n", &ctime(time);
47 printf "/defaults \\\n %s\n\n", $DEFAULTS;
51 if (m,^(\w\S*)(\s+\-\w\S*\s+|\s+)(\w[^:]*):(\/\S*)\s*(.*),) {
52 ($dir, $options, $machine, $path, $rest) = ($1, $2, $3, $4, $5);
53 print "#$rest\n" if ($rest =~ m/\w/);
55 if ($options =~ m/-/) {
58 printf( " -addopts:=$options \\\n");
60 if (defined($DOMAIN) && $DOMAIN ne "") {
61 printf(" hostd==%s.%s;type:=link;fs:=%s || \\\n",
62 $machine, $DOMAIN, $path);
63 printf(" domain==%s;rhost:=%s;rfs:=%s || \\\n",
64 $DOMAIN, $machine, $path);
65 printf " rhost:=%s.%s;rfs:=%s\n\n", $machine, $DOMAIN, $path;
67 printf(" host==%s;type:=link;fs:=%s \\\n",
69 printf " rhost:=%s;rfs:=%s\n\n", $machine, $path;