diff --git a/make-automaps/make-automaps b/make-automaps/make-automaps index 0a5a68d..22a4d8b 100755 --- a/make-automaps/make-automaps +++ b/make-automaps/make-automaps @@ -3,6 +3,8 @@ use strict; use warnings; +chomp (my $hostname=`uname -n`);$hostname=~s/\..*//; + sub convert_map { my ($amd,$auto,$parse_line)=@_; open IN,'<',$amd or die "$amd: $!\n"; @@ -65,6 +67,26 @@ sub parse_map_line { sub parse_subkey_line { my ($key,$host,$fs)=parse_map_line(@_); return $key ? "$key $host:$fs/$key" : undef; } sub parse_nosubkey_line { my ($key,$host,$fs)=parse_map_line(@_); return $key ? "$key $host:$fs" : undef; } +sub create_pkg_map { + my $cache; + + # ensure the map exists even if we fail out later + open my $out,'>','/etc/automount/auto.pkg' or die "/etc/automount/auto.pkg: $!\n"; + open my $in,'<','/etc/mxpkg' or return warn "/etc/mxpkg: $!\n"; + while (<$in>) { + s/#.*//; + /\S/ or next; + my ($pkg,$flags)=split ' '; + my $local="/amd/$hostname/P/pkg/$pkg"; + my $rw = $flags eq 'BUILD' ? ' -rw' : ''; + if (-d $local) { + print $out "$pkg$rw :$local\n"; + } else { + print $out "$pkg$rw ex:/amd/ex/X/X2008/package/pkg/$pkg\n"; + } + } +} + -d "/etc/automount" or mkdir("/etc/automount") or die "/etc/automount: $!\n"; convert_map('/etc/amd/amd.jbod','/etc/automount/auto.jbod',\&parse_jbod_line); @@ -76,8 +98,7 @@ convert_map('/etc/amd/amd.scratch','/etc/automount/auto.scratch',\&parse_subkey_ convert_map('/etc/amd/amd.src','/etc/automount/auto.src',\&parse_subkey_line); ######################################## /scratch - -chomp (my $hostname=`uname -n`);$hostname=~s/\..*//; + open O,'>>','/etc/automount/auto.scratch' or die "/etc/automount/auto.scratch: $!\n"; print O<<"eof"; local :/amd/$hostname/S/scratch @@ -148,7 +169,7 @@ for my $package (qw(kde qt xfce)) { ######################################## /pkg -open O,'>>','/etc/automount/auto.pkg' or die "/etc/automount/auto.pkg: $!\n"; +create_pkg_map(); ########################################