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