home *** CD-ROM | disk | FTP | other *** search
- :
-
- #
- # $Header: setup.ins.pp,v 6.19 89/11/13 20:04:53 rafsarif Exp $ setup.ins
- #
-
- #
- # setup.ins
- #
- # Centralized script for initializing enviromental variables for
- # Oracle installation scripts, and performing common routines. This script
- # is run in the beginning of all Oracle product installation scripts.
- #
-
- #
- # Display abort message on interupt.
- #
- trap 'echo " $MKTG_NAME Installation Aborted!"; exit' 1 2 3 15
-
- #
- # Allow verification/trace to be turned on and off.
- # When verification is off, the default case, invoke sqlplus with the
- # -silent option.
- #
- case "$ORACLE_TRACE" in
- "T") set -x ;;
- "*") SILENT="-silent" ;;
- esac
-
- #
- # If LOG is not set, then send output to /dev/null.
- #
- case $LOG in
- "") LOG=/dev/null ;;
- esac
-
- #
- # Determine how to suppress newline with echo command.
- #
- case ${N}$C in
- "") if echo "\c" | grep c >/dev/null 2>&1; then
- N='-n'
- else
- C='\c'
- fi ;;
- esac
-
- #
- # Make sure ORACLE_HOME and INSTALL_HOME are set.
- #
- case $ORACLE_HOME in
- "") echo "ORACLE_HOME not set."
- echo "Set and export ORACLE_HOME, then restart installation." | tee -a $LOG
- exit 1 ;;
- esac
-
- case $INSTALL_HOME in
- "") INSTALL_HOME="$ORACLE_HOME/install"
- export INSTALL_HOME ;;
- esac
-
- #
- # Determine wether to do an install or an update
- #
- case "$UPDATE" in
- "") echo "
-
- Please designate whether this is a fresh install or an update:
-
- 1 Fresh install of ORACLE from scratch.
-
- 2 Update install of an existing ORACLE database.
-
- Q Quit.
-
- "
- while : ; do
- echo $N "Enter 1, 2 or Q: $C"
- DEFLT="1"; . $INSTALL_HOME/read.sh; ANS=$RDVAR
- echo ""
- case "$ANS" in
- 1) UPDATE=N ; break ;;
- 2) UPDATE=Y ; break ;;
- q|Q) echo "User requested abort." ; sync ; exit 0 ;;
- esac
- done
- export UPDATE ;;
- esac
-
- #
- # If oracle.key does not exist or product is not found, regenerate oracle.key
- #
- if [ "`grep :$product: $ORACLE_HOME/install/oracle.key 2> /dev/null`" = "" ]
- then
- cat $ORACLE_HOME/*/install/*.key | sort -n > $ORACLE_HOME/install/oracle.key
- fi
- SCRIPT=`grep :$product: $ORACLE_HOME/install/oracle.key| awk -F: '{print $4}'`
- script=`basename $SCRIPT`
-
- #
- # Announce that script is running. Reset the trap if update is true.
- #
- echo "" | tee -a $LOG
- case $UPDATE in
- Y)echo "Running $MKTG_NAME update ($script.install)..." | tee -a $LOG
- trap 'echo " $MKTG_NAME Update Aborted!"; exit' 1 2 3 15 ;;
- *)echo "Running $MKTG_NAME installation ($script.install)..." | tee -a $LOG
- ;;
- esac
- echo ""
-
- #
- # Check that required variables are set. If they are not, prompt user.
- #
-
- case $ORACLE_OWNER in
- "") DEFLT="${USER-$LOGNAME}"
- echo ""
- echo "Enter the login name for the owner of this ORACLE database"
- echo $N "or Q to quit. $C"
- . $INSTALL_HOME/read.sh; ORACLE_OWNER=$RDVAR
- case $ORACLE_OWNER in
- q|Q) echo "User requested abort." ; sync ; exit 0 ;;
- *) ;;
- esac
- echo ""
- export ORACLE_OWNER ;;
- esac
-
- case $ORACLE_SID in
- "") echo ""
- echo $N "Enter string for ORACLE system identifier. $C"
- DEFLT=$ORACLE_OWNER . $INSTALL_HOME/read.sh; ORACLE_SID=$RDVAR
- case $ORACLE_SID in
- q|Q) echo "User requested abort." ; sync ; exit 0 ;;
- *) ;;
- esac
- echo ""
- export ORACLE_SID ;;
- esac
-
- #
- # Ask the SYSTEM pasword for products that install tables in the database.
- #
- case $SYSTEM_PASS in
- "") case "$MKTG_NAME" in
- SQL*Net*|PL\/SQL|Pro*|*Loader|*Report|*Calc|transaction*|TP1*) ;;
- *) echo ""
- echo $N "Enter current SYSTEM account password. $C"
- DEFLT="manager"
- . $INSTALL_HOME/read.sh; SYSTEM_PASS=$RDVAR
- case $SYSTEM_PASS in
- q|Q) echo "User requested abort." ; sync ; exit 0 ;;
- *) ;;
- esac
- SYSTEM_PASS="system/${SYSTEM_PASS}"
- echo ""
- export SYSTEM_PASS ;;
- esac ;;
- esac
-
- case $LINK_PRODUCT in
- "") case "$MKTG_NAME" in
- SQL*Net*|PL/SQL) ;;
- *) echo ""
- echo $N "Would you like to relink $MKTG_NAME executables? $C"
- DEFLT="N" ;. $INSTALL_HOME/read.sh; ANS=$RDVAR
- case "$ANS" in
- n|N) LINK_PRODUCT=F ;;
- q|Q) echo "User requested abort." ; sync ; exit 0 ;;
- *) LINK_PRODUCT=T ;;
- esac
- echo ""
- export LINK_PRODUCT ;;
- esac ;;
- esac
-
- #
- # Is the script being run by a super user?
- #
- > /tmp/fil$$
- INAME=`ls -l /tmp/fil$$ | awk '{print $3}'`
- rm -f /tmp/fil$$
- case $INAME in
- root) SUPER_USER=TRUE ;;
- *) SUPER_USER=FALSE ;;
- esac
-
- #
- # Verify that the ORACLE database if running, for products that install
- # tables in the database.
- #
- case "$MKTG_NAME" in
- SQL*Net*|PL\/SQL|"ORACLE RDBMS"|Pro*|*Loader|*Report|transaction*|TP1*) ;;
- *) case "$DATABASE_UP" in
- "") echo ""
- echo "Checking that database is running..."| tee -a $LOG
- echo ""
- if [ ! -f $ORACLE_HOME/dbs/sgadef${ORACLE_SID}.dbf ] ; then
- echo "RDBMS must be installed and running before proceeding with"
- echo "$MKTG_NAME installation."
- echo "Exiting $MKTG_NAME install."
- exit 1
- else
- DATABASE_UP="T" ; export DATABASE_UP
- fi ;;
- esac ;;
- esac
-
- #
- # Move to the correct directory for this install.
- #
- cd $ORACLE_HOME/${product}
-
- #
- # Set up oracle file permissions.
- #
- echo ""
- echo "Setting correct $MKTG_NAME file protections..." | tee -a $LOG
- echo ""
-
- #
- # Protect lib directory
- #
- if [ -d $ORACLE_HOME/${product}/lib ] ; then
- cd $ORACLE_HOME/${product}/lib
- chmod 755 . >> $LOG 2>&1
- for i in `ls`;
- do
- if [ -f $i ]; then
- chmod 644 $i >> $LOG 2>&1
- fi
- done
- fi
-
- #
- # Protect admin directory
- #
- if [ -d $ORACLE_HOME/${product}/admin ] ; then
- cd $ORACLE_HOME/${product}/admin
- chmod 755 . >> $LOG 2>&1
- for i in `ls`;
- do
- if [ -f $i ]; then
- chmod go-w $i >> $LOG 2>&1
- elif [ -d $i ]; then
- chmod 755 $i >> $LOG 2>&1
- fi
- done
- fi
-
- #
- # Protect demo directory
- #
- if [ -d $ORACLE_HOME/${product}/demo ] ; then
- cd $ORACLE_HOME/${product}/demo
- chmod 755 . >> $LOG 2>&1
- chmod 644 * >> $LOG 2>&1
- fi
-
- #
- # Protect help directory
- #
- if [ -d $ORACLE_HOME/${product}/help ] ; then
- cd $ORACLE_HOME/${product}/help
- chmod 750 . >> $LOG 2>&1
- chmod 640 * >> $LOG 2>&1
- fi
-
-