#!/usr/local/bin/perl chdir ("/texlive/bin"); &builddirlist; for (@dirnames) { print "Remove links from $_ directory\n"; chdir($_); &buildlinklist; for (@linknames) { print " Delete link $_\n"; unlink $_; } chdir(".."); } chdir ("share"); &buildfilelist; &buildlinklist; for (@filenames) { print "FILE $_\n"; $File=$_; for (@dirnames) { print " cp -f $File ../$_/$File\n"; if (/.*ultrix.*/) { system "sed 's/bin\\/sh/bin\\/sh5/' < $File > ../$_/$File"; } else { system("cp -f $File ../$_/$File"); } } } for (@linknames) { print "LINK $_\n"; $File=$_; $real = readlink($File); for (@dirnames) { print " process link of $File to $_: ln -s $real $File\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(!/amiga/,grep(!/^\.\.?$/,grep(-d,readdir(DIR))))); closedir(DIR); }