1 |
#!/bin/sh |
#!/bin/sh |
2 |
# install - install a program, script, or datafile |
# install - install a program, script, or datafile |
3 |
|
|
4 |
scriptversion=2004-12-17.09 |
scriptversion=2005-07-09.12 |
5 |
|
|
6 |
# This originates from X11R5 (mit/util/scripts/install.sh), which was |
# This originates from X11R5 (mit/util/scripts/install.sh), which was |
7 |
# later released in X11R6 (xc/config/util/install.sh) with the |
# later released in X11R6 (xc/config/util/install.sh) with the |
109 |
shift |
shift |
110 |
continue;; |
continue;; |
111 |
|
|
112 |
--help) echo "$usage"; exit 0;; |
--help) echo "$usage"; exit $?;; |
113 |
|
|
114 |
-m) chmodcmd="$chmodprog $2" |
-m) chmodcmd="$chmodprog $2" |
115 |
shift |
shift |
134 |
shift |
shift |
135 |
continue;; |
continue;; |
136 |
|
|
137 |
--version) echo "$0 $scriptversion"; exit 0;; |
--version) echo "$0 $scriptversion"; exit $?;; |
138 |
|
|
139 |
*) # When -d is used, all remaining arguments are directories to create. |
*) # When -d is used, all remaining arguments are directories to create. |
140 |
# When -t is used, the destination is already specified. |
# When -t is used, the destination is already specified. |
219 |
|
|
220 |
# Skip lots of stat calls in the usual case. |
# Skip lots of stat calls in the usual case. |
221 |
if test ! -d "$dstdir"; then |
if test ! -d "$dstdir"; then |
222 |
defaultIFS=' |
case $dstdir in |
223 |
' |
/*) pathcomp=/ ;; |
224 |
IFS="${IFS-$defaultIFS}" |
-*) pathcomp=./ ;; |
225 |
|
*) pathcomp= ;; |
226 |
|
esac |
227 |
oIFS=$IFS |
oIFS=$IFS |
228 |
# Some sh's can't handle IFS=/ for some reason. |
IFS=/ |
229 |
IFS='%' |
set fnord $dstdir |
|
set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` |
|
230 |
shift |
shift |
231 |
IFS=$oIFS |
IFS=$oIFS |
232 |
|
|
233 |
pathcomp= |
for d |
234 |
|
do |
235 |
|
test "x$d" = x && continue |
236 |
|
|
237 |
while test $# -ne 0 ; do |
pathcomp=$pathcomp$d |
|
pathcomp=$pathcomp$1 |
|
|
shift |
|
238 |
if test ! -d "$pathcomp"; then |
if test ! -d "$pathcomp"; then |
239 |
$mkdirprog "$pathcomp" |
$mkdirprog "$pathcomp" |
240 |
# mkdir can fail with a `File exist' error in case several |
# mkdir can fail with a `File exist' error in case several |
241 |
# install-sh are creating the directory concurrently. This |
# install-sh are creating the directory concurrently. This |
242 |
# is OK. |
# is OK. |
243 |
test -d "$pathcomp" || exit |
test -d "$pathcomp" || exit 1 |
244 |
fi |
fi |
245 |
pathcomp=$pathcomp/ |
pathcomp=$pathcomp/ |
246 |
done |
done |