Home | History | Annotate | Line # | Download | only in scripts
      1 #!@PERL@
      2 # convert amd maps to Sun automount maps
      3 # usage: amd2sun file
      4 #
      5 # Package:	am-utils-6.x
      6 # Author:	"Mark D. Baushke" <mdb (at] cisco.com>
      7 
      8 print "# file created by amd2sun
      9 #
     10 # DO NOT EDIT THIS FILE AT ALL
     11 # It is automatically generated from the amd mount map - edit that instead
     12 #
     13 ";
     14 while (<>) {
     15   print, next if /^#/;
     16   chop;
     17   $line = $_;
     18   while ($line =~ /\\$/) {
     19     chop $line;
     20     $line2 = <>;
     21     $line2 =~ s/^\s*//;
     22     $line .= $line2;
     23     chop $line;
     24   }
     25 
     26   next unless $line =~ /^([^\s]+)\s+(.*)$/;
     27 
     28   $fs = $1; $rest=$2;
     29 
     30   if ($fs =~ /^\/defaults/) {
     31     ($defopts = $rest) =~ s/^.*[\s;]opts:=([^;\s]+)[;\s]*.*$/\1/;
     32     next;
     33   }
     34 
     35   $opts=$defopts;
     36 
     37   if ($rest =~ /opts:=([^;\s]+)[;\s]/) {
     38     $opts = $1;
     39   }
     40 
     41   $opts =~ s/,ping=[-\d]+//g;
     42 
     43   ($rhost = $rest) =~ s/^.*[\s;]rhost:=([^;\s]+)[;\s]*.*$/\1/;
     44   ($rfs   = $rest) =~ s/^.*[\s;]rfs:=([^;\s]+)[;\s]*.*$/\1/;
     45 
     46   if ($rest =~ /sublink:=([^;\s]+)[;\s]/ ) {
     47     $rfs .= "/$1";
     48   }
     49 
     50   print "$fs	-$opts	$rhost:$rfs\n";
     51 }
     52