diff options
Diffstat (limited to 'contrib/amd/scripts/amd2sun.in')
-rwxr-xr-x | contrib/amd/scripts/amd2sun.in | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/contrib/amd/scripts/amd2sun.in b/contrib/amd/scripts/amd2sun.in new file mode 100755 index 000000000000..df69b09739cd --- /dev/null +++ b/contrib/amd/scripts/amd2sun.in @@ -0,0 +1,51 @@ +#!@PERL@ +# convert amd maps to Sun automount maps +# usage: amd2sun file +# +# Package: am-utils-6.0 +# 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"; +} |