freebsd-dev/contrib/amd/scripts/amd2sun.in
David E. O'Brien ad8bcc147f Virgin import of AMD (am-utils) v6.1.5
Sponsored by: Juniper Networks
2007-12-05 15:48:03 +00:00

52 lines
996 B
Plaintext
Executable File

#!@PERL@
# convert amd maps to Sun automount maps
# usage: amd2sun file
#
# Package: am-utils-6.x
# Author: "Mark D. Baushke" <mdb@cisco.com>
print "# file created by amd2sun
#
# DO NOT EDIT THIS FILE AT ALL
# It is automatically generated from the amd mount map - edit that instead
#
";
while (<>) {
print, next if /^#/;
chop;
$line = $_;
while ($line =~ /\\$/) {
chop $line;
$line2 = <>;
$line2 =~ s/^\s*//;
$line .= $line2;
chop $line;
}
next unless $line =~ /^([^\s]+)\s+(.*)$/;
$fs = $1; $rest=$2;
if ($fs =~ /^\/defaults/) {
($defopts = $rest) =~ s/^.*[\s;]opts:=([^;\s]+)[;\s]*.*$/\1/;
next;
}
$opts=$defopts;
if ($rest =~ /opts:=([^;\s]+)[;\s]/) {
$opts = $1;
}
$opts =~ s/,ping=[-\d]+//g;
($rhost = $rest) =~ s/^.*[\s;]rhost:=([^;\s]+)[;\s]*.*$/\1/;
($rfs = $rest) =~ s/^.*[\s;]rfs:=([^;\s]+)[;\s]*.*$/\1/;
if ($rest =~ /sublink:=([^;\s]+)[;\s]/ ) {
$rfs .= "/$1";
}
print "$fs -$opts $rhost:$rfs\n";
}