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