OLD | NEW |
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=2011-01-19.21; # UTC | 4 scriptversion=2011-11-20.07; # 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 # |
10 # Copyright (C) 1994 X Consortium | 10 # Copyright (C) 1994 X Consortium |
11 # | 11 # |
12 # Permission is hereby granted, free of charge, to any person obtaining a copy | 12 # Permission is hereby granted, free of charge, to any person obtaining a copy |
13 # of this software and associated documentation files (the "Software"), to | 13 # of this software and associated documentation files (the "Software"), to |
14 # deal in the Software without restriction, including without limitation the | 14 # deal in the Software without restriction, including without limitation the |
(...skipping 13 matching lines...) Expand all Loading... |
28 # | 28 # |
29 # Except as contained in this notice, the name of the X Consortium shall not | 29 # Except as contained in this notice, the name of the X Consortium shall not |
30 # be used in advertising or otherwise to promote the sale, use or other deal- | 30 # be used in advertising or otherwise to promote the sale, use or other deal- |
31 # ings in this Software without prior written authorization from the X Consor- | 31 # ings in this Software without prior written authorization from the X Consor- |
32 # tium. | 32 # tium. |
33 # | 33 # |
34 # | 34 # |
35 # FSF changes to this file are in the public domain. | 35 # FSF changes to this file are in the public domain. |
36 # | 36 # |
37 # Calling this script install-sh is preferred over install.sh, to prevent | 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. | 39 # when there is no Makefile. |
40 # | 40 # |
41 # This script is compatible with the BSD install script, but was written | 41 # This script is compatible with the BSD install script, but was written |
42 # from scratch. | 42 # from scratch. |
43 | 43 |
44 nl=' | 44 nl=' |
45 ' | 45 ' |
46 IFS=" "" $nl" | 46 IFS=" "" $nl" |
47 | 47 |
48 # set DOITPROG to echo to test this script | 48 # set DOITPROG to echo to test this script |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 exit 1;; | 149 exit 1;; |
150 esac | 150 esac |
151 shift;; | 151 shift;; |
152 | 152 |
153 -o) chowncmd="$chownprog $2" | 153 -o) chowncmd="$chownprog $2" |
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. | 159 » # Protect names problematic for 'test' and other utilities. |
160 case $dst_arg in | 160 case $dst_arg in |
161 -* | [=\(\)!]) dst_arg=./$dst_arg;; | 161 -* | [=\(\)!]) dst_arg=./$dst_arg;; |
162 esac | 162 esac |
163 shift;; | 163 shift;; |
164 | 164 |
165 -T) no_target_directory=true;; | 165 -T) no_target_directory=true;; |
166 | 166 |
167 --version) echo "$0 $scriptversion"; exit $?;; | 167 --version) echo "$0 $scriptversion"; exit $?;; |
168 | 168 |
169 --) shift | 169 --) shift |
(...skipping 13 matching lines...) Expand all Loading... |
183 # Otherwise, the last argument is the destination. Remove it from $@. | 183 # Otherwise, the last argument is the destination. Remove it from $@. |
184 for arg | 184 for arg |
185 do | 185 do |
186 if test -n "$dst_arg"; then | 186 if test -n "$dst_arg"; then |
187 # $@ is not empty: it contains at least $arg. | 187 # $@ is not empty: it contains at least $arg. |
188 set fnord "$@" "$dst_arg" | 188 set fnord "$@" "$dst_arg" |
189 shift # fnord | 189 shift # fnord |
190 fi | 190 fi |
191 shift # arg | 191 shift # arg |
192 dst_arg=$arg | 192 dst_arg=$arg |
193 # Protect names problematic for `test' and other utilities. | 193 # Protect names problematic for 'test' and other utilities. |
194 case $dst_arg in | 194 case $dst_arg in |
195 -* | [=\(\)!]) dst_arg=./$dst_arg;; | 195 -* | [=\(\)!]) dst_arg=./$dst_arg;; |
196 esac | 196 esac |
197 done | 197 done |
198 fi | 198 fi |
199 | 199 |
200 if test $# -eq 0; then | 200 if test $# -eq 0; then |
201 if test -z "$dir_arg"; then | 201 if test -z "$dir_arg"; then |
202 echo "$0: no input file specified." >&2 | 202 echo "$0: no input file specified." >&2 |
203 exit 1 | 203 exit 1 |
204 fi | 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. | 206 # This can happen when creating conditional directories. |
207 exit 0 | 207 exit 0 |
208 fi | 208 fi |
209 | 209 |
210 if test -z "$dir_arg"; then | 210 if test -z "$dir_arg"; then |
211 do_exit='(exit $ret); exit $ret' | 211 do_exit='(exit $ret); exit $ret' |
212 trap "ret=129; $do_exit" 1 | 212 trap "ret=129; $do_exit" 1 |
213 trap "ret=130; $do_exit" 2 | 213 trap "ret=130; $do_exit" 2 |
214 trap "ret=141; $do_exit" 13 | 214 trap "ret=141; $do_exit" 13 |
215 trap "ret=143; $do_exit" 15 | 215 trap "ret=143; $do_exit" 15 |
(...skipping 17 matching lines...) Expand all Loading... |
233 u_plus_rw= | 233 u_plus_rw= |
234 else | 234 else |
235 u_plus_rw=,u+rw | 235 u_plus_rw=,u+rw |
236 fi | 236 fi |
237 cp_umask=$mode$u_plus_rw;; | 237 cp_umask=$mode$u_plus_rw;; |
238 esac | 238 esac |
239 fi | 239 fi |
240 | 240 |
241 for src | 241 for src |
242 do | 242 do |
243 # Protect names problematic for `test' and other utilities. | 243 # Protect names problematic for 'test' and other utilities. |
244 case $src in | 244 case $src in |
245 -* | [=\(\)!]) src=./$src;; | 245 -* | [=\(\)!]) src=./$src;; |
246 esac | 246 esac |
247 | 247 |
248 if test -n "$dir_arg"; then | 248 if test -n "$dir_arg"; then |
249 dst=$src | 249 dst=$src |
250 dstdir=$dst | 250 dstdir=$dst |
251 test -d "$dstdir" | 251 test -d "$dstdir" |
252 dstdir_status=$? | 252 dstdir_status=$? |
253 else | 253 else |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 *) | 347 *) |
348 tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ | 348 tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ |
349 trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 | 349 trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 |
350 | 350 |
351 if (umask $mkdir_umask && | 351 if (umask $mkdir_umask && |
352 exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 | 352 exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 |
353 then | 353 then |
354 if test -z "$dir_arg" || { | 354 if test -z "$dir_arg" || { |
355 # Check for POSIX incompatibilities with -m. | 355 # Check for POSIX incompatibilities with -m. |
356 # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or | 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. | 358 # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. |
359 ls_ld_tmpdir=`ls -ld "$tmpdir"` | 359 ls_ld_tmpdir=`ls -ld "$tmpdir"` |
360 case $ls_ld_tmpdir in | 360 case $ls_ld_tmpdir in |
361 d????-?r-*) different_mode=700;; | 361 d????-?r-*) different_mode=700;; |
362 d????-?--*) different_mode=755;; | 362 d????-?--*) different_mode=755;; |
363 *) false;; | 363 *) false;; |
364 esac && | 364 esac && |
365 $mkdirprog -m$different_mode -p -- "$tmpdir" && { | 365 $mkdirprog -m$different_mode -p -- "$tmpdir" && { |
366 ls_ld_tmpdir_1=`ls -ld "$tmpdir"` | 366 ls_ld_tmpdir_1=`ls -ld "$tmpdir"` |
367 test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" | 367 test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 fi | 518 fi |
519 done | 519 done |
520 | 520 |
521 # Local variables: | 521 # Local variables: |
522 # eval: (add-hook 'write-file-hooks 'time-stamp) | 522 # eval: (add-hook 'write-file-hooks 'time-stamp) |
523 # time-stamp-start: "scriptversion=" | 523 # time-stamp-start: "scriptversion=" |
524 # time-stamp-format: "%:y-%02m-%02d.%02H" | 524 # time-stamp-format: "%:y-%02m-%02d.%02H" |
525 # time-stamp-time-zone: "UTC" | 525 # time-stamp-time-zone: "UTC" |
526 # time-stamp-end: "; # UTC" | 526 # time-stamp-end: "; # UTC" |
527 # End: | 527 # End: |
OLD | NEW |