#!/usr/local/bin/perl chdir (".."); &builddirlist; chdir ("share"); &buildfilelist; &buildlinklist; for (@filenames) { print "FILE $_\n"; $File=$_; for (@dirnames) { print " copy $File to $_\n"; if (/.*ultrix.*/) { system "sed 's/bin\\/sh/bin\\/sh5/' < $File > ../$_/$File"; } else { system("cp -f $File ../$_"); } } } for (@linknames) { print "LINK $_\n"; $File=$_; $real = readlink($File); for (@dirnames) { print " process link of $File to $_\n"; system("cd ../$_; rm $File; ln -s $real $File"); } } ; # rebuild list of files sub buildfilelist { opendir(DIR,'.') || die ("ERROR: cannot open directory"); @filenames =grep(!/^\.\.?$/,grep(!/share2bin/,grep(!-l,readdir(DIR)))); closedir(DIR); } # rebuild list of files sub buildlinklist { opendir(DIR,'.') || die ("ERROR: cannot open directory"); @linknames =grep(-l,readdir(DIR)); closedir(DIR); } # rebuild list of directories sub builddirlist { opendir(DIR,'.') || die ("ERROR: cannot open directory"); @dirnames =grep(/.*-/,grep(!/share/,grep(!/^\.\.?$/,grep(-d,readdir(DIR))))); closedir(DIR); }