Lines Matching +full:ls +full:- +full:bits
2 # install - install a program, script, or datafile
4 scriptversion=2013-12-25.23; # UTC
26 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
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-
37 # Calling this script install-sh is preferred over install.sh, to prevent
51 doit=${DOITPROG-}
52 doit_exec=${doit:-exec}
57 chgrpprog=${CHGRPPROG-chgrp}
58 chmodprog=${CHMODPROG-chmod}
59 chownprog=${CHOWNPROG-chown}
60 cmpprog=${CMPPROG-cmp}
61 cpprog=${CPPROG-cp}
62 mkdirprog=${MKDIRPROG-mkdir}
63 mvprog=${MVPROG-mv}
64 rmprog=${RMPROG-rm}
65 stripprog=${STRIPPROG-strip}
76 rmcmd="$rmprog -f"
88 Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
90 or: $0 [OPTION]... -t DIRECTORY SRCFILES...
91 or: $0 [OPTION]... -d DIRECTORIES...
98 --help display this help and exit.
99 --version display version info and exit.
101 -c (ignored)
102 -C install only if different (preserve the last data modification time)
103 -d create directories instead of installing files.
104 -g GROUP $chgrpprog installed files to GROUP.
105 -m MODE $chmodprog installed files to MODE.
106 -o USER $chownprog installed files to USER.
107 -s $stripprog installed files.
108 -t DIRECTORY install into DIRECTORY.
109 -T report an error if DSTFILE is a directory.
116 while test $# -ne 0; do
118 -c) ;;
120 -C) copy_on_change=true;;
122 -d) dir_arg=true;;
124 -g) chgrpcmd="$chgrpprog $2"
127 --help) echo "$usage"; exit $?;;
129 -m) mode=$2
137 -o) chowncmd="$chownprog $2"
140 -s) stripcmd=$stripprog;;
142 -t)
147 -* | [=\(\)!]) dst_arg=./$dst_arg;;
151 -T) is_target_a_directory=never;;
153 --version) echo "$0 $scriptversion"; exit $?;;
155 --) shift
158 -*) echo "$0: invalid option: $1" >&2
166 # We allow the use of options -d and -T together, by making -d
169 if test -n "$dir_arg"; then
170 if test -n "$dst_arg"; then
176 if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
177 # When -d is used, all remaining arguments are directories to create.
178 # When -t is used, the destination is already specified.
182 if test -n "$dst_arg"; then
191 -* | [=\(\)!]) dst_arg=./$dst_arg;;
196 if test $# -eq 0; then
197 if test -z "$dir_arg"; then
201 # It's OK to call 'install-sh -d' without argument.
206 if test -z "$dir_arg"; then
207 if test $# -gt 1 || test "$is_target_a_directory" = always; then
208 if test ! -d "$dst_arg"; then
215 if test -z "$dir_arg"; then
222 # Set umask so as not to create temps with too-generous modes.
229 *[0-7])
230 if test -z "$stripcmd"; then
235 cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
237 if test -z "$stripcmd"; then
250 -* | [=\(\)!]) src=./$src;;
253 if test -n "$dir_arg"; then
256 test -d "$dstdir"
263 if test ! -f "$src" && test ! -d "$src"; then
268 if test -z "$dst_arg"; then
276 if test -d "$dst"; then
286 test -d "$dstdir"
297 # This is like FreeBSD 'install' as of 1997-10-28.
304 *[0-7])
306 - $umask % 100 % 40 + $umask % 20 \
307 - $umask % 10 % 4 + $umask % 2
309 *) mkdir_umask=$umask,go-w;;
312 # With -d, create the new directory with the user-specified mode.
314 if test -n "$dir_arg"; then
315 mkdir_mode=-m$mode
322 *[123567][0-7][0-7])
323 # POSIX mkdir -p sets u+wx bits regardless of umask, which
327 tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
331 exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
333 if test -z "$dir_arg" || {
334 # Check for POSIX incompatibilities with -m.
335 # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
336 # other-writable bit of parent directory when it shouldn't.
337 # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
338 ls_ld_tmpdir=`ls -ld "$tmpdir"`
340 d????-?r-*) different_mode=700;;
341 d????-?--*) different_mode=755;;
344 $mkdirprog -m$different_mode -p -- "$tmpdir" && {
345 ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
354 rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
363 $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
374 [-=\(\)!]*) prefix='./';;
380 set -f
393 if test -d "$prefix"; then
398 $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
400 test -d "$prefix" || exit 1
412 if test -n "$prefixes"; then
416 test -d "$dstdir" || exit 1
422 if test -n "$dir_arg"; then
423 { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
424 { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
426 test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
434 trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
439 # and set any options; do chmod last to preserve setuid bits.
445 { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
446 { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
447 { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
448 { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
450 # If -C, don't bother to copy if it wouldn't change the file.
452 old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
453 new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
454 set -f &&
461 rm -f "$dsttmp"
464 $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
468 # support -f.
476 test ! -f "$dst" ||
477 $doit $rmcmd -f "$dst" 2>/dev/null ||
478 { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
479 { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
496 # eval: (add-hook 'write-file-hooks 'time-stamp)
497 # time-stamp-start: "scriptversion="
498 # time-stamp-format: "%:y-%02m-%02d.%02H"
499 # time-stamp-time-zone: "UTC"
500 # time-stamp-end: "; # UTC"