install-sh | install-sh | |||
---|---|---|---|---|
#!/bin/sh | #!/bin/sh | |||
# install - install a program, script, or datafile | # install - install a program, script, or datafile | |||
scriptversion=2009-04-28.21; # UTC | scriptversion=2011-01-19.21; # UTC | |||
# This originates from X11R5 (mit/util/scripts/install.sh), which was | # This originates from X11R5 (mit/util/scripts/install.sh), which was | |||
# later released in X11R6 (xc/config/util/install.sh) with the | # later released in X11R6 (xc/config/util/install.sh) with the | |||
# following copyright and license. | # following copyright and license. | |||
# | # | |||
# Copyright (C) 1994 X Consortium | # Copyright (C) 1994 X Consortium | |||
# | # | |||
# Permission is hereby granted, free of charge, to any person obtaining a c opy | # Permission is hereby granted, free of charge, to any person obtaining a c opy | |||
# of this software and associated documentation files (the "Software"), to | # of this software and associated documentation files (the "Software"), to | |||
# deal in the Software without restriction, including without limitation th e | # deal in the Software without restriction, including without limitation th e | |||
skipping to change at line 159 | skipping to change at line 159 | |||
exit 1;; | exit 1;; | |||
esac | esac | |||
shift;; | shift;; | |||
-o) chowncmd="$chownprog $2" | -o) chowncmd="$chownprog $2" | |||
shift;; | shift;; | |||
-s) stripcmd=$stripprog;; | -s) stripcmd=$stripprog;; | |||
-t) dst_arg=$2 | -t) dst_arg=$2 | |||
# Protect names problematic for `test' and other utilities. | ||||
case $dst_arg in | ||||
-* | [=\(\)!]) dst_arg=./$dst_arg;; | ||||
esac | ||||
shift;; | shift;; | |||
-T) no_target_directory=true;; | -T) no_target_directory=true;; | |||
--version) echo "$0 $scriptversion"; exit $?;; | --version) echo "$0 $scriptversion"; exit $?;; | |||
--) shift | --) shift | |||
break;; | break;; | |||
-*) echo "$0: invalid option: $1" >&2 | -*) echo "$0: invalid option: $1" >&2 | |||
skipping to change at line 189 | skipping to change at line 193 | |||
# Otherwise, the last argument is the destination. Remove it from $@. | # Otherwise, the last argument is the destination. Remove it from $@. | |||
for arg | for arg | |||
do | do | |||
if test -n "$dst_arg"; then | if test -n "$dst_arg"; then | |||
# $@ is not empty: it contains at least $arg. | # $@ is not empty: it contains at least $arg. | |||
set fnord "$@" "$dst_arg" | set fnord "$@" "$dst_arg" | |||
shift # fnord | shift # fnord | |||
fi | fi | |||
shift # arg | shift # arg | |||
dst_arg=$arg | dst_arg=$arg | |||
# Protect names problematic for `test' and other utilities. | ||||
case $dst_arg in | ||||
-* | [=\(\)!]) dst_arg=./$dst_arg;; | ||||
esac | ||||
done | done | |||
fi | fi | |||
if test $# -eq 0; then | if test $# -eq 0; then | |||
if test -z "$dir_arg"; then | if test -z "$dir_arg"; then | |||
echo "$0: no input file specified." >&2 | echo "$0: no input file specified." >&2 | |||
exit 1 | exit 1 | |||
fi | fi | |||
# It's OK to call `install-sh -d' without argument. | # It's OK to call `install-sh -d' without argument. | |||
# This can happen when creating conditional directories. | # This can happen when creating conditional directories. | |||
exit 0 | exit 0 | |||
fi | fi | |||
if test -z "$dir_arg"; then | if test -z "$dir_arg"; then | |||
trap '(exit $?); exit' 1 2 13 15 | do_exit='(exit $ret); exit $ret' | |||
trap "ret=129; $do_exit" 1 | ||||
trap "ret=130; $do_exit" 2 | ||||
trap "ret=141; $do_exit" 13 | ||||
trap "ret=143; $do_exit" 15 | ||||
# Set umask so as not to create temps with too-generous modes. | # Set umask so as not to create temps with too-generous modes. | |||
# However, 'strip' requires both read and write access to temps. | # However, 'strip' requires both read and write access to temps. | |||
case $mode in | case $mode in | |||
# Optimize common cases. | # Optimize common cases. | |||
*644) cp_umask=133;; | *644) cp_umask=133;; | |||
*755) cp_umask=22;; | *755) cp_umask=22;; | |||
*[0-7]) | *[0-7]) | |||
if test -z "$stripcmd"; then | if test -z "$stripcmd"; then | |||
skipping to change at line 231 | skipping to change at line 243 | |||
u_plus_rw= | u_plus_rw= | |||
else | else | |||
u_plus_rw=,u+rw | u_plus_rw=,u+rw | |||
fi | fi | |||
cp_umask=$mode$u_plus_rw;; | cp_umask=$mode$u_plus_rw;; | |||
esac | esac | |||
fi | fi | |||
for src | for src | |||
do | do | |||
# Protect names starting with `-'. | # Protect names problematic for `test' and other utilities. | |||
case $src in | case $src in | |||
-*) src=./$src;; | -* | [=\(\)!]) src=./$src;; | |||
esac | esac | |||
if test -n "$dir_arg"; then | if test -n "$dir_arg"; then | |||
dst=$src | dst=$src | |||
dstdir=$dst | dstdir=$dst | |||
test -d "$dstdir" | test -d "$dstdir" | |||
dstdir_status=$? | dstdir_status=$? | |||
else | else | |||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command | # Waiting for this to be detected by the "$cpprog $src $dsttmp" command | |||
skipping to change at line 255 | skipping to change at line 267 | |||
# if $src (and thus $dsttmp) contains '*'. | # if $src (and thus $dsttmp) contains '*'. | |||
if test ! -f "$src" && test ! -d "$src"; then | if test ! -f "$src" && test ! -d "$src"; then | |||
echo "$0: $src does not exist." >&2 | echo "$0: $src does not exist." >&2 | |||
exit 1 | exit 1 | |||
fi | fi | |||
if test -z "$dst_arg"; then | if test -z "$dst_arg"; then | |||
echo "$0: no destination specified." >&2 | echo "$0: no destination specified." >&2 | |||
exit 1 | exit 1 | |||
fi | fi | |||
dst=$dst_arg | dst=$dst_arg | |||
# Protect names starting with `-'. | ||||
case $dst in | ||||
-*) dst=./$dst;; | ||||
esac | ||||
# If destination is a directory, append the input filename; won't work | # If destination is a directory, append the input filename; won't work | |||
# if double slashes aren't ignored. | # if double slashes aren't ignored. | |||
if test -d "$dst"; then | if test -d "$dst"; then | |||
if test -n "$no_target_directory"; then | if test -n "$no_target_directory"; then | |||
echo "$0: $dst_arg: Is a directory" >&2 | echo "$0: $dst_arg: Is a directory" >&2 | |||
exit 1 | exit 1 | |||
fi | fi | |||
dstdir=$dst | dstdir=$dst | |||
dst=$dstdir/`basename "$src"` | dst=$dstdir/`basename "$src"` | |||
skipping to change at line 388 | skipping to change at line 395 | |||
) | ) | |||
then : | then : | |||
else | else | |||
# The umask is ridiculous, or mkdir does not conform to POSIX, | # The umask is ridiculous, or mkdir does not conform to POSIX, | |||
# or it failed possibly due to a race condition. Create the | # or it failed possibly due to a race condition. Create the | |||
# directory the slow way, step by step, checking for races as we go. | # directory the slow way, step by step, checking for races as we go. | |||
case $dstdir in | case $dstdir in | |||
/*) prefix='/';; | /*) prefix='/';; | |||
-*) prefix='./';; | [-=\(\)!]*) prefix='./';; | |||
*) prefix='';; | *) prefix='';; | |||
esac | esac | |||
eval "$initialize_posix_glob" | eval "$initialize_posix_glob" | |||
oIFS=$IFS | oIFS=$IFS | |||
IFS=/ | IFS=/ | |||
$posix_glob set -f | $posix_glob set -f | |||
set fnord $dstdir | set fnord $dstdir | |||
shift | shift | |||
$posix_glob set +f | $posix_glob set +f | |||
IFS=$oIFS | IFS=$oIFS | |||
prefixes= | prefixes= | |||
for d | for d | |||
do | do | |||
test -z "$d" && continue | test X"$d" = X && continue | |||
prefix=$prefix$d | prefix=$prefix$d | |||
if test -d "$prefix"; then | if test -d "$prefix"; then | |||
prefixes= | prefixes= | |||
else | else | |||
if $posix_mkdir; then | if $posix_mkdir; then | |||
(umask=$mkdir_umask && | (umask=$mkdir_umask && | |||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break | $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break | |||
# Don't fail if two instances are running concurrently. | # Don't fail if two instances are running concurrently. | |||
test -d "$prefix" || exit 1 | test -d "$prefix" || exit 1 | |||
End of changes. 10 change blocks. | ||||
11 lines changed or deleted | 18 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |