]>
Commit | Line | Data |
---|---|---|
340d3e48 AM |
1 | diff -urN epic4-1.2.9.org/bsdinstall epic4-1.2.9/bsdinstall |
2 | --- epic4-1.2.9.org/bsdinstall 2004-06-13 22:24:06.122067584 +0200 | |
3 | +++ epic4-1.2.9/bsdinstall 2004-06-13 22:24:14.876736672 +0200 | |
4 | @@ -1,90 +1,251 @@ | |
5 | -#! /bin/sh | |
6 | +#!/bin/sh | |
7 | # | |
8 | -# @(#)install.sh 4.5 (Berkeley) 10/12/83 | |
9 | +# install - install a program, script, or datafile | |
10 | +# This comes from X11R5 (mit/util/scripts/install.sh). | |
11 | # | |
12 | -cmd=/bin/mv | |
13 | -strip="" | |
14 | -chmod="/bin/chmod 755" | |
15 | -chown="" | |
16 | -chgrp="" | |
17 | -while true ; do | |
18 | - case $1 in | |
19 | - -s ) strip="/bin/strip" | |
20 | - shift | |
21 | - ;; | |
22 | - -c ) cmd="/bin/cp -p" | |
23 | - shift | |
24 | - ;; | |
25 | - -m ) chmod="/bin/chmod $2" | |
26 | - shift | |
27 | - shift | |
28 | - ;; | |
29 | - -o ) chown="/etc/chown -f $2" | |
30 | - shift | |
31 | - shift | |
32 | - ;; | |
33 | - -g ) chgrp="/bin/chgrp -f $2" | |
34 | - shift | |
35 | - shift | |
36 | - ;; | |
37 | - -d ) cmd="/bin/mkdir" | |
38 | - shift | |
39 | - ;; | |
40 | - * ) break | |
41 | - ;; | |
42 | - esac | |
43 | +# Copyright 1991 by the Massachusetts Institute of Technology | |
44 | +# | |
45 | +# Permission to use, copy, modify, distribute, and sell this software and its | |
46 | +# documentation for any purpose is hereby granted without fee, provided that | |
47 | +# the above copyright notice appear in all copies and that both that | |
48 | +# copyright notice and this permission notice appear in supporting | |
49 | +# documentation, and that the name of M.I.T. not be used in advertising or | |
50 | +# publicity pertaining to distribution of the software without specific, | |
51 | +# written prior permission. M.I.T. makes no representations about the | |
52 | +# suitability of this software for any purpose. It is provided "as is" | |
53 | +# without express or implied warranty. | |
54 | +# | |
55 | +# Calling this script install-sh is preferred over install.sh, to prevent | |
56 | +# `make' implicit rules from creating a file called install from it | |
57 | +# when there is no Makefile. | |
58 | +# | |
59 | +# This script is compatible with the BSD install script, but was written | |
60 | +# from scratch. It can only install one file at a time, a restriction | |
61 | +# shared with many OS's install programs. | |
62 | + | |
63 | + | |
64 | +# set DOITPROG to echo to test this script | |
65 | + | |
66 | +# Don't use :- since 4.3BSD and earlier shells don't like it. | |
67 | +doit="${DOITPROG-}" | |
68 | + | |
69 | + | |
70 | +# put in absolute paths if you don't have them in your path; or use env. vars. | |
71 | + | |
72 | +mvprog="${MVPROG-mv}" | |
73 | +cpprog="${CPPROG-cp}" | |
74 | +chmodprog="${CHMODPROG-chmod}" | |
75 | +chownprog="${CHOWNPROG-chown}" | |
76 | +chgrpprog="${CHGRPPROG-chgrp}" | |
77 | +stripprog="${STRIPPROG-strip}" | |
78 | +rmprog="${RMPROG-rm}" | |
79 | +mkdirprog="${MKDIRPROG-mkdir}" | |
80 | + | |
81 | +transformbasename="" | |
82 | +transform_arg="" | |
83 | +instcmd="$mvprog" | |
84 | +chmodcmd="$chmodprog 0755" | |
85 | +chowncmd="" | |
86 | +chgrpcmd="" | |
87 | +stripcmd="" | |
88 | +rmcmd="$rmprog -f" | |
89 | +mvcmd="$mvprog" | |
90 | +src="" | |
91 | +dst="" | |
92 | +dir_arg="" | |
93 | + | |
94 | +while [ x"$1" != x ]; do | |
95 | + case $1 in | |
96 | + -c) instcmd="$cpprog" | |
97 | + shift | |
98 | + continue;; | |
99 | + | |
100 | + -d) dir_arg=true | |
101 | + shift | |
102 | + continue;; | |
103 | + | |
104 | + -m) chmodcmd="$chmodprog $2" | |
105 | + shift | |
106 | + shift | |
107 | + continue;; | |
108 | + | |
109 | + -o) chowncmd="$chownprog $2" | |
110 | + shift | |
111 | + shift | |
112 | + continue;; | |
113 | + | |
114 | + -g) chgrpcmd="$chgrpprog $2" | |
115 | + shift | |
116 | + shift | |
117 | + continue;; | |
118 | + | |
119 | + -s) stripcmd="$stripprog" | |
120 | + shift | |
121 | + continue;; | |
122 | + | |
123 | + -t=*) transformarg=`echo $1 | sed 's/-t=//'` | |
124 | + shift | |
125 | + continue;; | |
126 | + | |
127 | + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` | |
128 | + shift | |
129 | + continue;; | |
130 | + | |
131 | + *) if [ x"$src" = x ] | |
132 | + then | |
133 | + src=$1 | |
134 | + else | |
135 | + # this colon is to work around a 386BSD /bin/sh bug | |
136 | + : | |
137 | + dst=$1 | |
138 | + fi | |
139 | + shift | |
140 | + continue;; | |
141 | + esac | |
142 | done | |
143 | ||
144 | -if test ! ${2-""}; then | |
145 | - echo "install: no destination specified" | |
146 | +if [ x"$src" = x ] | |
147 | +then | |
148 | + echo "install: no input file specified" | |
149 | exit 1 | |
150 | +else | |
151 | + true | |
152 | fi | |
153 | -if test ${3-""}; then | |
154 | - echo "install: too many files specified -> $*" | |
155 | - exit 1 | |
156 | -fi | |
157 | -if test $1 = $2 -o $2 = .; then | |
158 | - echo "install: can't move $1 onto itself" | |
159 | - exit 1 | |
160 | -fi | |
161 | -case $cmd in | |
162 | -/bin/mkdir ) | |
163 | - file=$2/$1 | |
164 | - ;; | |
165 | -* ) | |
166 | - if test '!' -f $1; then | |
167 | - echo "install: can't open $1" | |
168 | - exit 1 | |
169 | + | |
170 | +if [ x"$dir_arg" != x ]; then | |
171 | + dst=$src | |
172 | + src="" | |
173 | + | |
174 | + if [ -d $dst ]; then | |
175 | + instcmd=: | |
176 | + chmodcmd="" | |
177 | + else | |
178 | + instcmd=mkdir | |
179 | fi | |
180 | - if test -d $2; then | |
181 | - file=$2/$1 | |
182 | +else | |
183 | + | |
184 | +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command | |
185 | +# might cause directories to be created, which would be especially bad | |
186 | +# if $src (and thus $dsttmp) contains '*'. | |
187 | + | |
188 | + if [ -f $src -o -d $src ] | |
189 | + then | |
190 | + true | |
191 | else | |
192 | - file=$2 | |
193 | + echo "install: $src does not exist" | |
194 | + exit 1 | |
195 | fi | |
196 | - /bin/rm -f $file | |
197 | - ;; | |
198 | -esac | |
199 | - | |
200 | -case $cmd in | |
201 | -/bin/mkdir ) | |
202 | - if test ! -d "$file"; then | |
203 | - $cmd $file | |
204 | - fi | |
205 | - ;; | |
206 | -* ) | |
207 | - $cmd $1 $file | |
208 | - if test -n "$strip"; then | |
209 | - $strip $file | |
210 | + | |
211 | + if [ x"$dst" = x ] | |
212 | + then | |
213 | + echo "install: no destination specified" | |
214 | + exit 1 | |
215 | + else | |
216 | + true | |
217 | fi | |
218 | - ;; | |
219 | -esac | |
220 | ||
221 | -if test -n "$chown"; then | |
222 | - $chown $file | |
223 | +# If destination is a directory, append the input filename; if your system | |
224 | +# does not like double slashes in filenames, you may need to add some logic | |
225 | + | |
226 | + if [ -d $dst ] | |
227 | + then | |
228 | + dst="$dst"/`basename $src` | |
229 | + else | |
230 | + true | |
231 | + fi | |
232 | fi | |
233 | -if test -n "$chgrp"; then | |
234 | - $chgrp $file | |
235 | + | |
236 | +## this sed command emulates the dirname command | |
237 | +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` | |
238 | + | |
239 | +# Make sure that the destination directory exists. | |
240 | +# this part is taken from Noah Friedman's mkinstalldirs script | |
241 | + | |
242 | +# Skip lots of stat calls in the usual case. | |
243 | +if [ ! -d "$dstdir" ]; then | |
244 | +defaultIFS=' | |
245 | +' | |
246 | +IFS="${IFS-${defaultIFS}}" | |
247 | + | |
248 | +oIFS="${IFS}" | |
249 | +# Some sh's can't handle IFS=/ for some reason. | |
250 | +IFS='%' | |
251 | +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` | |
252 | +IFS="${oIFS}" | |
253 | + | |
254 | +pathcomp='' | |
255 | + | |
256 | +while [ $# -ne 0 ] ; do | |
257 | + pathcomp="${pathcomp}${1}" | |
258 | + shift | |
259 | + | |
260 | + if [ ! -d "${pathcomp}" ] ; | |
261 | + then | |
262 | + $mkdirprog "${pathcomp}" | |
263 | + else | |
264 | + true | |
265 | + fi | |
266 | + | |
267 | + pathcomp="${pathcomp}/" | |
268 | +done | |
269 | fi | |
270 | -$chmod $file | |
271 | + | |
272 | +if [ x"$dir_arg" != x ] | |
273 | +then | |
274 | + $doit $instcmd $dst && | |
275 | + | |
276 | + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && | |
277 | + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && | |
278 | + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && | |
279 | + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi | |
280 | +else | |
281 | + | |
282 | +# If we're going to rename the final executable, determine the name now. | |
283 | + | |
284 | + if [ x"$transformarg" = x ] | |
285 | + then | |
286 | + dstfile=`basename $dst` | |
287 | + else | |
288 | + dstfile=`basename $dst $transformbasename | | |
289 | + sed $transformarg`$transformbasename | |
290 | + fi | |
291 | + | |
292 | +# don't allow the sed command to completely eliminate the filename | |
293 | + | |
294 | + if [ x"$dstfile" = x ] | |
295 | + then | |
296 | + dstfile=`basename $dst` | |
297 | + else | |
298 | + true | |
299 | + fi | |
300 | + | |
301 | +# Make a temp file name in the proper directory. | |
302 | + | |
303 | + dsttmp=$dstdir/#inst.$$# | |
304 | + | |
305 | +# Move or copy the file name to the temp name | |
306 | + | |
307 | + $doit $instcmd $src $dsttmp && | |
308 | + | |
309 | + trap "rm -f ${dsttmp}" 0 && | |
310 | + | |
311 | +# and set any options; do chmod last to preserve setuid bits | |
312 | + | |
313 | +# If any of these fail, we abort the whole thing. If we want to | |
314 | +# ignore errors from any of these, just make sure not to ignore | |
315 | +# errors from the above "$doit $instcmd $src $dsttmp" command. | |
316 | + | |
317 | + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && | |
318 | + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && | |
319 | + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && | |
320 | + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && | |
321 | + | |
322 | +# Now rename the file to the real destination. | |
323 | + | |
324 | + $doit $rmcmd -f $dstdir/$dstfile && | |
325 | + $doit $mvcmd $dsttmp $dstdir/$dstfile | |
326 | + | |
327 | +fi && | |
328 | + | |
329 | ||
330 | exit 0 | |
331 | diff -urN epic4-1.2.9.org/Makefile.in epic4-1.2.9/Makefile.in | |
332 | --- epic4-1.2.9.org/Makefile.in 2004-06-13 22:24:06.120067888 +0200 | |
333 | +++ epic4-1.2.9/Makefile.in 2004-06-13 22:25:43.489265520 +0200 | |
334 | @@ -72,9 +72,9 @@ | |
335 | mandir = @mandir@ | |
336 | ||
337 | epic = @epic@ | |
338 | -epic_exe = $(bindir)/$(epic) | |
339 | -wserv_exe = $(libexecdir)/wserv4 | |
340 | -epicdir = $(sharedir)/$(epic) | |
341 | +epic_exe = $(epic) | |
342 | +wserv_exe = wserv4 | |
343 | +epicdir = $(epic) | |
344 | ||
345 | ############ You ought not change anything below this line ################### | |
346 | ||
347 | @@ -111,23 +111,12 @@ | |
348 | epic: source/Makefile Makefile | |
349 | @cd source; $(MAKE2) all | |
350 | ||
351 | -EPIC = $(epic_exe)-$(VERSION) | |
352 | +EPIC = $(epic_exe) | |
353 | EPIC_OLD = $(epic_exe).old | |
354 | EPIC_LINK = $(epic_exe) | |
355 | installepic installirc: epic installdirs test | |
356 | - if ./my_test \( ! -f $(IP)$(EPIC) \) \ | |
357 | - -o source/epic -nt $(IP)$(EPIC); then \ | |
358 | - $(INSTALL_PROGRAM) source/epic $(IP)$(EPIC); \ | |
359 | - if ./my_test -f $(IP)$(EPIC_OLD); then \ | |
360 | - $(RM) $(IP)$(EPIC_OLD); \ | |
361 | - fi; \ | |
362 | - if ./my_test -f $(IP)$(EPIC_LINK); then \ | |
363 | - $(MV) $(IP)$(EPIC_LINK) $(IP)$(EPIC_OLD); \ | |
364 | - fi; \ | |
365 | - $(RM) $(IP)$(EPIC_LINK); \ | |
f99b707f | 366 | - ln -s $(epic)-$(VERSION) $(IP)$(EPIC_LINK); \ |
340d3e48 AM |
367 | - fi |
368 | - | |
369 | + $(INSTALL_PROGRAM) source/epic $(DESTDIR)$(bindir) | |
370 | + | |
371 | # | |
372 | # wserv | |
373 | # | |
374 | @@ -136,19 +125,16 @@ | |
375 | ||
376 | WSERV = $(wserv_exe) | |
377 | installwserv: wserv4 installdirs test | |
378 | - if ./my_test \( \! -f $(IP)$(WSERV) \) -o \ | |
379 | - source/wserv4 -nt $(IP)$(WSERV); then \ | |
380 | - $(INSTALL_PROGRAM) source/wserv4 $(IP)$(WSERV); \ | |
381 | - fi | |
382 | - | |
383 | - | |
384 | + @srcdir@/mkinstalldirs $(DESTDIR)$(bindir) | |
385 | + $(INSTALL_PROGRAM) source/wserv4 $(DESTDIR)$(bindir) | |
386 | + | |
387 | # | |
388 | # Script library | |
389 | # | |
390 | scriptdir = $(epicdir)/script | |
391 | installscript: installdirs test | |
392 | -@( \ | |
393 | - if ./my_test -f $(IP)$(scriptdir)/local; then \ | |
394 | + if ./my_test -f $(DESTDIR)$(scriptdir)/local; then \ | |
395 | if ./my_test -f script/local; then \ | |
396 | $(MV) @srcdir@/script/local \ | |
397 | @srcdir@/script/local.orig; \ | |
398 | @@ -161,7 +147,7 @@ | |
399 | if ./my_test -x $$i; then \ | |
400 | chmod a-x $$i; \ | |
401 | fi; \ | |
402 | - target=$(IP)$(scriptdir)/`basename $$i`; \ | |
403 | + target=$(DESTDIR)$(scriptdir)/`basename $$i`; \ | |
404 | if ./my_test -f $$target; then \ | |
405 | if ./my_test $$i -nt $$target; then \ | |
406 | $(INSTALL_DATA) $$i $$target; \ | |
407 | @@ -173,7 +159,7 @@ | |
408 | fi; \ | |
409 | else \ | |
410 | $(INSTALL_DATA) $$i $$target; \ | |
411 | - if ./my_test -f $(IP)$(scriptdir)/gzip-scripts; then \ | |
412 | + if ./my_test -f $(DESTDIR)$(scriptdir)/gzip-scripts; then \ | |
413 | gzip -f $$target; \ | |
414 | fi; \ | |
415 | fi; \ | |
416 | @@ -183,19 +169,19 @@ | |
417 | helpdir = $(epicdir)/help | |
418 | installhelp: installdirs | |
419 | if ./my_test -d help ; then \ | |
420 | - (cd @srcdir@/help; tar cf - .) | (cd $(IP)$(helpdir); tar xf -) ; \ | |
421 | + (cd @srcdir@/help; tar cf - .) | (cd $(DESTDIR)$(helpdir); tar xf -) ; \ | |
422 | else \ | |
423 | echo No help files to install. ; \ | |
424 | fi | |
425 | ||
426 | installman: installdirs | |
427 | - $(INSTALL_DATA) @srcdir@/doc/epic.1 $(IP)/$(mandir)/man1/$(epic).1 | |
428 | + $(INSTALL_DATA) @srcdir@/doc/epic.1 $(DESTDIR)/$(mandir)/man1/$(epic).1 | |
429 | ||
430 | installdirs: | |
431 | umask 022; \ | |
432 | - @srcdir@/mkinstalldirs $(IP)$(epicdir) $(IP)$(scriptdir) \ | |
433 | - $(IP)$(helpdir) $(IP)$(bindir) $(IP)$(libexecdir) \ | |
434 | - $(IP)$(mandir)/man1 | |
435 | + @srcdir@/mkinstalldirs $(DESTDIR)$(epicdir) $(DESTDIR)$(scriptdir) \ | |
436 | + $(DESTDIR)$(helpdir) $(DESTDIR)$(bindir) $(DESTDIR)$(libexecdir) \ | |
437 | + $(DESTDIR)$(mandir)/man1 | |
438 | ||
439 | test.o: @srcdir@/test.c | |
440 | $(CC) -c @srcdir@/test.c |