|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /usr/sbin/ |
Upload File : |
#!/usr/bin/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";
}