install binaries with absolute references to ISABELLE_HOME/bin;
authorwenzelm
Mon, 24 Aug 1998 15:49:53 +0200
changeset 5362 29ce4f1fe72c
parent 5361 1c6f72351075
child 5363 0cf15843b82f
install binaries with absolute references to ISABELLE_HOME/bin;
lib/Tools/install
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/Tools/install	Mon Aug 24 15:49:53 1998 +0200
@@ -0,0 +1,53 @@
+#!/bin/bash
+#
+# $Id$
+#
+# DESCRIPTION: install binaries with absolute references to ISABELLE_HOME/bin
+
+
+PRG=$(basename $0)
+
+function usage()
+{
+  echo
+  echo "Usage: $PRG DIR"
+  echo
+  echo "  Install binaries in directory DIR with absolute references to"
+  echo "  $ISABELLE_HOME/bin (non-movable)."
+  echo
+  exit 1
+}
+
+function fail()
+{
+  echo "$1" >&2
+  exit 2
+}
+
+
+## args
+
+DIR=""
+[ $# -ge 1 ] && { DIR="$1"; shift; }
+
+[ $# -ne 0 -o -z "$DIR" -o "$DIR" = "-?" ] && usage
+
+
+## main
+
+[ ! -d "$DIR" ] && fail "Bad directory: $DIR"
+
+BASH=$(type -path bash)
+[ -z "$BASH" ] && fail "Cannot find bash!"
+
+for BIN in $ISABELLE_HOME/bin/*
+do
+  if [ -f "$BIN" -a -x "$BIN" ]; then
+    B=$DIR/$(basename $BIN)
+    echo "install $B"
+    echo "#!$BASH" >$B || fail "Cannot write file: $B"
+    echo >>$B
+    echo "$BIN \"\$@\"" >>$B
+    chmod +x $B
+  fi
+done