lib/Tools/install
author wenzelm
Thu Nov 30 20:10:29 2000 +0100 (2000-11-30)
changeset 10555 2323ec838401
parent 10504 d7f5607fbadf
child 11125 b70c3c1b499f
permissions -rwxr-xr-x
/usr/bin/env bash;
     1 #!/usr/bin/env bash
     2 #
     3 # $Id$
     4 # Author: Markus Wenzel, TU Muenchen
     5 # License: GPL (GNU GENERAL PUBLIC LICENSE)
     6 #
     7 # DESCRIPTION: install standalone Isabelle executables
     8 
     9 
    10 PRG=$(basename "$0")
    11 
    12 function usage()
    13 {
    14   echo
    15   echo "Usage: $PRG [OPTIONS]"
    16   echo
    17   echo "  Options are:"
    18   echo "    -d DISTDIR   refer to DISTDIR as Isabelle distribution"
    19   echo "                 (default ISABELLE_HOME)"
    20   echo "    -k           install KDE application icon on Desktop"
    21   echo "    -p DIR       install standalone binaries in DIR"
    22   echo
    23   echo "  Install Isabelle executables with absolute references to the current"
    24   echo "  distribution directory."
    25   echo
    26   exit 1
    27 }
    28 
    29 function fail()
    30 {
    31   echo "$1" >&2
    32   exit 2
    33 }
    34 
    35 
    36 ## process command line
    37 
    38 # options
    39 
    40 NO_OPTS=true
    41 
    42 DISTDIR="$ISABELLE_HOME"
    43 KDE=""
    44 BINDIR=""
    45 
    46 while getopts "d:kp:" OPT
    47 do
    48   case "$OPT" in
    49     d)
    50       DISTDIR="$OPTARG"
    51       NO_OPTS=""
    52       ;;
    53     k)
    54       KDE=true
    55       NO_OPTS=""
    56       ;;
    57     p)
    58       BINDIR="$OPTARG"
    59       NO_OPTS=""
    60       ;;
    61     \?)
    62       usage
    63       ;;
    64   esac
    65 done
    66 
    67 shift $(($OPTIND - 1))
    68 
    69 
    70 # args
    71 
    72 [ "$#" -ne 0 -o -n "$NO_OPTS" ] && usage
    73 
    74 
    75 ## main
    76 
    77 echo "referring to distribution at $DISTDIR"
    78 
    79 
    80 # standalone binaries
    81 
    82 #set by configure
    83 AUTO_BASH=bash
    84 
    85 case "$AUTO_BASH" in
    86   /*)
    87     BASH="$AUTO_BASH"
    88     ;;
    89   *)
    90     BASH="/usr/bin/env bash"
    91     ;;
    92 esac
    93 
    94 if [ -n "$BINDIR" ]; then
    95   mkdir -p "$BINDIR" || fail "Bad directory: $BINDIR"
    96 
    97   for NAME in isatool isabelle Isabelle
    98   do
    99     BIN="$BINDIR/$NAME"
   100     DIST="$DISTDIR/bin/$NAME"
   101     echo "installing $BIN"
   102     echo "#!$BASH" > "$BIN" || fail "Cannot write file: $BIN"
   103     echo >> "$BIN"
   104     echo "exec \"$DIST\" \"\$@\"" >> "$BIN"
   105     chmod +x "$BIN"
   106   done
   107 fi
   108 
   109 
   110 # install KDE application icon
   111 
   112 KDEHOME=~/.kde
   113 KDEAPP=~/Desktop/Isabelle.kdelnk
   114 KDEICONS="$KDEHOME/share/icons"
   115 
   116 if [ "$KDE" = true ]; then
   117   mkdir -p "$KDEICONS" || fail "Bad directory: $KDEICONS"
   118   mkdir -p "$KDEICONS/mini" || fail "Bad directory: $KDEICONS/mini"
   119 
   120   [ -f "$KDEICONS/isabelle.xpm" ] || cp "$ISABELLE_HOME/lib/icons/isabelle.xpm" "$KDEICONS" || \
   121     fail "Cannot write file: $KDEICONS/isabelle.xpm"
   122   [ -f "$KDEICONS/mini/isabelle.xpm" ] || \
   123     cp "$ISABELLE_HOME/lib/icons/isabelle-mini.xpm" "$KDEICONS/mini/isabelle.xpm" || \
   124     fail "Cannot write file: $KDEICONS/mini/isabelle.xpm"
   125 
   126   echo "installing $KDEAPP"
   127   echo "# KDE Config File" > "$KDEAPP" || fail "Cannot write file: $KDEAPP"
   128   echo "[KDE Desktop Entry]" >> "$KDEAPP"
   129   echo "Type=Application" >> "$KDEAPP"
   130   echo "Exec=\"$DISTDIR/bin/Isabelle\" %f" >> "$KDEAPP"
   131   echo "Icon=isabelle.xpm" >> "$KDEAPP"
   132   echo "TerminalOptions=" >> "$KDEAPP"
   133   echo "Path=" >> "$KDEAPP"
   134   echo "Terminal=0" >> "$KDEAPP"
   135   echo "Name=Isabelle" >> "$KDEAPP"
   136 
   137   echo
   138   echo "Please refresh your KDE desktop now!"
   139 fi