Lines Matching +full:s +full:- +full:mode

4 #	install.sh - portable version of install(1)
7 # install [-CNcs] [-f flags] [-i errs] [-o owner] [-g group] [-m mode] file1 file2 ...
8 # install -d [-i errs] [-o owner] [-g group] [-m mode] directory ...
11 # Compatible with BSD install(1). Except that '-c' is always
14 # versions have a '-b' option for this.
18 # -b move previous target file aside (always true).
20 # -B "suffix"
23 # -c copy rather than move the file into place (always true).
25 # -C compare. Only install if target is missing or
28 # -N newer. Only install if target is missing or older.
30 # -s strip target
32 # -o "owner"
35 # -g "group"
38 # -m "mode"
39 # set permissions to "mode"
41 # -f "flags"
44 # -i "errs"
45 # Ignore errors from steps indicated by "errs" (``s,o,g,m'').
48 # The '-i' option is to save your sanity when 'bsd.prog.mk'
49 # insists on haveing a '-o' "owner" option which is doomed to
50 # fail on many systems. We ignore '-b' and '-c' options.
56 # SPDX-License-Identifier: BSD-2-Clause
59 # $Id: install-sh,v 1.26 2024/02/17 17:26:57 sjg Exp $
61 # @(#) Copyright (c) 1993-2023 Simon J. Gerraty
70 # Please send copies of changes and bug-fixes to:
74 set -- `getopt B:bpxCNcsdo:g:m:i:f: $*`
77 [ -s $Mydir/.installrc ] && . $Mydir/.installrc
82 mode=:
83 MODE=0
95 --) shift; break;;
96 -[bc]) ;; # ignore
97 -p) CP_p=-p;;
98 -x) set -x;;
99 -B) OLD_EXT=$2; shift;;
100 -C) compare=Different;;
101 -N) newer=Newer;
102 # check if /bin/ls supports -1
103 'ls' -1 $0 > /dev/null 2>&1 && LS_1=1
105 -o) owner="${CHOWN:-chown} $2 "; shift;;
106 -g) group="${CHGRP:-chgrp} $2 "; shift;;
107 -m) MODE=$2 mode="${CHMOD:-chmod} $2 "; shift;;
108 -s) strip=${STRIP:-strip};;
109 -d) mkdirs="mkdir -p";;
110 -i) ignore_err="$ignore_err$2"; shift;;
111 -f) chflags="${CHFLAGS:-chflags} $2 "; shift;;
118 n=`'ls' -t$LS_1 $* 2> /dev/null | head -1`
123 cmp -s $*
136 if [ ! -d $1 ]; then
137 $strip $1 || Err s
141 $mode $1 || Err m
146 # a bug in HP-UX's /bin/sh, means we need to re-set $*
151 test -d $1 || return
170 set -- $args
173 # and ensure mode etc are as desired
175 case "$MODE" in
176 [1-7]*)
178 case "$MODE" in
179 ????*) MODE=`echo $MODE | sed 's,.*\(...\)$,\1,'`;;
181 umask `expr 0777 - 0$MODE |
182 sed 's,^,000,;s,^.*\(...\)$,\1,'`;;
186 [ ! -d $d ] && $mkdirs $d
189 exit 0 # that's all we do
193 if [ $# -eq 1 ]; then
200 while [ $# -gt 1 ]
210 if [ "$dest_dir" = yes -a ! -d $dest ]; then
218 if [ -d $dest ]; then
225 [ -f $t ] && { mv -f $t $t$OLD_EXT || exit 1; }