lib/Tools/install
author wenzelm
Wed Oct 20 11:05:38 1999 +0200 (1999-10-20)
changeset 7887 eedfff88ee40
parent 6545 a8a235a8a4a3
child 7934 42836b6c4c73
permissions -rwxr-xr-x
tuned usage;
wenzelm@5362
     1
#!/bin/bash
wenzelm@5362
     2
#
wenzelm@5362
     3
# $Id$
wenzelm@5362
     4
#
wenzelm@6417
     5
# DESCRIPTION: install standalone Isabelle executables
wenzelm@5362
     6
wenzelm@5362
     7
wenzelm@5362
     8
PRG=$(basename $0)
wenzelm@5362
     9
wenzelm@5362
    10
function usage()
wenzelm@5362
    11
{
wenzelm@5362
    12
  echo
wenzelm@6417
    13
  echo "Usage: $PRG [OPTIONS]"
wenzelm@5362
    14
  echo
wenzelm@5403
    15
  echo "  Options are:"
wenzelm@7887
    16
  echo "    -d DISTDIR   refer to DISTDIR as Isabelle distribution"
wenzelm@7887
    17
  echo "                 (default ISABELLE_HOME)"
wenzelm@6417
    18
  echo "    -k           install KDE application icon on Desktop"
wenzelm@6417
    19
  echo "    -p DIR       install standalone binaries in DIR"
wenzelm@5403
    20
  echo
wenzelm@6417
    21
  echo "  Install Isabelle executables with absolute references to the current"
wenzelm@6417
    22
  echo "  distribution directory."
wenzelm@5362
    23
  echo
wenzelm@5362
    24
  exit 1
wenzelm@5362
    25
}
wenzelm@5362
    26
wenzelm@5362
    27
function fail()
wenzelm@5362
    28
{
wenzelm@5362
    29
  echo "$1" >&2
wenzelm@5362
    30
  exit 2
wenzelm@5362
    31
}
wenzelm@5362
    32
wenzelm@5362
    33
wenzelm@5403
    34
## process command line
wenzelm@5403
    35
wenzelm@5403
    36
# options
wenzelm@5403
    37
wenzelm@6450
    38
NO_OPTS=true
wenzelm@6450
    39
wenzelm@5403
    40
DISTDIR="$ISABELLE_HOME"
wenzelm@6417
    41
KDE=""
wenzelm@6417
    42
BINDIR=""
wenzelm@5362
    43
wenzelm@6417
    44
while getopts "d:kp:" OPT
wenzelm@5403
    45
do
wenzelm@5403
    46
  case "$OPT" in
wenzelm@5404
    47
    d)
wenzelm@5403
    48
      DISTDIR="$OPTARG"
wenzelm@6450
    49
      NO_OPTS=""
wenzelm@5403
    50
      ;;
wenzelm@6417
    51
    k)
wenzelm@6417
    52
      KDE=true
wenzelm@6450
    53
      NO_OPTS=""
wenzelm@6417
    54
      ;;
wenzelm@6417
    55
    p)
wenzelm@6417
    56
      BINDIR="$OPTARG"
wenzelm@6450
    57
      NO_OPTS=""
wenzelm@6417
    58
      ;;
wenzelm@5403
    59
    \?)
wenzelm@5403
    60
      usage
wenzelm@5403
    61
      ;;
wenzelm@5403
    62
  esac
wenzelm@5403
    63
done
wenzelm@5362
    64
wenzelm@5403
    65
shift $(($OPTIND - 1))
wenzelm@5403
    66
wenzelm@5403
    67
wenzelm@5403
    68
# args
wenzelm@5403
    69
wenzelm@6450
    70
[ $# -ne 0 -o -n "$NO_OPTS" ] && usage
wenzelm@5362
    71
wenzelm@5362
    72
wenzelm@5362
    73
## main
wenzelm@5362
    74
wenzelm@6459
    75
echo "referring to distribution at $DISTDIR"
wenzelm@6417
    76
wenzelm@6417
    77
wenzelm@6417
    78
# standalone binaries
wenzelm@5362
    79
wenzelm@6082
    80
#set by configure
wenzelm@6082
    81
AUTO_BASH=/bin/bash
wenzelm@5362
    82
wenzelm@6417
    83
if [ -n "$BINDIR" ]; then
wenzelm@6417
    84
  mkdir -p "$BINDIR" || fail "Bad directory: $BINDIR"
wenzelm@6417
    85
wenzelm@6417
    86
  for NAME in isatool isabelle Isabelle
wenzelm@6417
    87
  do
wenzelm@6417
    88
    BIN="$BINDIR/$NAME"
wenzelm@6417
    89
    DIST="$DISTDIR/bin/$NAME"
wenzelm@6417
    90
    echo "installing $BIN"
wenzelm@6417
    91
    echo "#!$AUTO_BASH" >$BIN || fail "Cannot write file: $BIN"
wenzelm@6417
    92
    echo >>$BIN
wenzelm@6417
    93
    echo "exec $DIST \"\$@\"" >>$BIN
wenzelm@6417
    94
    chmod +x $BIN
wenzelm@6417
    95
  done
wenzelm@6417
    96
fi
wenzelm@6417
    97
wenzelm@6417
    98
wenzelm@6417
    99
# install KDE application icon
wenzelm@5403
   100
wenzelm@6417
   101
KDEHOME=~/.kde
wenzelm@6417
   102
KDEAPP=~/Desktop/Isabelle.kdelnk
wenzelm@6545
   103
KDEICONS=$KDEHOME/share/icons
wenzelm@6417
   104
wenzelm@6417
   105
if [ "$KDE" = true ]; then
wenzelm@6545
   106
  mkdir -p $KDEICONS || fail "Bad directory: $KDEICONS"
wenzelm@6545
   107
  mkdir -p $KDEICONS/mini || fail "Bad directory: $KDEICONS/mini"
wenzelm@6417
   108
wenzelm@6545
   109
  [ -f $KDEICONS/isabelle.xpm ] || cp $ISABELLE_HOME/lib/icons/isabelle.xpm $KDEICONS || \
wenzelm@6545
   110
    fail "Cannot write file: $KDEICONS/isabelle.xpm"
wenzelm@6545
   111
  [ -f $KDEICONS/mini/isabelle.xpm ] || \
wenzelm@6545
   112
    cp $ISABELLE_HOME/lib/icons/isabelle-mini.xpm $KDEICONS/mini/isabelle.xpm || \
wenzelm@6545
   113
    fail "Cannot write file: $KDEICONS/mini/isabelle.xpm"
wenzelm@6417
   114
wenzelm@6417
   115
  echo "installing $KDEAPP"
wenzelm@6417
   116
  echo "# KDE Config File" >$KDEAPP || fail "Cannot write file: $KDEAPP"
wenzelm@6417
   117
  echo "[KDE Desktop Entry]" >>$KDEAPP
wenzelm@6417
   118
  echo "Type=Application" >>$KDEAPP
wenzelm@6417
   119
  echo "Exec=$DISTDIR/bin/Isabelle" >>$KDEAPP
wenzelm@6417
   120
  echo "Icon=isabelle.xpm" >>$KDEAPP
wenzelm@6417
   121
  echo "TerminalOptions=" >>$KDEAPP
wenzelm@6417
   122
  echo "Path=" >>$KDEAPP
wenzelm@6417
   123
  echo "Terminal=0" >>$KDEAPP
wenzelm@6417
   124
  echo "Name=Isabelle" >>$KDEAPP
wenzelm@6417
   125
wenzelm@6417
   126
  type -p kfmclient >/dev/null && kfmclient refreshDesktop
wenzelm@6417
   127
fi