#!/bin/sh # #@(#)SAXinstall - Copyright (c)2000 Soliton Associates # October 2000 Ruth Uschold # # SAXinstall: UNIX Install script for SAX, SHARP APL for UNIX # Version 6.0.0 # # This script does the following: # 1. Verify system platform # 2. Verify root userid, and proper umask setting # 3. Determine users choice of installation directory # 4. Create installation directory # 5. Restore Distribution Files # 6. Install APL X-Window Fonts in appropriate directory # 7. Install and start the SVP # # The installer must then perform a number of manual steps. # #******************************************************************************* # Function Definition: Validation # Validation () { trap 'echo "`basename $0`: SAX Install script disconnected - SIGNAL 1" 1>&2; ExitRoute' 1 trap 'echo "`basename $0`: SAX Install script interrupted - SIGNAL 2" 1>&2; ExitRoute' 2 trap 'echo "`basename $0`: SAX Install script terminated - SIGNAL 15" 1>&2; ExitRoute' 15 # PlatformDiff # InitialCheck # # Ensure root uid & proper umask # USERNAME=`id | awk -F\( '{print $2 }' | awk -F\) '{ print $1 }'` case $USERNAME in root) UMASK=`umask` case $UMASK in 022) ;; 0022) ;; *) echo "" echo "Your umask setting is "$UMASK"" echo "This is not the recommended setting for SAX installation." echo "" echo $n "Do you wish to continue (Y/N) ? [N] " $c read yn if [ -z "$yn" ] then yn="N" fi case $yn in Y|y|yes|YES|Yes) ;; *) echo "" echo "Exiting installation procedure....change root uid's" echo "umask setting to 022, and begin again." echo "" exit 1 ;; esac ;; esac ;; *) echo "" echo "You must be logged on as root to run this installation." echo "Exiting installation procedure.......logon to root uid, and begin again." echo "" exit 1 ;; esac CSDCALL=0 export CSDCALL DIRSET=0 export DIRSET return 0 } #****************************************************************************** # # Function definition: Initialize the CP and RM variables # CPRMinit () { # # find the cp program # if [ -f /usr/bin/cp ] then CP="/usr/bin/cp -prf" elif [ -f /bin/cp ] then CP="/bin/cp -prf" else echo "Cannot locate the cp program" echo "Exiting installation procedure." exit 1 fi # # find the rm program # if [ -f /usr/bin/rm ] then RM="/usr/bin/rm" elif [ -f /bin/rm ] then RM="/bin/rm" else echo "Cannot locate the rm program" echo "Exiting installation procedure." exit 1 fi } #****************************************************************** # # Function definition: Initialize portable echo parameters # EchoInit () { case "`echo 'x\c'`" in 'x\c') n="-n" c=" " #BSD ;; x) c="\c" n=" " #Sys V ;; *) echo "$0 Can't set up echo. Exiting installation procedure." 1>&2 exit 1 ;; esac } #****************************************************************** # # Function Definition: Check for Previous Install # InitialCheck () { if [ -d /usr/sax ] then REL=`find /usr/sax/ -name "apl*" -type f -print`; if [ -d /usr/sax/rel ] ; then echo ""; echo "Are you sure this is an initial installation?"; echo "/usr/sax/rel library already exists......"; echo ""; echo "Please contact Soliton Support before proceeding."; exit 1 else if test \( -n "$REL" \) ; then echo ""; echo "Are you sure this is an initial installation?"; echo "some SAX files already exist on your system......"; echo ""; echo "Please contact Soliton Support before proceeding."; exit 1 fi fi fi echo $REL } #************************************************************************* # Function Definition: Verify system platform # PlatformDiff () { # # Operating System (e.g. SunOS or AIX) # OS=`uname -s` case $OS in SunOS*) SYSTEM=SUN ID=`uname -r` case $ID in 5.6) PLATFORM="solaris_6" ;; 5.7) PLATFORM="solaris_7" ;; 5.8) PLATFORM="solaris_8" ;; *) echo "" echo " Solaris release number is $ID." echo " This is not supported." echo "Exiting installation procedure." exit 1 ;; esac ;; AIX*) SYSTEM=IBM ID=`uname -v` case `uname -r` in 2) PLATFORM="aix_42" ;; 3) PLATFORM="aix_43" ;; *) echo "" echo " AIX release number is `uname -r`" echo " This is not supported." echo "Exiting installation procedure. " exit 1 ;; esac HOSTNAM=`hostname` if [ -z "$HOSTNAM" ] then echo "This machine has no hostname specified" echo "this will cause its hostid to default to zero," echo "causing problems using files in the future." echo "" echo $n "Do you wish to continue (Y/N) ? [N]" $c read yn if [ -z "$yn" ] then yn="N" fi case $yn in N|n|no|NO|No) echo "" echo "Exiting installation procedure. " exit 1 ;; Y|y|yes|YES|Yes) ;; *) echo "" echo "You have entered an invalid response. Please try again." echo "" ;; esac fi ;; Linux*) SYSTEM=LINUX ID=`uname -r` PLATFORM="linux" ;; *) echo "SHARP APL for UNIX is currently unsupported on "$OS$ID"" echo "Contact Soliton support before proceeding." exit 1 ;; esac echo "This is the installation procedure for Version 6.0 of SHARP APL for UNIX" echo "on "$OS$ID"" echo "" echo $n "Do you wish to continue (Y/N) ? [Y]" $c read yn if [ -z "$yn" ] then yn="Y" fi case $yn in Y|y|yes|YES|Yes) ;; N|n|no|NO|No) echo "" echo "Exiting installation procedure. " exit 1 ;; *) echo "" echo "You have entered an invalid response. Please try again." echo "" PlatformDiff ;; esac export SYSTEM export PLATFORM export OS return 0 } #******************************************************************************* # Function Definition: Display Disclaimer and request approval. # Called by PlatformDiff # Disclaimer () { case $OS in Linux*) awk '{print}' $SRCDIR/disclaimer|more echo "" echo $n "Do you agree to the terms of the disclaimer (Y/N)? [N] " $c read yn if [ -z "$yn" ] then yn="N" fi case $yn in Y|y|yes|YES|Yes) : ;; *) echo "Exiting installation procedure" exit 1 ;; esac ;; *) ;; esac return 0 } #******************************************************************************* # Function Definition: Identify location of CD-ROM. # Called by Validation # CDROMdeclaration () { r=0 while [ "$r" -eq 0 ] do echo "" echo $n "Are your source files located on a cdrom (Y/N) ? [Y] " $c read yn if [ -z "$yn" ] then yn="Y" fi case $yn in Y|y|yes|YES|Yes) r=1 echo "Enter the name of the mounted cdrom, e.g. '/cdrom'." read CDDIR SRCDIR="/"$CDDIR"/"$PLATFORM"" ;; N|n|no|NO|No) r=1 echo "Enter the full directory path containing the source files." # # Note - if entering a source file location other than "cdrom", # you must enter the parent directory of "bin", "lib" and "etc". # read SRCDIR ;; *) echo "" echo "Please respond yes or no." ;; esac done if [ ! -d "$SRCDIR" ] then echo "" echo "Cannot find the specified location." echo "Check that CD-ROM is mounted or that directory name is" echo "correct, and try again." echo "" CDROMdeclaration fi # # Check existence of some source file # if [ ! -d "$SRCDIR/lib/wss32" ] then echo "" echo "The source files do not exist in the specified directory." echo "" CDROMdeclaration fi export SRCDIR if [ "$CSDCALL" = "0" ] then ConfirmSourceDir fi return 0 } #****************************************************************************** # Function Definition: Confirm choice of source directory # ConfirmSourceDir () { CSDCALL=1 export CSDCALL echo "" echo "SAX will be installed from source files located in $SRCDIR. " echo $n "Enter Y if that is correct; enter N to choose another location. " $c read yn case $yn in Y|y|yes|YES|Yes) ;; N|n|no|NO|No) CSDCALL=0 export CSDCALL CDROMdeclaration ;; *) echo "" echo "You have entered an invalid response. Please try again." ConfirmSourceDir ;; esac return 0 } #****************************************************************************** # Function Definition: determine user's preference for location of new # SAX files - called by Main Routine # SetInstallDir () { r=0 while [ "$r" -eq 0 ] do echo "" echo "Would you like to install the new version in the default (usr/sax/rel)" echo $n "directory (Y/N) ? [Y] " $c read yn if [ -z "$yn" ] then yn="Y" fi case $yn in Y|y|yes|YES|Yes) r=1 SAXDIR=/usr/sax/rel export SAXDIR ConfirmInstallDir ;; N|n|no|NO|No) r=1 echo "" echo "Enter the pathname under which you would like to install the files." read SAXDIR export SAXDIR ConfirmInstallDir ;; *) echo "" echo "You have entered an invalid response.....try again" ;; esac done return 0 } #***************************************************************************** # Function Definition: Confirm choice of installation directory # ConfirmInstallDir () { echo "" echo "SAX will be installed into $SAXDIR. " echo $n "Enter Y if that is correct; enter N to choose another location. " $c read yn case $yn in Y|y|yes|YES|Yes) ;; N|n|no|NO|No) SetInstallDir ;; *) echo "" echo "You have entered an invalid response. Please try again." ConfirmInstallDir ;; esac if [ "$DIRSET" = "0" ] then Mkdircheck fi return 0 } #***************************************************************************** # Function Definition: Check the existence of the new production library, # then create it if necessary. Called by SetInstallDir # Mkdircheck () { if [ ! -d "$SAXDIR" ] then mkdir $SAXDIR case $? in 0) DIRSET=1 export DIRSET ;; *) echo "" echo "Cannot create the installation path requested. " echo "Check file permissioning within the parent directory, and try again." SetInstallDir ;; esac else r1=0 while [ "$r1" -eq 0 ] do echo"" echo ""$SAXDIR" already exists" echo "" echo $n "Do you wish to overwrite it (Y/N) ? [N]" $c read yn if [ -z "$yn" ] then yn="N" fi case $yn in Y|y|yes|YES|Yes) DIRSET=1 export DIRSET r1=1 ;; N|n|no|NO|No) r1=1 SetInstallDir ;; *) echo "" echo "You have entered an invalid response..." echo "" ;; esac done fi return 0 } #***************************************************************************** # # Function Definition: Process source files # ProcessFiles () { cd $SAXDIR echo "" echo "Copying the source files to the release directory........" echo "" cd $SAXDIR ${CP} $SRCDIR/* . case $? in 0) echo "" echo "If installing from a CD-ROM, remember to " echo "unmount and remove it when completed....." ;; *) echo "" echo "Problem restoring SHARP APL distribution files." echo "" echo "Exiting installation procedure. " exit 1 ;; esac return 0 } #***************************************************************************** # # Function Definition : create directory structure for trace files # Tracedir () { echo " " cd $SAXDIR if [ ! -d trc ] then if [ -f trc ] then ${RM} trc fi mkdir trc case $? in 0) ;; *) echo "" echo "Cannot create the trc directory." echo "check file permissioning in "$SAXDIR" and try again." echo "" echo "Exiting installation procedure. " exit 1 ;; esac fi cd trc if ls "$SAXDIR/etc/" | grep ctl > /dev/null then ${CP} -pr $SAXDIR/etc/*ctl . else echo "" echo "No *ctl files exist in $SAXDIR/etc. Cannot copy files to trc directory." fi return 0 } #*********************************************************************************** # Function Definition: Set correct $SAXDIR in terminal init files # Tinit () { # Run tinit.install to set the site value of $SAXDIR # $SAXDIR/etc/tinit.install } #*********************************************************************************** # Function Definition: Install APL X-Window fonts # XWinFonts () { echo "Installing APL fonts in X-Windows System" cd $SAXDIR/etc ./xfonts.install } #**************************************************************************** # Function Definition: Install and start the SVP # SVPsetup () { $SAXDIR/etc/conf/svp.install sleep 3 echo "" echo "Verifying the SVP installation......." echo "" echo "Starting the SVP now..." $SAXDIR/etc/conf/rc_local.sax start return 0 } #**************************************************************************** # Function Definition: Exit Route # ExitRoute () { # echo "" # echo "Exiting script now..." exit } #******************************************************************************* # Main Logic Routine, function calls # Validation CDROMdeclaration Disclaimer EchoInit CPRMinit SetInstallDir case $SYSTEM in SUN) ProcessFiles ;; IBM) ProcessFiles ;; LINUX) ProcessFiles ;; *) echo " " echo "SHARP APL for UNIX is currently unsupported on " echo ""$SYSTEM" systems." exit 1 ;; esac Tracedir Tinit XWinFonts SVPsetup ExitRoute