From b75e69e22942dd18965251894121c908f48b26ac Mon Sep 17 00:00:00 2001 From: gord-fig Date: Wed, 26 Sep 2001 20:52:14 +0000 Subject: [PATCH] Add scripts/mass_install to simplify installation rules. --- lustre/scripts/mass_install | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 lustre/scripts/mass_install diff --git a/lustre/scripts/mass_install b/lustre/scripts/mass_install new file mode 100755 index 0000000..d5275f1 --- /dev/null +++ b/lustre/scripts/mass_install @@ -0,0 +1,47 @@ +#! /bin/sh +# mass_install - Install zero or more files in a directory +# Gordon Matzigkeit , 2001-09-26 + +# Usage: mass_install DIR [FILES...] [OPTS...] +FILES= +DIR= +OPTS= + +for arg +do + if test -n "$OPTS"; then + # Everything from here is an option. + OPTS="$OPTS $arg" + else + case "$arg" in + # We found the first option. + -*) OPTS="$arg" ;; + *) + if test -z "$DIR"; then + # We don't have a directory yet. + DIR="$arg" + else + # We have no files. + FILES="$FILES $arg" + fi + ;; + esac + fi +done + +if test -n "$DIR" && test -n "$FILES"; then + # Make sure the directory exists. + if test ! -d "$DIR"; then + cmd="mkdir -p $DIR" + $cmd || exit $? + fi + + # Run the installer. + for f in $FILES; do + base=`echo "$f" | sed -e 'sX.*/XX'` + cmd="install $OPTS $f $DIR/$base" + echo "$cmd" + $cmd || exit $? + done +fi +exit 0 -- 1.8.3.1