lib/Tools/install
author wenzelm
Tue Apr 13 12:36:11 1999 +0200 (1999-04-13)
changeset 6417 39941b906910
parent 6082 590f9e3bf4d8
child 6450 990e6e2dee26
permissions -rwxr-xr-x
-p option;
-k option;
     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 DISTDIR="$ISABELLE_HOME"
    38 KDE=""
    39 BINDIR=""
    40 
    41 while getopts "d:kp:" OPT
    42 do
    43   case "$OPT" in
    44     d)
    45       DISTDIR="$OPTARG"
    46       ;;
    47     k)
    48       KDE=true
    49       ;;
    50     p)
    51       BINDIR="$OPTARG"
    52       ;;
    53     \?)
    54       usage
    55       ;;
    56   esac
    57 done
    58 
    59 shift $(($OPTIND - 1))
    60 
    61 
    62 # args
    63 
    64 [ $# -ne 0 ] && usage
    65 
    66 
    67 ## main
    68 
    69 echo "distribution at $DISTDIR"
    70 
    71 
    72 # standalone binaries
    73 
    74 #set by configure
    75 AUTO_BASH=/bin/bash
    76 
    77 if [ -n "$BINDIR" ]; then
    78   mkdir -p "$BINDIR" || fail "Bad directory: $BINDIR"
    79 
    80   for NAME in isatool isabelle Isabelle
    81   do
    82     BIN="$BINDIR/$NAME"
    83     DIST="$DISTDIR/bin/$NAME"
    84     echo "installing $BIN"
    85     echo "#!$AUTO_BASH" >$BIN || fail "Cannot write file: $BIN"
    86     echo >>$BIN
    87     echo "exec $DIST \"\$@\"" >>$BIN
    88     chmod +x $BIN
    89   done
    90 fi
    91 
    92 
    93 # install KDE application icon
    94 
    95 KDEHOME=~/.kde
    96 KDEAPP=~/Desktop/Isabelle.kdelnk
    97 
    98 if [ "$KDE" = true ]; then
    99   mkdir -p $KDEHOME/share/icons || fail "Bad directory: $KDEHOME/share/icons"
   100 
   101   ICON=$KDEHOME/share/icons/isabelle.xpm
   102   [ -f $ICON ] || cp $DISTDIR/lib/logo/isabelle-tiny.xpm $ICON || fail "Cannot write file: $ICON"
   103 
   104   echo "installing $KDEAPP"
   105   echo "# KDE Config File" >$KDEAPP || fail "Cannot write file: $KDEAPP"
   106   echo "[KDE Desktop Entry]" >>$KDEAPP
   107   echo "Type=Application" >>$KDEAPP
   108   echo "Exec=$DISTDIR/bin/Isabelle" >>$KDEAPP
   109   echo "Icon=isabelle.xpm" >>$KDEAPP
   110   echo "TerminalOptions=" >>$KDEAPP
   111   echo "Path=" >>$KDEAPP
   112   echo "Terminal=0" >>$KDEAPP
   113   echo "Name=Isabelle" >>$KDEAPP
   114 
   115   type -p kfmclient >/dev/null && kfmclient refreshDesktop
   116 fi