Commit | Line | Data |
eacfb5f1 |
1 | *** installperl.orig Mon Nov 20 09:55:08 1995 |
2 | --- installperl Wed Nov 22 02:29:34 1995 |
4633a7c4 |
3 | *************** |
eacfb5f1 |
4 | *** 4,9 **** |
5 | --- 4,10 ---- |
6 | use Config; |
7 | |
8 | $mainperldir = "/usr/bin"; |
9 | + $exe_ext = $Config{exe_ext}; |
10 | |
11 | while (@ARGV) { |
12 | $nonono = 1 if $ARGV[0] eq '-n'; |
4633a7c4 |
13 | *************** |
eacfb5f1 |
14 | *** 61,68 **** |
4633a7c4 |
15 | -w $installbin || die "$installbin is not writable by you\n" |
16 | unless $installbin =~ m#^/afs/# || $nonono; |
17 | |
18 | ! -x 'perl' || die "perl isn't executable!\n"; |
19 | ! -x 'suidperl' || die "suidperl isn't executable!\n" if $d_dosuid; |
20 | |
21 | -x 't/TEST' || warn "WARNING: You've never run 'make test'!!!", |
22 | " (Installing anyway.)\n"; |
eacfb5f1 |
23 | --- 62,69 ---- |
4633a7c4 |
24 | -w $installbin || die "$installbin is not writable by you\n" |
25 | unless $installbin =~ m#^/afs/# || $nonono; |
26 | |
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; |
29 | |
30 | -x 't/TEST' || warn "WARNING: You've never run 'make test'!!!", |
31 | " (Installing anyway.)\n"; |
32 | *************** |
eacfb5f1 |
33 | *** 80,92 **** |
4633a7c4 |
34 | |
35 | # First we install the version-numbered executables. |
36 | |
37 | ! &safe_unlink("$installbin/perl$ver"); |
38 | ! &cmd("cp perl $installbin/perl$ver"); |
39 | |
40 | ! &safe_unlink("$installbin/sperl$ver"); |
41 | if ($d_dosuid) { |
42 | ! &cmd("cp suidperl $installbin/sperl$ver"); |
43 | ! &chmod(04711, "$installbin/sperl$ver"); |
44 | } |
45 | |
46 | exit 0 if $versiononly; |
eacfb5f1 |
47 | --- 81,93 ---- |
4633a7c4 |
48 | |
49 | # First we install the version-numbered executables. |
50 | |
51 | ! &safe_unlink("$installbin/perl$ver$exe_ext"); |
52 | ! &cmd("cp perl$exe_ext $installbin/perl$ver$exe_ext"); |
53 | |
54 | ! &safe_unlink("$installbin/sperl$ver$exe_ext"); |
55 | if ($d_dosuid) { |
56 | ! &cmd("cp suidperl$exe_ext $installbin/sperl$ver$exe_ext"); |
57 | ! &chmod(04711, "$installbin/sperl$ver$exe_ext"); |
58 | } |
59 | |
60 | exit 0 if $versiononly; |
61 | *************** |
eacfb5f1 |
62 | *** 94,108 **** |
4633a7c4 |
63 | # Make links to ordinary names if installbin directory isn't current directory. |
64 | |
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; |
69 | } |
70 | |
71 | if (! &samepath($installbin, 'x2p')) { |
72 | ! &safe_unlink("$installbin/a2p"); |
73 | ! &cmd("cp x2p/a2p $installbin/a2p"); |
74 | ! &chmod(0755, "$installbin/a2p"); |
75 | } |
76 | |
77 | # Install scripts. |
eacfb5f1 |
78 | --- 95,110 ---- |
4633a7c4 |
79 | # Make links to ordinary names if installbin directory isn't current directory. |
80 | |
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") |
85 | ! if $d_dosuid; |
86 | } |
87 | |
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"); |
92 | } |
93 | |
94 | # Install scripts. |
95 | *************** |
eacfb5f1 |
96 | *** 188,201 **** |
4633a7c4 |
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")); |
108 | } |
109 | if ((! $mainperl_is_instperl) && |
110 | (&yn("Many scripts expect perl to be installed as " . |
eacfb5f1 |
111 | --- 190,203 ---- |
4633a7c4 |
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")); |
123 | } |
124 | if ((! $mainperl_is_instperl) && |
125 | (&yn("Many scripts expect perl to be installed as " . |
126 | *************** |
eacfb5f1 |
127 | *** 203,212 **** |
4633a7c4 |
128 | "Do you wish to have $mainperldir/perl be the same as\n" . |
129 | "$binexp/perl? [y] "))) |
130 | { |
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; |
136 | } |
137 | } |
eacfb5f1 |
138 | --- 205,214 ---- |
4633a7c4 |
139 | "Do you wish to have $mainperldir/perl be the same as\n" . |
140 | "$binexp/perl? [y] "))) |
141 | { |
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; |
147 | } |
148 | } |
149 | *************** |
eacfb5f1 |
150 | *** 217,223 **** |
4633a7c4 |
151 | # Also skip $mainperl if the user opted to have it be a link to the |
152 | # installed perl. |
153 | |
154 | ! @path = split(/:/, $ENV{"PATH"}); |
155 | @otherperls = (); |
156 | for (@path) { |
157 | next unless m,^/,; |
eacfb5f1 |
158 | --- 219,227 ---- |
4633a7c4 |
159 | # Also skip $mainperl if the user opted to have it be a link to the |
160 | # installed perl. |
161 | |
162 | ! $dirsep = ($osname =~ m:^os/?2$:i) ? ';' : ':' ; |
163 | ! ($path = $ENV{"PATH"}) =~ s:\\:/:g ; |
164 | ! @path = split(/$dirsep/, $path); |
165 | @otherperls = (); |
166 | for (@path) { |
167 | next unless m,^/,; |
168 | *************** |
eacfb5f1 |
169 | *** 225,231 **** |
4633a7c4 |
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"); |
174 | } |
175 | if (@otherperls) { |
176 | print STDERR "\nWarning: perl appears in your path in the following " . |
eacfb5f1 |
177 | --- 229,236 ---- |
4633a7c4 |
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"); |
183 | } |
184 | if (@otherperls) { |
185 | print STDERR "\nWarning: perl appears in your path in the following " . |
186 | *************** |
eacfb5f1 |
187 | *** 258,263 **** |
188 | --- 263,269 ---- |
4633a7c4 |
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; |
194 | } |
195 | } |
196 | *************** |
eacfb5f1 |
197 | *** 269,274 **** |
198 | --- 275,281 ---- |
4633a7c4 |
199 | next unless -e $name; |
200 | print STDERR " unlink $name\n"; |
201 | next if $nonono; |
202 | + chmod 0777, $name if $osname =~ m:^os/?2$:i ; |
203 | next if unlink($name); |
204 | warn "Couldn't unlink $name: $!\n"; |
205 | if ($! =~ /busy/i) { |
206 | *************** |
eacfb5f1 |
207 | *** 304,310 **** |
4633a7c4 |
208 | local($from,$to) = @_; |
209 | |
210 | print STDERR " ln $from $to\n"; |
211 | ! link($from,$to) || warn "Couldn't link $from to $to: $!\n" unless $nonono; |
212 | } |
213 | |
214 | sub chmod { |
eacfb5f1 |
215 | --- 311,323 ---- |
4633a7c4 |
216 | local($from,$to) = @_; |
217 | |
218 | print STDERR " ln $from $to\n"; |
219 | ! eval { |
220 | ! link($from,$to) || warn "Couldn't link $from to $to: $!\n" unless $nonono; |
221 | ! }; |
222 | ! if ($@) { |
223 | ! system( $cp, $from, $to ) |
224 | ! && warn "Couldn't copy $from to $to: $!\n" unless $nonono; |
225 | ! } |
226 | } |
227 | |
228 | sub chmod { |