| author | wenzelm | 
| Fri, 01 Sep 2000 17:50:36 +0200 | |
| changeset 9788 | df671fa2562a | 
| parent 7934 | 42836b6c4c73 | 
| child 10030 | 950580516dfa | 
| 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$ | 
| 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)" | |
| 6417 | 20 | echo " -k install KDE application icon on Desktop" | 
| 21 | echo " -p DIR install standalone binaries in DIR" | |
| 5403 | 22 | echo | 
| 6417 | 23 | echo " Install Isabelle executables with absolute references to the current" | 
| 24 | echo " distribution directory." | |
| 5362 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 25 | echo | 
| 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 26 | exit 1 | 
| 
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 | |
| 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 29 | function fail() | 
| 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 30 | {
 | 
| 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 31 | echo "$1" >&2 | 
| 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 32 | exit 2 | 
| 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 33 | } | 
| 
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 | |
| 5403 | 36 | ## process command line | 
| 37 | ||
| 38 | # options | |
| 39 | ||
| 6450 | 40 | NO_OPTS=true | 
| 41 | ||
| 5403 | 42 | DISTDIR="$ISABELLE_HOME" | 
| 6417 | 43 | KDE="" | 
| 44 | BINDIR="" | |
| 5362 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 45 | |
| 6417 | 46 | while getopts "d:kp:" OPT | 
| 5403 | 47 | do | 
| 48 | case "$OPT" in | |
| 5404 | 49 | d) | 
| 5403 | 50 | DISTDIR="$OPTARG" | 
| 6450 | 51 | NO_OPTS="" | 
| 5403 | 52 | ;; | 
| 6417 | 53 | k) | 
| 54 | KDE=true | |
| 6450 | 55 | NO_OPTS="" | 
| 6417 | 56 | ;; | 
| 57 | p) | |
| 58 | BINDIR="$OPTARG" | |
| 6450 | 59 | NO_OPTS="" | 
| 6417 | 60 | ;; | 
| 5403 | 61 | \?) | 
| 62 | usage | |
| 63 | ;; | |
| 64 | esac | |
| 65 | done | |
| 5362 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 66 | |
| 5403 | 67 | shift $(($OPTIND - 1)) | 
| 68 | ||
| 69 | ||
| 70 | # args | |
| 71 | ||
| 9788 | 72 | [ "$#" -ne 0 -o -n "$NO_OPTS" ] && usage | 
| 5362 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 73 | |
| 
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 | ## main | 
| 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 76 | |
| 6459 | 77 | echo "referring to distribution at $DISTDIR" | 
| 6417 | 78 | |
| 79 | ||
| 80 | # standalone binaries | |
| 5362 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 81 | |
| 6082 | 82 | #set by configure | 
| 83 | AUTO_BASH=/bin/bash | |
| 5362 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 84 | |
| 6417 | 85 | if [ -n "$BINDIR" ]; then | 
| 86 | mkdir -p "$BINDIR" || fail "Bad directory: $BINDIR" | |
| 87 | ||
| 88 | for NAME in isatool isabelle Isabelle | |
| 89 | do | |
| 90 | BIN="$BINDIR/$NAME" | |
| 91 | DIST="$DISTDIR/bin/$NAME" | |
| 92 | echo "installing $BIN" | |
| 9788 | 93 | echo "#!$AUTO_BASH" > "$BIN" || fail "Cannot write file: $BIN" | 
| 94 | echo >> "$BIN" | |
| 95 | echo "exec \"$DIST\" \"\$@\"" >> "$BIN" | |
| 96 | chmod +x "$BIN" | |
| 6417 | 97 | done | 
| 98 | fi | |
| 99 | ||
| 100 | ||
| 101 | # install KDE application icon | |
| 5403 | 102 | |
| 6417 | 103 | KDEHOME=~/.kde | 
| 104 | KDEAPP=~/Desktop/Isabelle.kdelnk | |
| 9788 | 105 | KDEICONS="$KDEHOME/share/icons" | 
| 6417 | 106 | |
| 107 | if [ "$KDE" = true ]; then | |
| 9788 | 108 | mkdir -p "$KDEICONS" || fail "Bad directory: $KDEICONS" | 
| 109 | mkdir -p "$KDEICONS/mini" || fail "Bad directory: $KDEICONS/mini" | |
| 6417 | 110 | |
| 9788 | 111 | [ -f "$KDEICONS/isabelle.xpm" ] || cp "$ISABELLE_HOME/lib/icons/isabelle.xpm" "$KDEICONS" || \ | 
| 6545 | 112 | fail "Cannot write file: $KDEICONS/isabelle.xpm" | 
| 9788 | 113 | [ -f "$KDEICONS/mini/isabelle.xpm" ] || \ | 
| 114 | cp "$ISABELLE_HOME/lib/icons/isabelle-mini.xpm" "$KDEICONS/mini/isabelle.xpm" || \ | |
| 6545 | 115 | fail "Cannot write file: $KDEICONS/mini/isabelle.xpm" | 
| 6417 | 116 | |
| 117 | echo "installing $KDEAPP" | |
| 9788 | 118 | echo "# KDE Config File" > "$KDEAPP" || fail "Cannot write file: $KDEAPP" | 
| 119 | echo "[KDE Desktop Entry]" >> "$KDEAPP" | |
| 120 | echo "Type=Application" >> "$KDEAPP" | |
| 121 | echo "Exec=$DISTDIR/bin/Isabelle %f" >> "$KDEAPP" | |
| 122 | echo "Icon=isabelle.xpm" >> "$KDEAPP" | |
| 123 | echo "TerminalOptions=" >> "$KDEAPP" | |
| 124 | echo "Path=" >> "$KDEAPP" | |
| 125 | echo "Terminal=0" >> "$KDEAPP" | |
| 126 | echo "Name=Isabelle" >> "$KDEAPP" | |
| 6417 | 127 | |
| 9788 | 128 | echo "Please refresh your KDE now!" | 
| 6417 | 129 | fi |