| 1 |
|
#!/bin/sh |
| 2 |
|
# install - install a program, script, or datafile |
| 3 |
|
|
| 4 |
< |
scriptversion=2009-04-28.21; # UTC |
| 4 |
> |
scriptversion=2011-11-20.07; # UTC |
| 5 |
|
|
| 6 |
|
# This originates from X11R5 (mit/util/scripts/install.sh), which was |
| 7 |
|
# later released in X11R6 (xc/config/util/install.sh) with the |
| 35 |
|
# FSF changes to this file are in the public domain. |
| 36 |
|
# |
| 37 |
|
# Calling this script install-sh is preferred over install.sh, to prevent |
| 38 |
< |
# `make' implicit rules from creating a file called install from it |
| 38 |
> |
# 'make' implicit rules from creating a file called install from it |
| 39 |
|
# when there is no Makefile. |
| 40 |
|
# |
| 41 |
|
# This script is compatible with the BSD install script, but was written |
| 156 |
|
-s) stripcmd=$stripprog;; |
| 157 |
|
|
| 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 |
| 163 |
|
shift;; |
| 164 |
|
|
| 165 |
|
-T) no_target_directory=true;; |
| 190 |
|
fi |
| 191 |
|
shift # 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 |
| 197 |
|
done |
| 198 |
|
fi |
| 199 |
|
|
| 202 |
|
echo "$0: no input file specified." >&2 |
| 203 |
|
exit 1 |
| 204 |
|
fi |
| 205 |
< |
# It's OK to call `install-sh -d' without argument. |
| 205 |
> |
# It's OK to call 'install-sh -d' without argument. |
| 206 |
|
# This can happen when creating conditional directories. |
| 207 |
|
exit 0 |
| 208 |
|
fi |
| 209 |
|
|
| 210 |
|
if test -z "$dir_arg"; then |
| 211 |
< |
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 |
| 216 |
|
|
| 217 |
|
# Set umask so as not to create temps with too-generous modes. |
| 218 |
|
# However, 'strip' requires both read and write access to temps. |
| 240 |
|
|
| 241 |
|
for src |
| 242 |
|
do |
| 243 |
< |
# Protect names starting with `-'. |
| 243 |
> |
# Protect names problematic for 'test' and other utilities. |
| 244 |
|
case $src in |
| 245 |
< |
-*) src=./$src;; |
| 245 |
> |
-* | [=\(\)!]) src=./$src;; |
| 246 |
|
esac |
| 247 |
|
|
| 248 |
|
if test -n "$dir_arg"; then |
| 264 |
|
echo "$0: no destination specified." >&2 |
| 265 |
|
exit 1 |
| 266 |
|
fi |
| 255 |
– |
|
| 267 |
|
dst=$dst_arg |
| 257 |
– |
# Protect names starting with `-'. |
| 258 |
– |
case $dst in |
| 259 |
– |
-*) dst=./$dst;; |
| 260 |
– |
esac |
| 268 |
|
|
| 269 |
|
# If destination is a directory, append the input filename; won't work |
| 270 |
|
# if double slashes aren't ignored. |
| 354 |
|
if test -z "$dir_arg" || { |
| 355 |
|
# Check for POSIX incompatibilities with -m. |
| 356 |
|
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or |
| 357 |
< |
# other-writeable bit of parent directory when it shouldn't. |
| 357 |
> |
# other-writable bit of parent directory when it shouldn't. |
| 358 |
|
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory. |
| 359 |
|
ls_ld_tmpdir=`ls -ld "$tmpdir"` |
| 360 |
|
case $ls_ld_tmpdir in |
| 392 |
|
|
| 393 |
|
case $dstdir in |
| 394 |
|
/*) prefix='/';; |
| 395 |
< |
-*) prefix='./';; |
| 395 |
> |
[-=\(\)!]*) prefix='./';; |
| 396 |
|
*) prefix='';; |
| 397 |
|
esac |
| 398 |
|
|
| 410 |
|
|
| 411 |
|
for d |
| 412 |
|
do |
| 413 |
< |
test -z "$d" && continue |
| 413 |
> |
test X"$d" = X && continue |
| 414 |
|
|
| 415 |
|
prefix=$prefix$d |
| 416 |
|
if test -d "$prefix"; then |