comparison install-sh @ 20:dd5b333a7960

Regenerate Autotools files myself with Ron's patch
author Adam Chlipala <adam@chlipala.net>
date Sat, 23 Jun 2012 09:58:31 -0400
parents ad85b8813e8a
children
comparison
equal deleted inserted replaced
19:287a0e02f1a6 20:dd5b333a7960
1 #!/bin/sh 1 #!/bin/sh
2 # install - install a program, script, or datafile 2 # install - install a program, script, or datafile
3 3
4 scriptversion=2009-04-28.21; # UTC 4 scriptversion=2011-01-19.21; # UTC
5 5
6 # This originates from X11R5 (mit/util/scripts/install.sh), which was 6 # This originates from X11R5 (mit/util/scripts/install.sh), which was
7 # later released in X11R6 (xc/config/util/install.sh) with the 7 # later released in X11R6 (xc/config/util/install.sh) with the
8 # following copyright and license. 8 # following copyright and license.
9 # 9 #
154 shift;; 154 shift;;
155 155
156 -s) stripcmd=$stripprog;; 156 -s) stripcmd=$stripprog;;
157 157
158 -t) dst_arg=$2 158 -t) dst_arg=$2
159 # Protect names problematic for `test' and other utilities.
160 case $dst_arg in
161 -* | [=\(\)!]) dst_arg=./$dst_arg;;
162 esac
159 shift;; 163 shift;;
160 164
161 -T) no_target_directory=true;; 165 -T) no_target_directory=true;;
162 166
163 --version) echo "$0 $scriptversion"; exit $?;; 167 --version) echo "$0 $scriptversion"; exit $?;;
184 set fnord "$@" "$dst_arg" 188 set fnord "$@" "$dst_arg"
185 shift # fnord 189 shift # fnord
186 fi 190 fi
187 shift # arg 191 shift # arg
188 dst_arg=$arg 192 dst_arg=$arg
193 # Protect names problematic for `test' and other utilities.
194 case $dst_arg in
195 -* | [=\(\)!]) dst_arg=./$dst_arg;;
196 esac
189 done 197 done
190 fi 198 fi
191 199
192 if test $# -eq 0; then 200 if test $# -eq 0; then
193 if test -z "$dir_arg"; then 201 if test -z "$dir_arg"; then
198 # This can happen when creating conditional directories. 206 # This can happen when creating conditional directories.
199 exit 0 207 exit 0
200 fi 208 fi
201 209
202 if test -z "$dir_arg"; then 210 if test -z "$dir_arg"; then
203 trap '(exit $?); exit' 1 2 13 15 211 do_exit='(exit $ret); exit $ret'
212 trap "ret=129; $do_exit" 1
213 trap "ret=130; $do_exit" 2
214 trap "ret=141; $do_exit" 13
215 trap "ret=143; $do_exit" 15
204 216
205 # Set umask so as not to create temps with too-generous modes. 217 # Set umask so as not to create temps with too-generous modes.
206 # However, 'strip' requires both read and write access to temps. 218 # However, 'strip' requires both read and write access to temps.
207 case $mode in 219 case $mode in
208 # Optimize common cases. 220 # Optimize common cases.
226 esac 238 esac
227 fi 239 fi
228 240
229 for src 241 for src
230 do 242 do
231 # Protect names starting with `-'. 243 # Protect names problematic for `test' and other utilities.
232 case $src in 244 case $src in
233 -*) src=./$src;; 245 -* | [=\(\)!]) src=./$src;;
234 esac 246 esac
235 247
236 if test -n "$dir_arg"; then 248 if test -n "$dir_arg"; then
237 dst=$src 249 dst=$src
238 dstdir=$dst 250 dstdir=$dst
250 262
251 if test -z "$dst_arg"; then 263 if test -z "$dst_arg"; then
252 echo "$0: no destination specified." >&2 264 echo "$0: no destination specified." >&2
253 exit 1 265 exit 1
254 fi 266 fi
255
256 dst=$dst_arg 267 dst=$dst_arg
257 # Protect names starting with `-'.
258 case $dst in
259 -*) dst=./$dst;;
260 esac
261 268
262 # If destination is a directory, append the input filename; won't work 269 # If destination is a directory, append the input filename; won't work
263 # if double slashes aren't ignored. 270 # if double slashes aren't ignored.
264 if test -d "$dst"; then 271 if test -d "$dst"; then
265 if test -n "$no_target_directory"; then 272 if test -n "$no_target_directory"; then
383 # or it failed possibly due to a race condition. Create the 390 # or it failed possibly due to a race condition. Create the
384 # directory the slow way, step by step, checking for races as we go. 391 # directory the slow way, step by step, checking for races as we go.
385 392
386 case $dstdir in 393 case $dstdir in
387 /*) prefix='/';; 394 /*) prefix='/';;
388 -*) prefix='./';; 395 [-=\(\)!]*) prefix='./';;
389 *) prefix='';; 396 *) prefix='';;
390 esac 397 esac
391 398
392 eval "$initialize_posix_glob" 399 eval "$initialize_posix_glob"
393 400
401 408
402 prefixes= 409 prefixes=
403 410
404 for d 411 for d
405 do 412 do
406 test -z "$d" && continue 413 test X"$d" = X && continue
407 414
408 prefix=$prefix$d 415 prefix=$prefix$d
409 if test -d "$prefix"; then 416 if test -d "$prefix"; then
410 prefixes= 417 prefixes=
411 else 418 else