#!/bin/sh # davep 2004-06-22 # This is the install script for McIDAS Lite # # It assumes you have a tar file named McLITE--.tar.gz # in the current directory, where is one of the following # supported types: # hpux (11) # aix (5.1) # interix (3.5) # irix (6.5) # linux (EL 3.0) # solaris (5.9) # solarisX86 (5.9) # # For instance, if you are running Linux this script will look for # a file named 'McLITE-linux-1.1.tar.gz' in the current directory. # The tar.gz file will uncompress into a directory named 'mclite'. OK_SHELLS="sh bash ksh" RUN_DIR=`pwd` INST_DIR='mclite' BIN_DIR=$RUN_DIR/$INST_DIR/bin GUI_DIR=$RUN_DIR/$INST_DIR/lib/gui DAT_DIR=$RUN_DIR/$INST_DIR/data WSH_DIR=$BIN_DIR MCLITE_INSTALL=$RUN_DIR/$INST_DIR MCPATH=$MCLITE_INSTALL/.sysdata TCLTK_LIBRARY=$MCLITE_INSTALL/lib SHELL_RUN=$HOME/.profile MCLITE_RUN=$BIN_DIR/mclite GUI_RUN=$BIN_DIR/guilite.k TMP_FILE=$BIN_DIR/.editing INST_TYPE='' INST_FILE='' FILE_OK='' DIR_OK='' DONE_OK='' UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown UNAME_PROCESSOR=`(uname -p) 2>/dev/null` || UNAME_PROCESSOR=unknown # CHECK_SHELL will verify that we are sourcing from an acceptable shell THIS_SHELL=`echo $0 | sed -e 's/-//'` THIS_SHELL=`echo $THIS_SHELL | sed -e 's/\.exe//'` THIS_SHELL=`echo $THIS_SHELL | sed -e 's/\/.*\///'` CHECK_SHELL=`echo $OK_SHELLS | grep "$THIS_SHELL"` echo "" echo "INSTALLING McIDAS-LITE" echo "----------------------" if [ -z "$CHECK_SHELL" ]; then echo "You must be running one of the supported shell types:" echo "$OK_SHELLS" echo "From one of these shells, run the install script" echo "by typing the following: '. ./mclite-install'" echo "" read continue exit 1 else if [ "$THIS_SHELL" = "bash" ]; then if [ -f $HOME/.bash_profile ]; then SHELL_RUN=$HOME/.bash_profile fi fi echo "This will install McIDAS-LITE into a subdirectory named '$INST_DIR'" echo "Press to continue, or to abort" read continue fi #This is a fragment from the GNU config.guess script echo "" case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}:${UNAME_PROCESSOR}" in sun4*:SunOS:5.*:*) INST_TYPE='solaris' ;; i86pc*:SunOS:*:*) INST_TYPE='soli86' ;; *:SunOS:*:*) echo 'Unsupported Solaris version' ;; *:IRIX64:6.*:*) INST_TYPE='irix' ;; *:IRIX:6.*:*) INST_TYPE='irix' ;; *:IRIX*:*:*) echo 'Unsupported IRIX version' ;; i[345]86:AIX:*:*) echo 'Unsupported AIX version' ;; *:AIX:2:3) echo 'Unsupported AIX version' ;; *:AIX:*:4) echo 'Unsupported AIX version' ;; *:AIX:*:*) INST_TYPE='aix' ;; 9000/7??:HP-UX:*:*) INST_TYPE='hpux' ;; *:HP-UX:*:*) echo 'Unupported HP-UX version' ;; i[456]86:Linux:*:*) INST_TYPE='linux' ;; *:Linux:*:*) echo 'Unsupported Linux platform' ;; *:Darwin:*:*) INST_TYPE='darwin' ;; *:Windows_NT:*:*) if [ ! -z "$INTERIX_ROOT" ]; then INST_TYPE='interix' else echo 'Unable to find Interix (INTERIX_ROOT not set)' fi ;; *:Interix:*:*) if [ ! -z "$INTERIX_ROOT" ]; then INST_TYPE='interix' else echo 'Unable to find Interix (INTERIX_ROOT not set)' fi ;; *:*:*:*) echo "Unable to guess system type" ;; esac # Checking for install file if [ ! -z "$INST_TYPE" ]; then INST_FILE=`ls McLITE-$INST_TYPE* 2>/dev/null` BAD=`echo "$INST_FILE" | grep " "` if [ ! -f "$INST_FILE" -o ! -z "$BAD" ]; then echo "Unable to find unique install file (McLITE-$INST_TYPE)" else if [ ! -r "$INST_FILE" ]; then echo "You do not have read rights for $INST_FILE" else FILE_OK=TRUE fi fi if [ ! -d "$INST_DIR" ]; then if [ -w "$RUN_DIR" ]; then DIR_OK=TRUE else echo "You must have write permissions on this directory" fi else if [ ! -z "$FILE_OK" ]; then echo "The '$INST_DIR' install directory already exists." echo "Would you like to overwrite?" printf "Type 'yes' to continue: " read input echo "" if [ ! -z "$input" -a "$input" = 'yes' ]; then DIR_OK=TRUE fi fi fi fi # If everything is okay so far, do the actual program extraction if [ ! -z "$FILE_OK" -a ! -z "$DIR_OK" ]; then echo "Installing McIDAS Lite ($INST_TYPE)..." echo "" echo "Extracting files:" gunzip < $INST_FILE | tar -xvmf - # Adding mclite path to current path CHECK_BIN_DIR=`echo $PATH | grep "$BIN_DIR"` if [ -z "$CHECK_BIN_DIR" ]; then echo "" echo "Prepending $BIN_DIR to current PATH" PATH="$BIN_DIR:$PATH" export PATH fi # Adding mclite path to shell startup script if [ ! -f "$SHELL_RUN" ]; then echo "" echo "Unable to find shell startup script ($SHELL_RUN)" echo "You must manually add $BIN_DIR to your PATH" else if [ ! -r "$SHELL_RUN" ]; then echo "" echo "You do not have read rights for $SHELL_RUN" echo "You must manually add $BIN_DIR to your PATH" else CHECK_BIN_DIR=`grep "PATH=.*$BIN_DIR" $SHELL_RUN` if [ -z "$CHECK_BIN_DIR" ]; then echo "Prepending $BIN_DIR to PATH in $SHELL_RUN" cat <> $SHELL_RUN export PATH=$BIN_DIR:\$PATH !EOF! fi fi fi ################################### # Modifying mclite startup script # ################################### # Adding install directories to mclite startup script if [ ! -r "$MCLITE_RUN" -o ! -w "$MCLITE_RUN" ]; then echo "" echo "You must have read/write rights for $MCLITE_RUN" else cat $MCLITE_RUN |\ sed -e "s:^\(MCPATH\)=.*$:\1=$MCPATH:" \ -e "s:^\(MCLITE_INSTALL\)=.*$:\1=$MCLITE_INSTALL:" \ -e "s:^\(LD_LIBRARY_PATH\)=.*$:\1=$TCLTK_LIBRARY\:\$LD_LIBRARY_PATH:" \ -e "s:^\(TCL_LIBRARY\)=.*$:\1=$TCLTK_LIBRARY:" \ -e "s:^\(TK_LIBRARY\)=.*$:\1=$TCLTK_LIBRARY:" > $TMP_FILE chmod 755 $TMP_FILE mv -f $TMP_FILE $MCLITE_RUN fi ################################ # Modifying gui startup script # ################################ # Adding file locations to gui startup script if [ ! -r "$GUI_RUN" -o ! -w "$GUI_RUN" ]; then echo "" echo "You must have read/write rights for $GUI_RUN" else cat $GUI_RUN |\ sed -e "s:^GUIDIR=.*$:GUIDIR=$GUI_DIR:" \ -e "s:^MCDATA=.*$:MCDATA=$DAT_DIR:" \ -e "s:^MCWISHDIR=.*$:MCWISHDIR=$WSH_DIR:" > $TMP_FILE chmod 755 $TMP_FILE mv -f $TMP_FILE $GUI_RUN fi DONE_OK=TRUE fi echo "" echo "Install script completed" echo ""