author | wenzelm |
Mon, 24 Aug 1998 15:49:53 +0200 | |
changeset 5362 | 29ce4f1fe72c |
child 5367 | 33f81e980c93 |
permissions | -rwxr-xr-x |
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
1 |
#!/bin/bash |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
2 |
# |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
3 |
# $Id$ |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
4 |
# |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
5 |
# DESCRIPTION: install binaries with absolute references to ISABELLE_HOME/bin |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
6 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
7 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
8 |
PRG=$(basename $0) |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
9 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
10 |
function usage() |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
11 |
{ |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
12 |
echo |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
13 |
echo "Usage: $PRG DIR" |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
14 |
echo |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
15 |
echo " Install binaries in directory DIR with absolute references to" |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
16 |
echo " $ISABELLE_HOME/bin (non-movable)." |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
17 |
echo |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
18 |
exit 1 |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
19 |
} |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
20 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
21 |
function fail() |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
22 |
{ |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
23 |
echo "$1" >&2 |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
24 |
exit 2 |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
25 |
} |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
26 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
27 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
28 |
## args |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
29 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
30 |
DIR="" |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
31 |
[ $# -ge 1 ] && { DIR="$1"; shift; } |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
32 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
33 |
[ $# -ne 0 -o -z "$DIR" -o "$DIR" = "-?" ] && usage |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
34 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
35 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
36 |
## main |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
37 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
38 |
[ ! -d "$DIR" ] && fail "Bad directory: $DIR" |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
39 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
40 |
BASH=$(type -path bash) |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
41 |
[ -z "$BASH" ] && fail "Cannot find bash!" |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
42 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
43 |
for BIN in $ISABELLE_HOME/bin/* |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
44 |
do |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
45 |
if [ -f "$BIN" -a -x "$BIN" ]; then |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
46 |
B=$DIR/$(basename $BIN) |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
47 |
echo "install $B" |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
48 |
echo "#!$BASH" >$B || fail "Cannot write file: $B" |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
49 |
echo >>$B |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
50 |
echo "$BIN \"\$@\"" >>$B |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
51 |
chmod +x $B |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
52 |
fi |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
53 |
done |