summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/install.sh20
-rw-r--r--usr.bin/xinstall/xinstall.c4
2 files changed, 20 insertions, 4 deletions
diff --git a/tools/install.sh b/tools/install.sh
index 594d4de..489424f 100644
--- a/tools/install.sh
+++ b/tools/install.sh
@@ -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
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c
index a64fc4d..b1a565c 100644
--- a/usr.bin/xinstall/xinstall.c
+++ b/usr.bin/xinstall/xinstall.c
@@ -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);
OpenPOWER on IntegriCloud