|
INSTALL script
#!/bin/sh
# Copyright (c) 1996-2001 by Waterloo Maple Inc.
# All rights reserved. Unauthorized duplication prohibited.
# This script is used to install the distribution of Maple 7
echo
echo " Please use this script in order to install Maple 7 on following"
echo " operating systems: Solaris, AIX, HP-UX, DEC-UNIX 4.0* or IRIX 6.5 "
echo
unalias ls > /dev/null 2>&1
UNIX=""
OpS=`uname -s`
if [ $OpS = "SunOS" -o $OpS = "AIX" -o $OpS = "HP-UX" -o $OpS = "OSF1" -o $OpS = "IRIX" ]
then
while [ x"$UNIX" = x ];do
echo
echo "Please specify absolute path to Maple 7 CD"
echo "These are few commonly used CD paths:"
echo "Solaris : /cdrom/cdrom0"
echo "IRIX : /CDROM/iso9660"
echo "AIX, DEC_UNIX 4.0* and HP-UX /mnt, /cdrom ..."
read CD_ROOT
UNIX=`ls -1 $CD_ROOT|fgrep -i unix`
done
else
echo
echo "Please use UNIX/INSTALL script included on your Maple 7 CD "
fi
LOGFILE=.install.log
COMMON=`ls -1 $CD_ROOT/$UNIX|fgrep -i common.tar`
FLEXLM=`ls -1 $CD_ROOT|fgrep -i flexlm.tar`
ALPHABIN=`ls -1 $CD_ROOT/$UNIX|fgrep -i dec`
LINUXBIN=`ls -1 $CD_ROOT/$UNIX|fgrep -i binibmin.tar`
AIXBIN=`ls -1 $CD_ROOT/$UNIX|fgrep -i binibmri.tar`
SUNBIN=`ls -1 $CD_ROOT/$UNIX|fgrep -i sun`
HPBIN=`ls -1 $CD_ROOT/$UNIX|fgrep -i hp`
SGIBIN=`ls -1 $CD_ROOT/$UNIX|fgrep -i sgi`
CALLP=$CD_ROOT/$UNIX
echo
echo " Maple 7 installation"
echo
echo
###
# ask for the install directory
###
echo
echo " Enter the directory that you would like to install"
echo " Maple 7 in or upgrade an existing"
echo " installation."
DEFMAPLE=/usr/local/maple
MAPLE=
while [ x"$MAPLE" = x ]
do
echo " Installation directory (absolute path): [$DEFMAPLE]"
read MAPLE
if [ x"$MAPLE" = x ]
then
MAPLE=$DEFMAPLE
fi
if [ "`echo $MAPLE | sed 's;\(.\).*;\1;'`" != "/" ]
then
echo
echo " You need to specify an absolute path (starting with /)"
MAPLE=
elif [ -d $MAPLE ]
then
if [ -f $MAPLE -o ! -r $MAPLE -o ! -w $MAPLE -o ! -x $MAPLE ]
then
echo
echo " Sorry, you do not have access permissions to $MAPLE"
MAPLE=
fi
else
echo
echo " The directory $MAPLE does not exist. Do you want it created? (y/n)"
read Q
if [ "$Q" = "y" -o "$Q" = "Y" -o "$Q" = "yes" ]
then
mkdir $MAPLE
chmod 755 $MAPLE
if [ ! -d $MAPLE ]
then
echo
echo " Failed to create directory"
MAPLE=
fi
else
MAPLE=
fi
fi
done
LOGFILE=$MAPLE/$LOGFILE
touch $LOGFILE 2> /dev/null > /dev/null
echo "" >> $LOGFILE
echo " Starting INSTALL" >> $LOGFILE
date >> $LOGFILE
echo "" >> $LOGFILE
###
# determine whether this is a new install
###
if [ ! -d $MAPLE/bin ]
then
NEWI=y
else
if [ -d $MAPLE/FLEXlm ]
then
echo
echo " Are you adding a platform to an existing Maple 7"
echo " installation? (y/n)"
read Q
if [ $Q = "y" -o $Q = "Y" -o $Q = "yes" ]
then
NEWI=n
else
echo
echo " Do you wish to reinstall Maple 7? (y/n)"
read Q
if [ $Q = "y" -o $Q = "Y" -o $Q = "yes" ]
then
NEWI=y
else
echo
echo "Aborting install..."
echo
exit 1
fi
fi
else
echo " An existing installation was found in $MAPLE."
echo " Do you want to overwrite it? (y/n)"
read Q
if [ $Q = "y" -o $Q = "Y" -o $Q = "yes" ]
then
NEWI=y
else
echo
echo "Aborting install..."
echo
exit 1
fi
fi
fi
###
# if this is a new install to an existing directory, look for and preserve
# any expected Maple 6 license keys, and then remove everything
###
if [ $NEWI = y -a -d $MAPLE/bin ]
then
if [ -f $MAPLE/license/license.dat ]
then
LF1=y
echo
echo "license.dat found, will preserve."
else
LF1=n
fi
#look for network.lic
if [ -f $MAPLE/FlexLM/network.lic ] #look first in 6.0 dir
then
LF2=y1
echo
echo "network.lic found in $MAPLE/FlexLM, will preserve."
elif [ -f $MAPLE/FLEXlm/network.lic ] #look in 6.01 dir
then
LF2=y2
echo
echo "network.lic found in $MAPLE/FLEXlm, will preserve."
else
LF2=n
echo
echo " Could not find network.lic in $MAPLE/FLEXlm"
echo " or $MAPLE/FlexLM"
echo
echo " If you have an existing network license file somewhere"
echo " below $MAPLE, you must copy it to safe"
echo " location, so that it will not be erased by this"
echo " installation of Maple 7."
echo
echo " Proceed with installation? (y/n)"
read Q
if [ "$Q" = "y" -o "$Q" = "Y" ]
then
echo
else
echo
echo " Aborting install..."
echo
exit 1
fi
fi
#if there was anything to preserve
if [ "$LF1" = "y" -o "$LF2" = "y1" -o "$LF2" = "y2" ]
then
#create a temporary directory in the install directory
TMPN=tmp.$$
mkdir $MAPLE/$TMPN
if [ ! -d $MAPLE/$TMPN ]
then
echo
echo " Could not write to $MAPLE. You may be out of disk space?"
echo " Aborting install..."
echo
exit 1
fi
if [ $LF1 = y ]
then
cp $MAPLE/license/license.dat $MAPLE/$TMPN/license.dat
if [ ! -f $MAPLE/$TMPN/license.dat ]
then
echo
echo " Could not preserve license.dat"
echo " You may be out of disk space?"
echo " Aborting install..."
echo
exit 1
fi
fi
if [ $LF2 = y1 ]
then
cp $MAPLE/FlexLM/network.lic $MAPLE/$TMPN/network.lic
if [ ! -f $MAPLE/$TMPN/network.lic ]
then
echo
echo " Could not preserve network.lic"
echo " You may be out of disk space?"
echo " Aborting install..."
echo
exit 1
fi
elif [ $LF2 = y2 ]
then
cp $MAPLE/FLEXlm/network.lic $MAPLE/$TMPN/network.lic
if [ ! -f $MAPLE/$TMPN/network.lic ]
then
echo
echo " Could not preserve network.lic"
echo " You may be out of disk space?"
echo " Aborting install..."
echo
exit 1
fi
fi
fi
NUMLINES=`ls -l $MAPLE | wc -l | sed 's;\ *;;'`
if [ ! "$NUMLINES" = "2" ]
then
echo "WARNING"
echo " The installation directory $MAPLE contains existing files"
echo " which will be erased."
echo
echo " Proceed? (y/n)"
read Q
if [ "$Q" = "y" -o "$Q" = "Y" -o "$Q" = "yes" ]
then
echo " Erasing existing files in $MAPLE..."
else
echo
echo " Aborting install..."
echo
exit 1
fi
fi
for X in `ls $MAPLE`
do
if [ ! "$X" = "$TMPN" ]
then
/bin/rm -rf $MAPLE/$X
fi
done
fi
###
# if this is a new install, install the maple 7 base and copy FLEXlm
###
if [ $NEWI = y ]
then
cd $MAPLE
echo
echo " Maple will now install the base distribution."
sleep 1 #in case we scroll
# HP-UX tar doesn't support p option.
if [ `uname` = HP-UX ] ; then POPT= ; else POPT=p ; fi
# Determine if tar supports the -o option.
TAR_OPTS=xvo${POPT}f
if [ -f $CALLP/$COMMON ]
then
tar $TAR_OPTS $CALLP/$COMMON bin/maple 2>/dev/null >/dev/null
else
echo
echo " Could not find common.tar"
echo " The installation media seems to be corrupted."
echo
echo " Aborting install..."
echo
exit 1
fi
if [ ! -f ./bin/maple ]
then
TAR_OPTS=xv${POPT}f
fi
HTO=y
if [ -f $CALLP/$COMMON ]
then
tar $TAR_OPTS $CALLP/$COMMON 2>> $LOGFILE >> $LOGFILE
fi
# Change the maple script to reflect the install location.
for F in maple mint updtsrc
do
cat $MAPLE/bin/$F | sed -e 's!MAPLE=/usr/local/maple!MAPLE='$MAPLE'!' > $MAPLE/bin/$F.new
mv -f $MAPLE/bin/$F.new $MAPLE/bin/$F
done
chmod 755 $MAPLE/bin/maple $MAPLE/bin/mint $MAPLE/bin/updtsrc 2>> $LOGFILE >> $LOGFILE
chmod 444 $MAPLE/lib/maple.* 2>> $LOGFILE >> $LOGFILE
echo
echo " Installing license manager tools for all platforms"
if [ -f $CALLP/../$FLEXLM ]
then
tar $TAR_OPTS $CALLP/../$FLEXLM 2>> $LOGFILE >> $LOGFILE
fi
chmod -R ug+rwX $MAPLE/FLEXlm 2>> $LOGFILE >> $LOGFILE
fi
###
# ask user which platforms are to be installed
###
echo
echo " The install will now ask which binaries you need"
echo " installed for your particular site."
echo
echo " Please answer each question with a y for yes or"
echo " an n for no."
# DEC Alpha
DEC_ALPHA=n
echo
echo " Do you wish to install the binaries required for a DEC Alpha"
echo " machine running Digital UNIX V4.0* or Compaq Tru64 UNIX V5.* (y/n)"
read DEC_ALPHA
# HP-UX
HPUX=n
echo
echo " Do you wish to install the binaries required for an HP RISC"
echo " machine running HP-UX 11 (y/n)"
read HPUX
# Linux/x86
LINUX=n
echo
echo " Do you wish to install the binaries required for an Intel/x86"
echo " machine running Linux 2.2 RedHat or SUSE (y/n)"
read LINUX
# IBM RS/6000
RS6000=n
echo
echo " Do you wish to install the binaries required for an IBM RS/6000"
echo " machine running AIX 4.3? (y/n)"
read RS6000
# SGI Irix
SGI=n
echo
echo " Do you wish to install the binaries required for an SGI"
echo " machine running IRIX 6.5? (y/n)"
read SGI
# SunOS 5.x on SPARC
SUNOS=n
echo
echo " Do you wish to install the binaries required for a SUN SPARC"
echo " machine running Solaris 2.6, 2.7 or 2.8? (y/n)"
read SUNOS
###
# Install the appropriate executables
###
cd $MAPLE
if [ "$HTO" != "y" ]
then
if [ `uname` = HP-UX ] ; then POPT= ; else POPT=p ; fi
TAR_OPTS=xvo${POPT}f
HTO=n
fi
if [ $DEC_ALPHA = "y" -o $DEC_ALPHA = "Y" -o $DEC_ALPHA = "yes" ]
then
echo
echo " Installing DEC Alpha binaries."
ARCHIVE=$ALPHABIN
if [ x"$ARCHIVE" != x ]
then
if [ $HTO = n ]
then
tar $TAR_OPTS $CALLP/$ARCHIVE bin.DEC_ALPHA_UNIX/cmaple 2>/dev/null
if [ ! -f ./bin.DEC_ALPHA_UNIX/cmaple ]
then
TAR_OPTS=xv${POPT}f
fi
HTO=y
fi
tar $TAR_OPTS $CALLP/$ARCHIVE 2>> $LOGFILE >> $LOGFILE
fi
sleep 1
fi
if [ $HPUX = "y" -o $HPUX = "Y" -o $HPUX = "yes" ]
then
echo
echo " Installing HP-UX binaries."
ARCHIVE=$HPBIN
if [ x"$ARCHIVE" != x ]
then
if [ $HTO = n ]
then
tar $TAR_OPTS $CALLP/$ARCHIVE bin.HP_RISC_UNIX/cmaple 2>/dev/null
if [ ! -f ./bin.HP_RISC_UNIX/cmaple ]
then
TAR_OPTS=xv${POPT}f
fi
HTO=y
fi
tar $TAR_OPTS $CALLP/$ARCHIVE 2>> $LOGFILE >> $LOGFILE
fi
sleep 1
fi
if [ $LINUX = "y" -o $LINUX = "Y" -o $LINUX = "yes" ]
then
echo
echo " Installing Linux/x86 binaries."
ARCHIVE=$LINUXBIN
if [ x"$ARCHIVE" != x ]
then
if [ $HTO = n ]
then
tar $TAR_OPTS $CALLP/$ARCHIVE bin.IBM_INTEL_LINUX/cmaple 2>/dev/null
if [ ! -f ./bin.IBM_INTEL_LINUX/cmaple ]
then
TAR_OPTS=xv${POPT}f
fi
HTO=y
fi
tar $TAR_OPTS $CALLP/$ARCHIVE 2>> $LOGFILE >> $LOGFILE
fi
sleep 1
fi
if [ $RS6000 = "y" -o $RS6000 = "Y" -o $RS6000 = "yes" ]
then
echo
echo " Installing RS/6000 binaries."
ARCHIVE=$AIXBIN
if [ x"$ARCHIVE" != x ]
then
if [ $HTO = n ]
then
tar $TAR_OPTS $CALLP/$ARCHIVE bin.IBM_RISC_UNIX/cmaple 2>/dev/null
if [ ! -f ./bin.IBM_RISC_UNIX/cmaple ]
then
TAR_OPTS=xv${POPT}f
fi
HTO=y
fi
tar $TAR_OPTS $CALLP/$ARCHIVE 2>> $LOGFILE >> $LOGFILE
fi
sleep 1
fi
if [ $SGI = "y" -o $SGI = "Y" -o $SGI = "yes" ]
then
echo
echo " Installing SGI binaries."
ARCHIVE=$SGIBIN
if [ x"$ARCHIVE" != x ]
then
if [ $HTO = n ]
then
tar $TAR_OPTS $CALLP/$ARCHIVE bin.SGI_MIPS_UNIX/cmaple 2>/dev/null
if [ ! -f ./bin.SGI_MIPS_UNIX/cmaple ]
then
TAR_OPTS=xv${POPT}f
fi
HTO=y
fi
tar $TAR_OPTS $CALLP/$ARCHIVE 2>> $LOGFILE >> $LOGFILE
fi
sleep 1
fi
if [ $SUNOS = "y" -o $SUNOS = "Y" -o $SUNOS = "yes" ]
then
echo
echo " Installing SPARC Solaris binaries."
ARCHIVE=$SUNBIN
if [ x"$ARCHIVE" != x ]
then
if [ $HTO = n ]
then
tar $TAR_OPTS $CALLP/$ARCHIVE bin.SUN_SPARC_SOLARIS/cmaple 2>/dev/null
if [ ! -f ./bin.SUN_SPARC_SOLARIS/cmaple ]
then
TAR_OPTS=xv${POPT}f
fi
HTO=y
fi
tar $TAR_OPTS $CALLP/$ARCHIVE 2>> $LOGFILE >> $LOGFILE
fi
sleep 1
fi
cd $INIWD
###
# finish install
###
echo
echo " Installation is complete."
echo " You may need to edit the scripts in the bin directory"
echo " to configure Maple to run on your machine(s)."
echo
|