4 $nonono = 1 if $ARGV[0] eq '-n';
5 $versiononly = 1 if $ARGV[0] eq '-v';
10 @manpages = ('perl.man', 'h2ph.man');
12 # Read in the config file.
14 open(CONFIG, "config.sh") || die "You haven't run Configure yet!\n";
16 if (s/^(\w+=)/\$$1/) {
17 $accum =~ s/'undef'/undef/g;
24 # Do some quick sanity checks.
26 if ($d_dosuid && $>) { die "You must run as root to install suidperl\n"; }
28 $bin || die "No bin directory in config.sh\n";
29 -d $bin || die "$bin is not a directory\n";
30 -w $bin || die "$bin is not writable by you\n";
32 -x 'perl' || die "perl isn't executable!\n";
33 -x 'taintperl' || die "taintperl isn't executable!\n";
34 -x 'suidperl' || die "suidperl isn't executable!\n" if $d_dosuid;
36 -x 't/TEST' || die "You've never run 'make test'!\n";
38 # First we install the version-numbered executables.
40 $ver = sprintf("%5.3f", $]);
42 &unlink("$bin/perl$ver");
43 &cmd("cp perl $bin/perl$ver");
45 &unlink("$bin/tperl$ver");
46 &cmd("cp taintperl $bin/tperl$ver");
47 &chmod(0755, "$bin/tperl$ver"); # force non-suid for security
49 &unlink("$bin/sperl$ver");
51 &cmd("cp suidperl $bin/sperl$ver");
52 &chmod(04711, "$bin/sperl$ver");
55 exit 0 if $versiononly;
57 # Make links to ordinary names if bin directory isn't current directory.
59 ($bdev,$bino) = stat($bin);
60 ($ddev,$dino) = stat('.');
62 if ($bdev != $ddev || $bino != $dino) {
63 &unlink("$bin/perl", "$bin/taintperl", "$bin/suidperl");
64 &link("$bin/perl$ver", "$bin/perl");
65 &link("$bin/tperl$ver", "$bin/taintperl");
66 &link("$bin/sperl$ver", "$bin/suidperl") if $d_dosuid;
69 # Make some enemies in the name of standardization. :-)
71 ($udev,$uino) = stat("/usr/bin");
73 if (($udev != $ddev || $uino != $dino) && !$nonono) {
74 unlink "/usr/bin/perl";
75 eval 'symlink("$bin/perl", "/usr/bin/perl")' ||
76 eval 'link("$bin/perl", "/usr/bin/perl")' ||
77 &cmd("cp $bin/perl /usr/bin");
86 &cmd("cp $_ $scriptdir");
89 # Install library files.
93 ($pdev,$pino) = stat($privlib);
95 if ($pdev != $ddev || $pino != $dino) {
96 &cmd("cd lib && cp *.pl $privlib");
103 ($mdev,$mino) = stat($mansrc);
104 if ($mdev != $ddev || $mino != $dino) {
106 ($new = $_) =~ s/man$/$manext/;
107 &cmd("cp $_ $mansrc/$new");
111 print STDERR " Installation complete\n";
115 ###############################################################################
120 foreach $name (@names) {
121 next unless -e $name;
122 print STDERR " unlink $name\n";
123 unlink($name) || warn "Couldn't unlink $name: $!\n" unless $nonono;
129 print STDERR " $cmd\n";
132 warn "Command failed!!!\n" if $?;
137 local($from,$to) = @_;
139 print STDERR " ln $from $to\n";
140 link($from,$to) || warn "Couldn't link $from to $to: $!\n" unless $nonono;
144 local($mode,$name) = @_;
146 printf STDERR " chmod %o %s\n", $mode, $name;
147 chmod($mode,$name) || warn "Couldn't chmod $mode $name: $!\n"
154 local($shortdir) = $dir;
156 $shortdir =~ s#(.*)/.*#$1#;
159 print STDERR " mkdir $dir\n";
160 mkdir($dir, 0777) || warn "Couldn't create $dir: $!\n" unless $nonono;