mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-03 15:55:40 +00:00
Just ignore the -c option, it is the default
Add support for -d option
This commit is contained in:
50
install-sh
50
install-sh
@@ -49,7 +49,7 @@ CHMODIT=false
|
|||||||
STRIPIT=false
|
STRIPIT=false
|
||||||
BACKIT=false
|
BACKIT=false
|
||||||
TOUCHIT=true
|
TOUCHIT=true
|
||||||
SAVESRC=false
|
DIRMODE=false
|
||||||
|
|
||||||
case `${WHOAMI}` in
|
case `${WHOAMI}` in
|
||||||
root)
|
root)
|
||||||
@@ -74,7 +74,10 @@ while ${MORETODO} ; do
|
|||||||
BACKUP=`expr "$1" : '-b\(.*\)'`
|
BACKUP=`expr "$1" : '-b\(.*\)'`
|
||||||
;;
|
;;
|
||||||
X-c)
|
X-c)
|
||||||
SAVESRC=true
|
# backwards compatibility
|
||||||
|
;;
|
||||||
|
X-d)
|
||||||
|
DIRMODE=true
|
||||||
;;
|
;;
|
||||||
X-g)
|
X-g)
|
||||||
GROUP="$2"
|
GROUP="$2"
|
||||||
@@ -155,31 +158,33 @@ while ${MORETODO} ; do
|
|||||||
${MORETODO} && shift
|
${MORETODO} && shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
## Making a directory?
|
||||||
|
if ${DIRMODE} ; then
|
||||||
|
while test $# != 0; do
|
||||||
|
DEST="$1"
|
||||||
|
if [ ! -d "${DEST}" ] ; then
|
||||||
|
${MKDIR} "${DEST}" || exit 1
|
||||||
|
fi
|
||||||
|
if ${CHOWNIT} ; then
|
||||||
|
${CHOWN} "${OWNER}" "${DEST}" || exit 1
|
||||||
|
fi
|
||||||
|
if ${CHGROUPIT} ; then
|
||||||
|
${CHGRP} "${GROUP}" "${DEST}" || exit 1
|
||||||
|
fi
|
||||||
|
if ${CHMODIT} ; then
|
||||||
|
${CHMOD} "${MODE}" "${DEST}" || exit 1
|
||||||
|
fi
|
||||||
|
shift;
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
## Process arguments.
|
## Process arguments.
|
||||||
if [ $# -ne 2 ] ; then
|
if [ $# -ne 2 ] ; then
|
||||||
echo "Usage: ${PROGNAME} [flags] source destination"
|
echo "Usage: ${PROGNAME} [flags] source destination"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Making a directory?
|
|
||||||
if [ X"$1" = X. ] ; then
|
|
||||||
DEST="$2"
|
|
||||||
if [ ! -d "${DEST}" ] ; then
|
|
||||||
${MKDIR} "${DEST}" || exit 1
|
|
||||||
fi
|
|
||||||
if ${CHOWNIT} ; then
|
|
||||||
${CHOWN} "${OWNER}" "${DEST}" || exit 1
|
|
||||||
fi
|
|
||||||
if ${CHGROUPIT} ; then
|
|
||||||
${CHGRP} "${GROUP}" "${DEST}" || exit 1
|
|
||||||
fi
|
|
||||||
if ${CHMODIT} ; then
|
|
||||||
umask 0
|
|
||||||
${CHMOD} "${MODE}" "${DEST}" || exit 1
|
|
||||||
fi
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Get the destination and a temp file in the destination diretory.
|
## Get the destination and a temp file in the destination diretory.
|
||||||
if [ -d "$2" ] ; then
|
if [ -d "$2" ] ; then
|
||||||
DEST="$2/`basename $1`"
|
DEST="$2/`basename $1`"
|
||||||
@@ -190,7 +195,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
## If not given the same name, we must try to copy.
|
## If not given the same name, we must try to copy.
|
||||||
if [ X"$1" != X"$2" -o $SAVESRC ] ; then
|
if [ X"$1" != X"$2" ] ; then
|
||||||
if cmp -s "$1" "${DEST}" ; then
|
if cmp -s "$1" "${DEST}" ; then
|
||||||
## Files are same; touch or not.
|
## Files are same; touch or not.
|
||||||
${TOUCHIT} && touch "${DEST}"
|
${TOUCHIT} && touch "${DEST}"
|
||||||
@@ -221,7 +226,6 @@ if ${CHGROUPIT} ; then
|
|||||||
${CHGRP} "${GROUP}" "${DEST}" || exit 1
|
${CHGRP} "${GROUP}" "${DEST}" || exit 1
|
||||||
fi
|
fi
|
||||||
if ${CHMODIT} ; then
|
if ${CHMODIT} ; then
|
||||||
umask 0
|
|
||||||
${CHMOD} "${MODE}" "${DEST}" || exit 1
|
${CHMOD} "${MODE}" "${DEST}" || exit 1
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
Reference in New Issue
Block a user