author | wenzelm |
Wed, 14 Feb 2001 23:43:55 +0100 | |
changeset 11127 | e43723fff70c |
parent 11125 | b70c3c1b499f |
child 11550 | 915c5de6480f |
permissions | -rwxr-xr-x |
10555 | 1 |
#!/usr/bin/env bash |
5362
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$ |
9788 | 4 |
# Author: Markus Wenzel, TU Muenchen |
5 |
# License: GPL (GNU GENERAL PUBLIC LICENSE) |
|
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
6 |
# |
6417 | 7 |
# DESCRIPTION: install standalone Isabelle executables |
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
8 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
9 |
|
9788 | 10 |
PRG=$(basename "$0") |
5362
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 |
function usage() |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
13 |
{ |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
14 |
echo |
6417 | 15 |
echo "Usage: $PRG [OPTIONS]" |
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
16 |
echo |
5403 | 17 |
echo " Options are:" |
7887 | 18 |
echo " -d DISTDIR refer to DISTDIR as Isabelle distribution" |
19 |
echo " (default ISABELLE_HOME)" |
|
11125 | 20 |
echo " -k VERSION install KDE application icon on desktop" |
21 |
echo " (for KDE VERSION 1 or 2)" |
|
6417 | 22 |
echo " -p DIR install standalone binaries in DIR" |
5403 | 23 |
echo |
6417 | 24 |
echo " Install Isabelle executables with absolute references to the current" |
25 |
echo " distribution directory." |
|
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
26 |
echo |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
27 |
exit 1 |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
28 |
} |
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 |
function fail() |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
31 |
{ |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
32 |
echo "$1" >&2 |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
33 |
exit 2 |
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 |
|
5403 | 37 |
## process command line |
38 |
||
39 |
# options |
|
40 |
||
6450 | 41 |
NO_OPTS=true |
42 |
||
5403 | 43 |
DISTDIR="$ISABELLE_HOME" |
6417 | 44 |
KDE="" |
45 |
BINDIR="" |
|
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
46 |
|
11125 | 47 |
while getopts "d:k:p:" OPT |
5403 | 48 |
do |
49 |
case "$OPT" in |
|
5404 | 50 |
d) |
5403 | 51 |
DISTDIR="$OPTARG" |
6450 | 52 |
NO_OPTS="" |
5403 | 53 |
;; |
6417 | 54 |
k) |
11125 | 55 |
KDE="$OPTARG" |
6450 | 56 |
NO_OPTS="" |
6417 | 57 |
;; |
58 |
p) |
|
59 |
BINDIR="$OPTARG" |
|
6450 | 60 |
NO_OPTS="" |
6417 | 61 |
;; |
5403 | 62 |
\?) |
63 |
usage |
|
64 |
;; |
|
65 |
esac |
|
66 |
done |
|
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
67 |
|
5403 | 68 |
shift $(($OPTIND - 1)) |
69 |
||
70 |
||
71 |
# args |
|
72 |
||
9788 | 73 |
[ "$#" -ne 0 -o -n "$NO_OPTS" ] && usage |
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
74 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
75 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
76 |
## main |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
77 |
|
6459 | 78 |
echo "referring to distribution at $DISTDIR" |
6417 | 79 |
|
80 |
||
81 |
# standalone binaries |
|
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
82 |
|
6082 | 83 |
#set by configure |
10555 | 84 |
AUTO_BASH=bash |
85 |
||
86 |
case "$AUTO_BASH" in |
|
87 |
/*) |
|
88 |
BASH="$AUTO_BASH" |
|
89 |
;; |
|
90 |
*) |
|
91 |
BASH="/usr/bin/env bash" |
|
92 |
;; |
|
93 |
esac |
|
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
94 |
|
6417 | 95 |
if [ -n "$BINDIR" ]; then |
96 |
mkdir -p "$BINDIR" || fail "Bad directory: $BINDIR" |
|
97 |
||
98 |
for NAME in isatool isabelle Isabelle |
|
99 |
do |
|
100 |
BIN="$BINDIR/$NAME" |
|
101 |
DIST="$DISTDIR/bin/$NAME" |
|
102 |
echo "installing $BIN" |
|
10555 | 103 |
echo "#!$BASH" > "$BIN" || fail "Cannot write file: $BIN" |
9788 | 104 |
echo >> "$BIN" |
105 |
echo "exec \"$DIST\" \"\$@\"" >> "$BIN" |
|
106 |
chmod +x "$BIN" |
|
6417 | 107 |
done |
108 |
fi |
|
109 |
||
110 |
||
11125 | 111 |
# install KDE 1.x / 2.x application icon |
5403 | 112 |
|
11125 | 113 |
if [ -n "$KDE" ]; then |
114 |
if [ "$KDE" = 1 ]; then |
|
115 |
KDEHOME=~/.kde |
|
116 |
KDEDESKTOP=~/Desktop |
|
117 |
KDEAPP="$KDEDESKTOP/Isabelle.kdelnk" |
|
118 |
elif [ "$KDE" = 2 ]; then |
|
119 |
KDEHOME=~/.kde2 |
|
120 |
KDEDESKTOP=~/KDesktop |
|
121 |
KDEAPP="$KDEDESKTOP/Isabelle.desktop" |
|
122 |
else |
|
123 |
fail "Unknown KDE version \"$KDE\"" |
|
124 |
fi |
|
11127 | 125 |
mkdir -p "$KDEDESKTOP" || fail "Bad directory: $KDEDESKTOP" |
6417 | 126 |
|
11125 | 127 |
KDEICONS="$KDEHOME/share/icons" |
9788 | 128 |
mkdir -p "$KDEICONS" || fail "Bad directory: $KDEICONS" |
129 |
mkdir -p "$KDEICONS/mini" || fail "Bad directory: $KDEICONS/mini" |
|
6417 | 130 |
|
9788 | 131 |
[ -f "$KDEICONS/isabelle.xpm" ] || cp "$ISABELLE_HOME/lib/icons/isabelle.xpm" "$KDEICONS" || \ |
6545 | 132 |
fail "Cannot write file: $KDEICONS/isabelle.xpm" |
9788 | 133 |
[ -f "$KDEICONS/mini/isabelle.xpm" ] || \ |
134 |
cp "$ISABELLE_HOME/lib/icons/isabelle-mini.xpm" "$KDEICONS/mini/isabelle.xpm" || \ |
|
6545 | 135 |
fail "Cannot write file: $KDEICONS/mini/isabelle.xpm" |
6417 | 136 |
|
137 |
echo "installing $KDEAPP" |
|
9788 | 138 |
echo "# KDE Config File" > "$KDEAPP" || fail "Cannot write file: $KDEAPP" |
139 |
echo "[KDE Desktop Entry]" >> "$KDEAPP" |
|
140 |
echo "Type=Application" >> "$KDEAPP" |
|
10504 | 141 |
echo "Exec=\"$DISTDIR/bin/Isabelle\" %f" >> "$KDEAPP" |
9788 | 142 |
echo "Icon=isabelle.xpm" >> "$KDEAPP" |
143 |
echo "TerminalOptions=" >> "$KDEAPP" |
|
144 |
echo "Path=" >> "$KDEAPP" |
|
145 |
echo "Terminal=0" >> "$KDEAPP" |
|
146 |
echo "Name=Isabelle" >> "$KDEAPP" |
|
6417 | 147 |
fi |