Whamcloud - gitweb
Add scripts/mass_install to simplify installation rules.
authorgord-fig <gord-fig>
Wed, 26 Sep 2001 20:52:14 +0000 (20:52 +0000)
committergord-fig <gord-fig>
Wed, 26 Sep 2001 20:52:14 +0000 (20:52 +0000)
lustre/scripts/mass_install [new file with mode: 0755]

diff --git a/lustre/scripts/mass_install b/lustre/scripts/mass_install
new file mode 100755 (executable)
index 0000000..d5275f1
--- /dev/null
@@ -0,0 +1,47 @@
+#! /bin/sh
+# mass_install - Install zero or more files in a directory
+# Gordon Matzigkeit <gord@fig.org>, 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