Commit | Line | Data |
---|---|---|
959f3c4c JH |
1 | case $CONFIG in |
2 | '') | |
3 | if test -f config.sh; then TOP=.; | |
4 | elif test -f ../config.sh; then TOP=..; | |
5 | elif test -f ../../config.sh; then TOP=../..; | |
6 | elif test -f ../../../config.sh; then TOP=../../..; | |
7 | elif test -f ../../../../config.sh; then TOP=../../../..; | |
8 | else | |
9 | echo "Can't find config.sh."; exit 1 | |
10 | fi | |
11 | . $TOP/config.sh | |
12 | ;; | |
13 | esac | |
14 | case "$0" in | |
15 | */*) cd `expr X$0 : 'X\(.*\)/'` ;; | |
16 | esac | |
17 | echo "Extracting install (with variable substitutions)" | |
18 | $spitshell >install <<!GROK!THIS! | |
19 | $startsh | |
20 | # @(#) Installing script accepting bsd-style arguments | |
21 | ||
22 | # $Id: install.SH,v 3.0.1.1 1993/08/19 06:42:10 ram Exp $ | |
23 | # | |
24 | # Copyright (c) 1991-1993, Raphael Manfredi | |
25 | # | |
26 | # You may redistribute only under the terms of the Artistic Licence, | |
27 | # as specified in the README file that comes with the distribution. | |
28 | # You may reuse parts of this distribution only within the terms of | |
29 | # that same Artistic Licence; a copy of which may be found at the root | |
30 | # of the source tree for dist 3.0. | |
31 | # | |
32 | # $Log: install.SH,v $ | |
33 | # Revision 3.0.1.1 1993/08/19 06:42:10 ram | |
34 | # patch1: leading config.sh searching was not aborting properly | |
35 | # | |
36 | # Revision 3.0 1993/08/18 12:04:08 ram | |
37 | # Baseline for dist 3.0 netwide release. | |
38 | # | |
39 | ||
40 | chown='$chown' | |
41 | chmod='$chmod' | |
42 | chgrp='$chgrp' | |
43 | rm='$rm' | |
44 | mv='$mv' | |
45 | test='$test' | |
46 | sed='$sed' | |
47 | !GROK!THIS! | |
48 | $spitshell >>install <<'!NO!SUBS!' | |
49 | ||
50 | mode="" | |
51 | dst="" | |
52 | src="" | |
53 | dostrip="" | |
54 | newdir="" | |
55 | uid="" | |
56 | gid="" | |
57 | ||
58 | # simulates mkdir -p | |
59 | mkdir_p=' | |
60 | name=$1; | |
61 | create=""; | |
62 | while $test $name; do | |
63 | if $test ! -d "$name"; then | |
64 | create="$name $create"; | |
65 | name=`echo $name | $sed -e "s|^[^/]*$||"`; | |
66 | name=`echo $name | $sed -e "s|\(.*\)/.*|\1|"`; | |
67 | else | |
68 | name=""; | |
69 | fi; | |
70 | done; | |
71 | for file in $create; do | |
72 | mkdir $file && $test $verbose && | |
73 | echo "install: created directory $file" >&2; | |
74 | done | |
75 | ' | |
76 | ||
77 | verbose='' | |
78 | ||
79 | while $test x$1 != x | |
80 | do | |
81 | case $1 in | |
82 | -c) shift | |
83 | continue | |
84 | ;; | |
85 | -m) mode="$2 " | |
86 | shift | |
87 | shift | |
88 | continue | |
89 | ;; | |
90 | -o) uid="$2 " | |
91 | shift | |
92 | shift | |
93 | continue | |
94 | ;; | |
95 | -g) gid="$2 " | |
96 | shift | |
97 | shift | |
98 | continue | |
99 | ;; | |
100 | -s) dostrip="strip" | |
101 | shift | |
102 | continue | |
103 | ;; | |
104 | -d) newdir="$newdir$2 " | |
105 | shift | |
106 | shift | |
107 | continue | |
108 | ;; | |
109 | -v) verbose='true' | |
110 | shift | |
111 | ;; | |
112 | *) if $test x$src = x | |
113 | then | |
114 | src=$1 | |
115 | else | |
116 | dst=$1 | |
117 | fi | |
118 | shift | |
119 | continue | |
120 | ;; | |
121 | esac | |
122 | done | |
123 | ||
124 | # if -d option is used, we have to create the path given | |
125 | if $test ! x$newdir = x | |
126 | then | |
127 | for i in $newdir | |
128 | do | |
129 | set x $i | |
130 | shift | |
131 | eval $mkdir_p | |
132 | done | |
133 | exit 0 # -d is the only action | |
134 | fi | |
135 | ||
136 | if $test x$src = x | |
137 | then | |
138 | echo "install: no input file specified" >&2 | |
139 | exit 1 | |
140 | fi | |
141 | ||
142 | if $test x$dst = x | |
143 | then | |
144 | echo "install: no destination specified" >&2 | |
145 | exit 1 | |
146 | fi | |
147 | ||
148 | srcbase=`basename $src` | |
149 | dstbase=`basename $dst` | |
150 | ||
151 | # If the destination is a directory, the target name is srcbase... | |
152 | if $test -d $dst; then | |
153 | dstbase=$srcbase | |
154 | else | |
155 | dst="`echo $dst | sed 's,^\(.*\)/.*$,\1,'`" | |
156 | if $test ! -d $dst; then | |
157 | dstbase=$dst | |
158 | dst="." | |
159 | fi | |
160 | fi | |
161 | ||
162 | # If the src has a directory, extract the dir name... | |
163 | if $test "$src" != "$srcbase" -a "$src" != "./$srcbase"; then | |
164 | src="`echo $src | sed 's,^\(.*\)/.*$,\1,'`" | |
165 | else | |
166 | src="." | |
167 | fi | |
168 | ||
169 | # dst is the destination directory and dstbase the base name. | |
170 | # srcbase is the base name of source and src the source dir. | |
171 | ||
172 | srcpth=`(cd $src; pwd)`/$srcbase | |
173 | destpth=`(cd $dst; pwd)`/$dstbase | |
174 | if $test x$srcpth = x$destpth; then | |
175 | $test $verbose && \ | |
176 | echo "install: destination and source are identical" | |
177 | exit 0 | |
178 | fi | |
179 | ||
180 | # Do the install | |
181 | ( | |
182 | cd $src | |
183 | ||
184 | if $test -f $dst/$dstbase; then | |
185 | $rm -f $dst/$dstbase && $test $verbose && | |
186 | echo "install: $dst/$dstbase removed" | |
187 | fi | |
188 | if $test -f $dst/$dstbase; then | |
189 | $mv $dst/$dstbase $dst/OLD$dstbase && $test $verbose && | |
190 | echo "install: $dst/$dstbase renamed as OLD$dstbase" | |
191 | fi | |
192 | ||
193 | cp $srcbase $dst/$dstbase && $test $verbose && | |
194 | echo "install: $srcbase installed as $dst/$dstbase" | |
195 | ||
196 | if $test ! x$dostrip = x; then | |
197 | strip $dst/$dstbase 2>/dev/null && $test $verbose && | |
198 | echo "install: stripped $dst/$dstbase" | |
199 | fi | |
200 | ||
201 | if $test ! x$uid = x; then | |
202 | $chown $uid $dst/$dstbase | |
203 | fi | |
204 | if $test ! x$gid = x; then | |
205 | $chgrp $gid $dst/$dstbase | |
206 | fi | |
207 | if $test ! x$mode = x | |
208 | then | |
209 | $chmod $mode $dst/$dstbase | |
210 | fi | |
211 | ) | |
212 | ||
213 | exit 0 | |
214 | !NO!SUBS! | |
215 | chmod 755 install | |
216 | $eunicefix install |