From 94b9a51dd43d85267e7bff38323258054c7a6c4d Mon Sep 17 00:00:00 2001 From: brooks Date: Fri, 15 Mar 2013 15:21:34 +0000 Subject: [PATCH] MFC r245751,245893: r245751: Implement the -l option using ln(1) to facilitate boostrapping. Ignore the new options -D, -h, -T, and -U. Adjust -M support to ignore an argument. Sponsored by: DARPA, AFRL Reviewed by: ian, ray, rpaulo r245893: Use = not == in test arguments. Submitted by: Christoph Mallon git-svn-id: svn://svn.freebsd.org/base/stable/9@248332 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- tools/install.sh | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index 489424f93..c28bd89ef 100644 --- a/tools/install.sh +++ b/tools/install.sh @@ -30,12 +30,22 @@ # parse install's options and ignore them completely. dirmode="" +linkmode="" while [ $# -gt 0 ]; do case $1 in -d) dirmode="YES"; shift;; - -[bCcMpSsv]) shift;; - -[Bfgmo]) shift; shift;; - -[Bfgmo]*) shift;; + -[bCcpSsv]) shift;; + -[BDfghMmNoTU]) shift; shift;; + -[BDfghMmNoTU]*) shift;; + -l) + shift + case $1 in + *[sm]*) linkmode="symbolic";; # XXX: 'm' should prefer hard + *h*) linkmode="hard";; + *) echo "invalid link mode"; exit 1;; + esac + shift + ;; *) break; esac done @@ -51,7 +61,13 @@ if [ -z "$dirmode" ] && [ "$#" -lt 2 ]; then fi # the remaining arguments are assumed to be files/dirs only. -if [ -z "$dirmode" ]; then +if [ -n "${linkmode}" ]; then + if [ "${linkmode}" = "symbolic" ]; then + ln -fsh "$@" + else + ln -f "$@" + fi +elif [ -z "$dirmode" ]; then exec install -p "$@" else exec install -d "$@" -- 2.45.0