Teach tools/install.sh the -d directory mode.

Sync up with flags understood by install(1) [1], and make install(1)'s
usage output not hide the clearly documented -M flag.

PR:		misc/154739 [1]
Submitted by:	arundel
This commit is contained in:
uqs 2011-02-22 08:07:17 +00:00
parent 33cfbb02c4
commit 39bd167d32
2 changed files with 20 additions and 4 deletions

View File

@ -29,14 +29,30 @@
# $FreeBSD$
# parse install's options and ignore them completely.
dirmode=""
while [ $# -gt 0 ]; do
case $1 in
-[bCcMpSs]) shift;;
-d) dirmode="YES"; shift;;
-[bCcMpSsv]) shift;;
-[Bfgmo]) shift; shift;;
-[Bfgmo]*) shift;;
*) break;
esac
done
if [ "$#" -eq 0 ]; then
echo "$0: no files/dirs specified" >&2
exit 1
fi
if [ -z "$dirmode" ] && [ "$#" -lt 2 ]; then
echo "$0: no target specified" >&2
exit 1
fi
# the remaining arguments are assumed to be files/dirs only.
exec install -p $*
if [ -z "$dirmode" ]; then
exec install -p "$@"
else
exec install -d "$@"
fi

View File

@ -769,9 +769,9 @@ static void
usage(void)
{
(void)fprintf(stderr,
"usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]\n"
"usage: install [-bCcMpSsv] [-B suffix] [-f flags] [-g group] [-m mode]\n"
" [-o owner] file1 file2\n"
" install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]\n"
" install [-bCcMpSsv] [-B suffix] [-f flags] [-g group] [-m mode]\n"
" [-o owner] file1 ... fileN directory\n"
" install -d [-v] [-g group] [-m mode] [-o owner] directory ...\n");
exit(EX_USAGE);