kopia lustrzana https://gitlab.com/sane-project/backends
Added -o and -g options for changing the owner and group of an
installed directory.merge-requests/1/head
rodzic
a6e5ee4063
commit
a83b7c1742
|
@ -8,9 +8,15 @@
|
||||||
|
|
||||||
errstatus=0
|
errstatus=0
|
||||||
dirmode=""
|
dirmode=""
|
||||||
|
owner=""
|
||||||
|
group=""
|
||||||
|
|
||||||
|
chmodprog="${CHMODPROG-chmod}"
|
||||||
|
chownprog="${CHOWNPROG-chown}"
|
||||||
|
chgrpprog="${CHOWNPROG-chgrp}"
|
||||||
|
|
||||||
usage="\
|
usage="\
|
||||||
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
|
Usage: mkinstalldirs [-h] [--help] [-m mode] [-o owner] [-g group] dir ..."
|
||||||
|
|
||||||
# process command line arguments
|
# process command line arguments
|
||||||
while test $# -gt 0 ; do
|
while test $# -gt 0 ; do
|
||||||
|
@ -22,6 +28,16 @@ while test $# -gt 0 ; do
|
||||||
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
|
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
|
||||||
dirmode="${1}"
|
dirmode="${1}"
|
||||||
shift ;;
|
shift ;;
|
||||||
|
-o ) # -o OWNER arg
|
||||||
|
shift
|
||||||
|
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
|
||||||
|
owner="${1}"
|
||||||
|
shift ;;
|
||||||
|
-g ) # -g OWNER arg
|
||||||
|
shift
|
||||||
|
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
|
||||||
|
group="${1}"
|
||||||
|
shift ;;
|
||||||
-- ) shift; break ;; # stop option processing
|
-- ) shift; break ;; # stop option processing
|
||||||
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
|
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
|
||||||
* ) break ;; # first non-opt arg
|
* ) break ;; # first non-opt arg
|
||||||
|
@ -50,10 +66,30 @@ do
|
||||||
errstatus=$lasterr
|
errstatus=$lasterr
|
||||||
else
|
else
|
||||||
if test ! -z "$dirmode"; then
|
if test ! -z "$dirmode"; then
|
||||||
echo "chmod $dirmode $pathcomp"
|
echo "$chmodprog $dirmode $pathcomp"
|
||||||
|
|
||||||
lasterr=""
|
lasterr=""
|
||||||
chmod $dirmode "$pathcomp" || lasterr=$?
|
$chmodprog $dirmode "$pathcomp" || lasterr=$?
|
||||||
|
|
||||||
|
if test ! -z "$lasterr"; then
|
||||||
|
errstatus=$lasterr
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test ! -z "$owner"; then
|
||||||
|
echo "$chownprog $owner $pathcomp"
|
||||||
|
|
||||||
|
lasterr=""
|
||||||
|
$chownprog $owner "$pathcomp" || lasterr=$?
|
||||||
|
|
||||||
|
if test ! -z "$lasterr"; then
|
||||||
|
errstatus=$lasterr
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test ! -z "$group"; then
|
||||||
|
echo "$chgrpprog $group $pathcomp"
|
||||||
|
|
||||||
|
lasterr=""
|
||||||
|
$chgrpprog $group "$pathcomp" || lasterr=$?
|
||||||
|
|
||||||
if test ! -z "$lasterr"; then
|
if test ! -z "$lasterr"; then
|
||||||
errstatus=$lasterr
|
errstatus=$lasterr
|
||||||
|
|
Ładowanie…
Reference in New Issue