3 $mainperldir = "/usr/bin";
6 $nonono = 1 if $ARGV[0] eq '-n';
7 $versiononly = 1 if $ARGV[0] eq '-v';
13 @scripts = ('cppstdin', 'h2ph', 'c2ph', 'pstruct', 'x2p/s2p', 'x2p/find2perl');
14 @manpages = ('perl.man', 'h2ph.man', 'x2p/a2p.man', 'x2p/s2p.man');
16 # Read in the config file.
18 open(CONFIG, "config.sh") || die "You haven't run Configure yet!\n";
20 if (s/^(\w+=)/\$$1/) {
21 $accum =~ s/'undef'/undef/g;
29 open(PERL_C, "perl.c");
37 $ver = sprintf("%5.3f", $major + $PATCHLEVEL / 1000);
38 $release = substr($ver,0,3);
39 $patchlevel = substr($ver,3,2);
41 # Do some quick sanity checks.
43 if ($d_dosuid && $>) { die "You must run as root to install suidperl\n"; }
45 $installbin || die "No installbin directory in config.sh\n";
46 -d $installbin || die "$installbin is not a directory\n";
47 -w $installbin || die "$installbin is not writable by you\n"
48 unless $installbin =~ m#^/afs/#;
50 -x 'perl' || die "perl isn't executable!\n";
51 -x 'taintperl' || die "taintperl isn't executable!\n";
52 -x 'suidperl' || die "suidperl isn't executable!\n" if $d_dosuid;
54 -x 't/TEST' || warn "WARNING: You've never run 'make test'!!!",
55 " (Installing anyway.)\n";
57 # First we install the version-numbered executables.
59 &unlink("$installbin/perl$ver");
60 &cmd("cp perl $installbin/perl$ver");
62 &unlink("$installbin/tperl$ver");
63 &cmd("cp taintperl $installbin/tperl$ver");
64 &chmod(0755, "$installbin/tperl$ver"); # force non-suid for security
66 &unlink("$installbin/sperl$ver");
68 &cmd("cp suidperl $installbin/sperl$ver");
69 &chmod(04711, "$installbin/sperl$ver");
72 exit 0 if $versiononly;
74 # Make links to ordinary names if installbin directory isn't current directory.
76 ($bdev,$bino) = stat($installbin);
77 ($ddev,$dino) = stat('.');
79 if ($bdev != $ddev || $bino != $dino) {
80 &unlink("$installbin/perl", "$installbin/taintperl", "$installbin/suidperl");
81 &link("$installbin/perl$ver", "$installbin/perl");
82 &link("$installbin/tperl$ver", "$installbin/taintperl");
83 &link("$installbin/sperl$ver", "$installbin/suidperl") if $d_dosuid;
86 ($bdev,$bino) = stat($installbin);
87 ($ddev,$dino) = stat('x2p');
89 if ($bdev != $ddev || $bino != $dino) {
90 &unlink("$installbin/a2p");
91 &cmd("cp x2p/a2p $installbin/a2p");
92 &chmod(0755, "$installbin/a2p");
95 # Make some enemies in the name of standardization. :-)
97 ($udev,$uino) = stat($mainperldir);
99 if (-w _ && ($udev != $bdev || $uino != $bino) && !$nonono) {
100 &unlink("$mainperldir/perl");
101 eval 'link("$installbin/perl", "$mainperldir/perl")' ||
102 eval 'symlink("$installbin/perl", "$mainperldir/perl")' ||
103 &cmd("cp $installbin/perl $mainperldir");
108 &makedir($installscr);
111 &cmd("cp $_ $installscr");
112 s#.*/##; &chmod(0755, "$installscr/$_");
120 ($mdev,$mino) = stat($mansrc);
121 if ($mdev != $ddev || $mino != $dino) {
123 ($new = $_) =~ s/man$/$manext/;
125 print STDERR " Installing $mansrc/$new\n";
127 open(MI,$_) || warn "Can't open $_: $!\n";
128 open(MO,">$mansrc/$new") || warn "Can't install $mansrc/$new: $!\n";
129 print MO ".ds RP Release $release Patchlevel $patchlevel\n";
139 # Install library files.
141 &makedir($installprivlib);
144 ($pdev,$pino) = stat($installprivlib);
145 ($ldev,$lino) = stat('.');
147 if ($pdev != $ldev || $pino != $lino) {
148 foreach $file (<*.pl>) {
149 system "cmp", "-s", $file, "$privlib/$file";
151 &unlink("$installprivlib/$file");
152 &cmd("cp $file $installprivlib");
156 chdir ".." || die "Can't cd back to source directory: $!\n";
159 warn "Can't cd to lib to install lib files: $!\n";
162 &chmod(0755, "usub/mus");
164 print STDERR " Installation complete\n";
168 ###############################################################################
173 foreach $name (@names) {
174 next unless -e $name;
175 print STDERR " unlink $name\n";
176 unlink($name) || warn "Couldn't unlink $name: $!\n" unless $nonono;
182 print STDERR " $cmd\n";
185 warn "Command failed!!!\n" if $?;
190 local($from,$to) = @_;
192 print STDERR " ln $from $to\n";
193 link($from,$to) || warn "Couldn't link $from to $to: $!\n" unless $nonono;
197 local($mode,$name) = @_;
199 printf STDERR " chmod %o %s\n", $mode, $name;
200 chmod($mode,$name) || warn "Couldn't chmod $mode $name: $!\n"
207 local($shortdir) = $dir;
209 $shortdir =~ s#(.*)/.*#$1#;
212 print STDERR " mkdir $dir\n";
213 mkdir($dir, 0777) || warn "Couldn't create $dir: $!\n" unless $nonono;