summaryrefslogtreecommitdiff
path: root/Build/cdbuild/share2bin
blob: 9d35f4bf3f5175c06017930e2a0d7b511f390c28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/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);
}