1 *** installperl.orig Mon Nov 20 09:55:08 1995
2 --- installperl Wed Nov 22 02:29:34 1995
8 $mainperldir = "/usr/bin";
9 + $exe_ext = $Config{exe_ext};
12 $nonono = 1 if $ARGV[0] eq '-n';
15 -w $installbin || die "$installbin is not writable by you\n"
16 unless $installbin =~ m#^/afs/# || $nonono;
18 ! -x 'perl' || die "perl isn't executable!\n";
19 ! -x 'suidperl' || die "suidperl isn't executable!\n" if $d_dosuid;
21 -x 't/TEST' || warn "WARNING: You've never run 'make test'!!!",
22 " (Installing anyway.)\n";
24 -w $installbin || die "$installbin is not writable by you\n"
25 unless $installbin =~ m#^/afs/# || $nonono;
27 ! -x 'perl' . $exe_ext || die "perl isn't executable!\n";
28 ! -x 'suidperl' . $exe_ext|| die "suidperl isn't executable!\n" if $d_dosuid;
30 -x 't/TEST' || warn "WARNING: You've never run 'make test'!!!",
31 " (Installing anyway.)\n";
35 # First we install the version-numbered executables.
37 ! &safe_unlink("$installbin/perl$ver");
38 ! &cmd("cp perl $installbin/perl$ver");
40 ! &safe_unlink("$installbin/sperl$ver");
42 ! &cmd("cp suidperl $installbin/sperl$ver");
43 ! &chmod(04711, "$installbin/sperl$ver");
46 exit 0 if $versiononly;
49 # First we install the version-numbered executables.
51 ! &safe_unlink("$installbin/perl$ver$exe_ext");
52 ! &cmd("cp perl$exe_ext $installbin/perl$ver$exe_ext");
54 ! &safe_unlink("$installbin/sperl$ver$exe_ext");
56 ! &cmd("cp suidperl$exe_ext $installbin/sperl$ver$exe_ext");
57 ! &chmod(04711, "$installbin/sperl$ver$exe_ext");
60 exit 0 if $versiononly;
63 # Make links to ordinary names if installbin directory isn't current directory.
65 if (! &samepath($installbin, '.')) {
66 ! &safe_unlink("$installbin/perl", "$installbin/suidperl");
67 ! &link("$installbin/perl$ver", "$installbin/perl");
68 ! &link("$installbin/sperl$ver", "$installbin/suidperl") if $d_dosuid;
71 if (! &samepath($installbin, 'x2p')) {
72 ! &safe_unlink("$installbin/a2p");
73 ! &cmd("cp x2p/a2p $installbin/a2p");
74 ! &chmod(0755, "$installbin/a2p");
79 # Make links to ordinary names if installbin directory isn't current directory.
81 if (! &samepath($installbin, '.')) {
82 ! &safe_unlink("$installbin/perl$exe_ext", "$installbin/suidperl$exe_ext");
83 ! &link("$installbin/perl$ver$exe_ext", "$installbin/perl$exe_ext");
84 ! &link("$installbin/sperl$ver$exe_ext", "$installbin/suidperl$exe_ext")
88 if (! &samepath($installbin, 'x2p')) {
89 ! &safe_unlink("$installbin/a2p$exe_ext");
90 ! &cmd("cp x2p/a2p$exe_ext $installbin/a2p$exe_ext");
91 ! &chmod(0755, "$installbin/a2p$exe_ext");
97 if (-w $mainperldir && ! &samepath($mainperldir, $installbin) && !$nonono) {
98 # First make sure $mainperldir/perl is not already the same as
99 # the perl we just installed
100 ! if (-x "$mainperldir/perl") {
101 # Try to be clever about mainperl being a symbolic link
102 # to binexp/perl if binexp and installbin are different.
103 $mainperl_is_instperl =
104 ! &samepath("$mainperldir/perl", "$installbin/perl") ||
105 (($binexp ne $installbin) &&
106 ! (-l "$mainperldir/perl") &&
107 ! ((readlink "$mainperldir/perl") eq "$binexp/perl"));
109 if ((! $mainperl_is_instperl) &&
110 (&yn("Many scripts expect perl to be installed as " .
112 if (-w $mainperldir && ! &samepath($mainperldir, $installbin) && !$nonono) {
113 # First make sure $mainperldir/perl is not already the same as
114 # the perl we just installed
115 ! if (-x "$mainperldir/perl$exe_ext") {
116 # Try to be clever about mainperl being a symbolic link
117 # to binexp/perl if binexp and installbin are different.
118 $mainperl_is_instperl =
119 ! &samepath("$mainperldir/perl$exe_ext", "$installbin/perl$exe_ext") ||
120 (($binexp ne $installbin) &&
121 ! (-l "$mainperldir/perl$exe_ext") &&
122 ! ((readlink "$mainperldir/perl$exe_ext") eq "$binexp/perl$exe_ext"));
124 if ((! $mainperl_is_instperl) &&
125 (&yn("Many scripts expect perl to be installed as " .
128 "Do you wish to have $mainperldir/perl be the same as\n" .
129 "$binexp/perl? [y] ")))
131 ! unlink("$mainperldir/perl");
132 ! eval 'link("$installbin/perl", "$mainperldir/perl")' ||
133 ! eval 'symlink("$binexp/perl", "$mainperldir/perl")' ||
134 ! &cmd("cp $installbin/perl $mainperldir");
135 $mainperl_is_instperl = 1;
139 "Do you wish to have $mainperldir/perl be the same as\n" .
140 "$binexp/perl? [y] ")))
142 ! unlink("$mainperldir/perl$exe_ext");
143 ! eval 'link("$installbin/perl$exe_ext", "$mainperldir/perl$exe_ext")' ||
144 ! eval 'symlink("$binexp/perl$exe_ext", "$mainperldir/perl$exe_ext")' ||
145 ! &cmd("cp $installbin/perl$exe_ext $mainperldir$exe_ext");
146 $mainperl_is_instperl = 1;
151 # Also skip $mainperl if the user opted to have it be a link to the
154 ! @path = split(/:/, $ENV{"PATH"});
159 # Also skip $mainperl if the user opted to have it be a link to the
162 ! $dirsep = ($osname =~ m:^os/?2$:i) ? ';' : ':' ;
163 ! ($path = $ENV{"PATH"}) =~ s:\\:/:g ;
164 ! @path = split(/$dirsep/, $path);
170 # Use &samepath here because some systems have other dirs linked
171 # to $mainperldir (like SunOS)
172 next if ($mainperl_is_instperl && &samepath($_, $mainperldir));
173 ! push(@otherperls, "$_/perl") if (-x "$_/perl" && ! -d "$_/perl");
176 print STDERR "\nWarning: perl appears in your path in the following " .
178 # Use &samepath here because some systems have other dirs linked
179 # to $mainperldir (like SunOS)
180 next if ($mainperl_is_instperl && &samepath($_, $mainperldir));
181 ! push(@otherperls, "$_/perl$exe_ext")
182 ! if (-x "$_/perl$exe_ext" && ! -d "$_/perl$exe_ext");
185 print STDERR "\nWarning: perl appears in your path in the following " .
189 foreach $name (@names) {
190 next unless -e $name;
191 print STDERR " unlink $name\n";
192 + chmod 0777, $name if $osname =~ m:^os/?2$:i ;
193 unlink($name) || warn "Couldn't unlink $name: $!\n" unless $nonono;
199 next unless -e $name;
200 print STDERR " unlink $name\n";
202 + chmod 0777, $name if $osname =~ m:^os/?2$:i ;
203 next if unlink($name);
204 warn "Couldn't unlink $name: $!\n";
208 local($from,$to) = @_;
210 print STDERR " ln $from $to\n";
211 ! link($from,$to) || warn "Couldn't link $from to $to: $!\n" unless $nonono;
216 local($from,$to) = @_;
218 print STDERR " ln $from $to\n";
220 ! link($from,$to) || warn "Couldn't link $from to $to: $!\n" unless $nonono;
223 ! system( $cp, $from, $to )
224 ! && warn "Couldn't copy $from to $to: $!\n" unless $nonono;