svn commit: r218940 - in head: tools usr.bin/xinstall
Ulrich Spoerlein
uqs at FreeBSD.org
Tue Feb 22 08:07:17 UTC 2011
Author: uqs
Date: Tue Feb 22 08:07:17 2011
New Revision: 218940
URL: http://svn.freebsd.org/changeset/base/218940
Log:
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
Modified:
head/tools/install.sh
head/usr.bin/xinstall/xinstall.c
Modified: head/tools/install.sh
==============================================================================
--- head/tools/install.sh Tue Feb 22 07:49:51 2011 (r218939)
+++ head/tools/install.sh Tue Feb 22 08:07:17 2011 (r218940)
@@ -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
Modified: head/usr.bin/xinstall/xinstall.c
==============================================================================
--- head/usr.bin/xinstall/xinstall.c Tue Feb 22 07:49:51 2011 (r218939)
+++ head/usr.bin/xinstall/xinstall.c Tue Feb 22 08:07:17 2011 (r218940)
@@ -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);
More information about the svn-src-head
mailing list