#!/bin/sh # # Install script for UNIX InterBase software # # Copyright (c)1998,1999, InterBase Software Corporation # All Rights Reserved # ############################################################################ PATH=$PATH:/usr/ucb:/usr/bsd:/bin:/usr/bin export PATH SHLIB_PATH=/usr/lib export SHLIB_PATH LogFile="ibinstall.log" TmpLogFile="/tmp/$LogFile" DefaultInstDir="/usr/local" IBSymLink="/usr/interbase" SUPERSERVER="" #Note: TarFile must contain the absolute path name TarFile="" ExitError() { echo -e "\n*** Install completed with errors ***" | tee -a $TmpLogFile echo -e "Install log can be found at $TmpLogFile" exit 1 } ExitSuccess() { echo -e "\nInstall completed successfully" | tee -a $INTERBASE/$LogFile echo -e "Install log can be found at $INTERBASE/$LogFile" exit 0 } Quit() { echo -e "\nInstall is not complete." | tee -a $TmpLogFile echo -e "You may run the install at a later time to complete the installation." | tee -a $TmpLogFile echo -e "Install log can be found at $TmpLogFile" exit 2 } CheckInstallDir() { if [ ! -z "$1" ]; then if [ ! -d "$1" ]; then while true; do echo -e "\nDirectory \"$IBINSTALL\" does not exist." | tee -a $TmpLogFile echo -e "Do you want to create it now? (default: y) [y, n, q] : \c" | tee -a $TmpLogFile read response echo -e "$response" >> $TmpLogFile case $response in y|Y|yes|Yes|YES|"" ) mkdir -p $IBINSTALL echo -e "\nmkdir -p $IBINSTALL" >> $TmpLogFile break;; n|N|no|NO|No ) IBINSTALL="" break;; q|Q|quit|Quit|QUIT ) Quit;; * ) echo -e "\nERROR: Invalid response, expected \"y\", \"n\" or \"q\"" | tee -a $TmpLogFile ;; esac done else if [ -d "$1/interbase" ]; then while true; do echo -e "\nDirectory \"$IBINSTALL/interbase\" already exists." | tee -a $TmpLogFile echo -e "Do you want to continue? (default: n) [y, n, q] : \c" | tee -a $TmpLogFile read response echo -e "$response" >> $TmpLogFile case $response in y|Y|yes|Yes|YES ) break;; n|N|no|NO|No|"" ) IBINSTALL="" break;; q|Q|quit|Quit|QUIT ) Quit;; * ) echo -e "\nERROR: Invalid response, expected \"y\", \"n\" or \"q\"" | tee -a $TmpLogFile ;; esac done fi fi fi } GetInstallDir() { while [ -z "$IBINSTALL" ] ; do echo -e "\nEnter the absolute path name of the install directory" | tee -a $TmpLogFile echo -e "[$DefaultInstDir] : \c" | tee -a $TmpLogFile read inst_dir echo -e "$inst_dir" >> $TmpLogFile case $inst_dir in "" ) IBINSTALL="$DefaultInstDir";; /* ) IBINSTALL="$inst_dir";; * ) echo -e "\nERROR: The specified pathname \"$inst_dir\" is not the absolute." | tee -a $TmpLogFile echo -e " Please try again." | tee -a $TmpLogFile continue;; esac CheckInstallDir $IBINSTALL if [ -z "$IBINSTALL" ]; then continue fi done } # # Main entry # if [ -f $TmpLogFile ]; then mv $TmpLogFile $TmpLogFile.old echo -e "Old $TmpLogFile moved to $TmpLogFile.old\n" >> $TmpLogFile fi echo -e "***********************************************" >> $TmpLogFile echo -e "InterBase Install in progress" >> $TmpLogFile echo -e "`date`" >> $TmpLogFile echo -e "***********************************************" >> $TmpLogFile if [ "`whoami`" != "root" ]; then echo -e "ERROR: No permissions to perform operation." | tee -a $TmpLogFile echo -e " Log in as root and try again." | tee -a $TmpLogFile ExitError fi if [ -f /bin/ps ]; then PS="/bin/ps -ef" else if [ -f /usr/ucb/ps ]; then PS="/usr/ucb/ps -ax" else PS="ps -ef" fi fi gds_lock_mgr=`$PS|grep gds_lock_mgr|grep -c -v grep` gds_inet_server=`$PS|grep gds_inet_server|grep -c -v grep` if [ $gds_lock_mgr -ne 0 -o $gds_inet_server -ne 0 ]; then echo -e "ERROR: Detected another Interbase server running on the system." | tee -a $TmpLogFile echo -e " Shutdown the InterBase server and try again." | tee -a $TmpLogFile ExitError fi TarFile="$1" if [ -z "$TarFile" ]; then echo -e "ERROR: Syntax error, expected archive file." | tee -a $TmpLogFile echo -e "Usage: $0 AbsolutePathOfTheTarFile" | tee -a $TmpLogFile ExitError fi if [ -z "$IBINSTALL" ]; then GetInstallDir else case "$IBINSTALL" in /* ) CheckInstallDir $IBINSTALL if [ -z "$IBINSTALL" ]; then GetInstallDir fi ;; * ) echo -e "ERROR: The specified pathname \"$IBINSTALL\" is not the absolute." IBINSTALL="" GetInstallDir;; esac fi cd $IBINSTALL if [ ! -f $TarFile ]; then echo -e "ERROR: File \"$TarFile\" not found." | tee -a $TmpLogFile ExitError fi INTERBASE="$IBINSTALL/interbase" # # Extract files from a tar archive # echo -e "----------------------------\n" >> $TmpLogFile echo -e "\nExtracting files" >> $TmpLogFile echo -e "\nExtracting files... \c" tar vxfz $TarFile >> $TmpLogFile 2>&1 if [ $? -ne 0 ]; then echo -e "ERROR: Can't extract the files from the archive." | tee -a $TmpLogFile ExitError fi echo -e "Done" echo -e "----------------------------\n" >> $TmpLogFile # Make sure the top level ($INTERBASE) is 777 # echo -e "Updating access permissions... \c" echo -e "Updating access permissions" >> $TmpLogFile chmod 777 $INTERBASE echo -e "chmod 777 $INTERBASE" >> $TmpLogFile # # Protect security, examples and QLI help databases # chmod uog=rw $INTERBASE/isc4.gdb chmod uog=rw $INTERBASE/help/help.gdb chmod uog=rw $INTERBASE/examples/employee.gdb chmod uog=rw $INTERBASE/examples/intlemp.gdb chmod 4755 $INTERBASE/bin/gstat echo -e "chmod uog=rw $INTERBASE/isc4.gdb" >> $TmpLogFile echo -e "chmod uog=rw $INTERBASE/help/help.gdb" >> $TmpLogFile echo -e "chmod uog=rw $INTERBASE/examples/employee.gdb" >> $TmpLogFile echo -e "chmod uog=rw $INTERBASE/examples/intlemp.gdb" >> $TmpLogFile echo -e "chmod 4755 $INTERBASE/bin/gstat" >> $TmpLogFile echo -e "Done" echo -e "----------------------------\n" >> $TmpLogFile # # Create the symbolic links # echo -e "Creating symbolic links... \c" echo -e "Creating symbolic links" >> $TmpLogFile if [ -f $INTERBASE/include/gds.h ]; then rm -f /usr/include/gds.h echo -e "rm -f /usr/include/gds.h" >> $TmpLogFile ln -s $IBSymLink/include/gds.h /usr/include/gds.h echo -e "ln -s $IBSymLink/include/gds.h /usr/include/gds.h" >> $TmpLogFile fi if [ -f $INTERBASE/include/ibase.h ]; then rm -f /usr/include/ibase.h echo -e "rm -f /usr/include/ibase.h" >> $TmpLogFile ln -s $IBSymLink/include/ibase.h /usr/include/ibase.h echo -e "ln -s $IBSymLink/include/ibase.h /usr/include/ibase.h" >> $TmpLogFile fi if [ -f $INTERBASE/include/iberror.h ]; then rm -f /usr/include/iberror.h echo -e "rm -f /usr/include/iberror.h" >> $TmpLogFile ln -s $IBSymLink/include/iberror.h /usr/include/iberror.h echo -e "ln -s $IBSymLink/include/iberror.h /usr/include/iberror.h" >> $TmpLogFile fi if [ -f $INTERBASE/include/ib_util.h ]; then rm -f /usr/include/ib_util.h echo -e "rm -f /usr/include/ib_util.h" >> $TmpLogFile ln -s $IBSymLink/include/ib_util.h /usr/include/ib_util.h echo -e "ln -s $IBSymLink/include/ib_util.h /usr/include/ib_util.h" >> $TmpLogFile fi if [ -f $INTERBASE/lib//gds_b.a ]; then rm -f /usr/lib/libgds_b.a echo -e "rm -f /usr/lib/libgds_b.a" >> $TmpLogFile ln -s $IBSymLink/lib/gds_b.a /usr/lib/libgds_b.a echo -e "ln -s $IBSymLink/lib/gds_b.a /usr/lib/libgds_b.a" >> $TmpLogFile fi if [ -f $INTERBASE/lib/gds.a ]; then rm -f /usr/lib/libgds.a echo -e "rm -f /usr/lib/libgds.a" >> $TmpLogFile ln -s $IBSymLink/lib/gds.a /usr/lib/libgds.a echo -e "ln -s $IBSymLink/lib/gds.a /usr/lib/libgds.a" >> $TmpLogFile fi if [ -f $INTERBASE/lib/gds_s.a ]; then rm -f /usr/lib/libgds_s echo -e "rm -f /usr/lib/libgds_s" >> $TmpLogFile rm -f /usr/lib/libgds_s.a echo -e "rm -f /usr/lib/libgds_s.a" >> $TmpLogFile rm -f /usr/lib/libgdsf_s echo -e "rm -f /usr/lib/libgdsf_s" >> $TmpLogFile rm -f /usr/lib/libgdsf_s.a echo -e "rm -f /usr/lib/libgdsf_s.a" >> $TmpLogFile ln -s $IBSymLink/lib/gds_s /usr/lib/libgds_s echo -e "ln -s $IBSymLink/lib/gds_s /usr/lib/libgds_s" >> $TmpLogFile ln -s $IBSymLink/lib/gds_s.a /usr/lib/libgds_s.a echo -e "ln -s $IBSymLink/lib/gds_s.a /usr/lib/libgds_s.a" >> $TmpLogFile ln -s $IBSymLink/lib/gdsf_s /usr/lib/libgdsf_s echo -e "ln -s $IBSymLink/lib/gdsf_s /usr/lib/libgdsf_s" >> $TmpLogFile ln -s $IBSymLink/lib/gdsf_s.a /usr/lib/libgdsf_s.a echo -e "ln -s $IBSymLink/lib/gdsf_s.a /usr/lib/libgdsf_s.a" >> $TmpLogFile fi if [ -f $INTERBASE/lib/gds.so.0 ]; then if [ -d /usr/shlib ]; then rm -f /usr/shlib/libgds.so echo -e "rm -f /usr/shlib/libgds.so" >> $TmpLogFile rm -f /usr/shlib/libgds.so.0 echo -e "rm -f /usr/shlib/libgds.so.0" >> $TmpLogFile ln -s $IBSymLink/lib/gds.so.0 /usr/shlib/libgds.so.0 echo -e "ln -s $IBSymLink/lib/gds.so.0 /usr/shlib/libgds.so.0" >> $TmpLogFile ln -s /usr/shlib/libgds.so.0 /usr/shlib/libgds.so echo -e "ln -s /usr/shlib/libgds.so.0 /usr/shlib/libgds.so" >> $TmpLogFile else rm -f /usr/lib/libgds.so echo -e "rm -f /usr/lib/libgds.so" >> $TmpLogFile rm -f /usr/lib/libgds.so.0 echo -e "rm -f /usr/lib/libgds.so.0" >> $TmpLogFile ln -s $IBSymLink/lib/gds.so.0 /usr/lib/libgds.so.0 echo -e "ln -s $IBSymLink/lib/gds.so.0 /usr/lib/libgds.so.0" >> $TmpLogFile ln -s $IBSymLink/lib/gds.so.0 /usr/lib/libgds.so echo -e "ln -s $IBSymLink/lib/gds.so.0 /usr/lib/libgds.so" >> $TmpLogFile fi fi if [ -f $INTERBASE/lib/gdsf.so ]; then rm -f /usr/lib/libgdsf.so echo -e "rm -f /usr/lib/libgdsf.so" >> $TmpLogFile ln -s $IBSymLink/lib/gdsf.so /usr/lib/libgdsf.so echo -e "ln -s $IBSymLink/lib/gdsf.so /usr/lib/libgdsf.so" >> $TmpLogFile fi if [ -f $INTERBASE/lib/gds_pyxis.a ]; then rm -f /usr/lib/libgds_pyxis.a echo -e "rm -f /usr/lib/libgds_pyxis.a" >> $TmpLogFile ln -s $IBSymLink/lib/gds_pyxis.a /usr/lib/libgds_pyxis.a echo -e "ln -s $IBSymLink/lib/gds_pyxis.a /usr/lib/libgds_pyxis.a" >> $TmpLogFile fi if [ -f $INTERBASE/lib/ib_util.sl ]; then rm -f /usr/lib/libib_util.sl echo -e "rm -f /usr/lib/libib_util.sl" >> $TmpLogFile ln -s $IBSymLink/lib/ib_util.sl /usr/lib/libib_util.sl echo -e "ln -s $IBSymLink/lib/ib_util.sl /usr/lib/libib_util.sl" >> $TmpLogFile fi if [ -f $INTERBASE/lib/ib_util.so ]; then rm -f /usr/lib/libib_util.so echo -e "rm -f /usr/lib/libib_util.so" >> $TmpLogFile ln -s $IBSymLink/lib/ib_util.so /usr/lib/libib_util.so echo -e "ln -s $IBSymLink/lib/ib_util.so /usr/lib/libib_util.so" >> $TmpLogFile fi if [ -f $INTERBASE/lib/ib_udf ]; then rm -f /usr/lib/libib_udf echo -e "rm -f /usr/lib/libib_udf" >> $TmpLogFile ln -s $IBSymLink/lib/ib_udf /usr/lib/libib_udf echo -e "ln -s $IBSymLink/lib/ib_udf /usr/lib/libib_udf" >> $TmpLogFile fi echo -e "Done" echo -e "----------------------------\n" >> $TmpLogFile # # If TCP is installed, update both services and servers databases # echo -e "Updating service name database... \c" echo -e "Updating service name database" >> $TmpLogFile if [ -f /etc/services ]; then grep -q -s gds_db /etc/services if test $? != 0 ; then echo "gds_db 3050/tcp # Borland/InterBase Database Remote Protocol" >> /etc/services echo "gds_db 3050/tcp # Borland/InterBase Database Remote Protocol >> /etc/services " >> $TmpLogFile fi fi echo -e "Done" echo -e "----------------------------\n" >> $TmpLogFile echo -e "Updating configuration file for inetd... \c" echo -e "Updating configuration file for inetd" >> $TmpLogFile if [ -f /etc/inetd.conf ]; then grep -q -s gds_db /etc/inetd.conf if test $? != 0 ; then echo "gds_db stream tcp nowait.100 root /usr/interbase/bin/gds_inet_server gds_inet_server # Borland/InterBase Database Remote Server" >> /etc/inetd.conf echo "gds_db stream tcp nowait.100 root /usr/interbase/bin/gds_inet_server gds_inet_server # Borland/InterBase Database Remote Server >> /etc/inetd.conf " >> $TmpLogFile fi fi echo -e "Done" echo -e "----------------------------\n" >> $TmpLogFile # # Create the license file # if [ "$SUPERSERVER" ]; then INTERBASE="$INTERBASE"; export INTERBASE echo -e "Creating the license file" >> $TmpLogFile echo -e "\nPlease enter the license certificate id: \c" | tee -a $TmpLogFile read id echo -e "$id" >> $TmpLogFile case "$id" in "eval" | "" ) echo -e "Creating a 90-day evaluation license..." | tee -a $TmpLogFile $INTERBASE/bin/iblicense -eval chmod uog=r $INTERBASE/ib_license.dat ;; * ) echo -e "Please enter the license certificate key: \c" | tee -a $TmpLogFile read key echo -e "$key" >> $TmpLogFile if [ -z "$key" ] ; then echo -e "We need the license key which matches your license id." | tee -a $TmpLogFile echo -e "Please enter the license certificate key: \c" | tee -a $TmpLogFile read key echo -e "$key" >> $TmpLogFile fi if [ ! -z "$key" ] ; then echo -e "Creating the license..." | tee -a $TmpLogFile $INTERBASE/bin/iblicense -add -id $id -key $key if [ $? -eq 0 ]; then chmod uog=r $INTERBASE/ib_license.dat else ExitError fi else echo -e "ERROR: No license created. Please see the release notes" | tee -a $TmpLogFile echo -e " to create a license file." | tee -a $TmpLogFile ExitError fi ;; esac fi # # Create /usr/interbase symbolic link # if [ "$INTERBASE" != "$IBSymLink" ]; then echo -e "Creating /usr/interbase symbolic link... \c" echo -e "Creating /usr/interbase symbolic link" >> $TmpLogFile if [ -a "$IBSymLink" -o -L "$IBSymLink" ]; then mv $IBSymLink ${IBSymLink}.$$ echo -e "\nWARNING: Old \"$IBSymLink\" moved to \"${IBSymLink}.$$\"" | tee -a $TmpLogFile fi ln -s $INTERBASE $IBSymLink echo -e "ln -s $INTERBASE $IBSymLink" >> $TmpLogFile echo -e "Done" echo -e "----------------------------\n" >> $TmpLogFile fi # # Move the log file to the $INTERBASE # if [ -f $INTERBASE/$LogFile ]; then cp $INTERBASE/$LogFile $INTERBASE/$LogFile.old echo -e "Old $INTERBASE/$LogFile moved to $INTERBASE/$LogFile.old" >> $TmpLogFile fi mv $TmpLogFile $INTERBASE/$LogFile ExitSuccess