From: Mark O. <sky...@us...> - 2000-10-22 19:32:10
|
Update of /cvsroot/firebird/interbase/firebird/skywalker/install In directory slayer.i.sourceforge.net:/tmp/cvs-serv8525 Added Files: CSrpmscript Makefile SSrpmscript Log Message: New files related to the firebird install for linux/unix --- NEW FILE --- Summary: Firebird Relational Database Server and Client tools. Name: FirebirdCS Version: 0.9 Release: 1 Copyright: Distributable Group: Applications/Databases Source: FirebirdCS0.9src.tar.gz URL: http://firebird.sourceforge.net Prefix: /opt AutoReqProv: no # BuildRoot: /var/tmp/%{name}-buildroot %description Firebird is a powerful, high-performance relational database designed to be embedded into applications on multiple platforms. %prep %build %install %files %dir /opt/interbase %dir /opt/interbase/bin %dir /opt/interbase/lib %dir /opt/interbase/UDF %dir /opt/interbase/intl %dir /opt/interbase/help /opt/interbase/bin/gds_inet_server /opt/interbase/bin/gbak /opt/interbase/bin/gdef /opt/interbase/bin/gds_lock_print /opt/interbase/bin/gds_lock_mgr /opt/interbase/bin/gds_pipe /opt/interbase/bin/gds_drop /opt/interbase/bin/gfix /opt/interbase/bin/gpre /opt/interbase/bin/gsec /opt/interbase/bin/gsplit /opt/interbase/bin/gstat /opt/interbase/bin/isc4.gbak /opt/interbase/bin/isql /opt/interbase/bin/qli /opt/interbase/examples /opt/interbase/help/help.gbak %attr(666, -, -) /opt/interbase/help/help.gdb /opt/interbase/include /usr/include/gds.h /usr/include/iberror.h /usr/include/ibase.h /usr/include/ib_util.h #/opt/interbase/doc /opt/interbase/README /opt/interbase/interbase.msg %attr(666, -, -) /opt/interbase/isc4.gdb /opt/interbase/isc_config /usr/lib/libgds.so.0 /usr/lib/libgds.so /usr/lib/libib_util.so /usr/lib/libgds_pyxis.a /usr/lib/libgds.a /opt/interbase/intl/gdsintl /opt/interbase/UDF/ib_udf /opt/interbase/services.isc %pre #!/bin/sh # The pre install routine for Firebird Classic #------------------------------------------------------------------------ # Prompt for response, store result in Answer Answer="" AskQuestion() { Test=$1 DefaultAns=$2 echo -n "${1}" Answer="$DefaultAns" read Answer } #------------------------------------------------------------------------ # stop super server if it is running # Also will only stop firebird, since that has the init script stopServerIfRunning() { checkString=`ps -efww| egrep "(ibserver|ibguard)" |grep -v grep` if [ ! -z "$checkString" ] then if [ -f /etc/rc.d/init.d/firebird ] then /etc/rc.d/init.d/firebird stop fi fi } #------------------------------------------------------------------------ # stop server if it is running checkIfServerRunning() { stopServerIfRunning # Check is server is being actively used. checkString=`ps -efww| egrep "(ibserver|ibguard)" |grep -v grep` if [ ! -z "$checkString" ] then echo "An instance of the Firebird/InterBase Super server seems to be running." echo "Please quit all interbase applications and then proceed" exit 1 fi checkString=`ps -efww| egrep "(gds_inet_server|gds_pipe)" |grep -v grep` if [ ! -z "$checkString" ] then echo "An instance of the Firebird/InterBase server seems to be running." echo "Please quit all interbase applications and then proceed." exit 1 fi # Stop lock manager if it is the only thing running. for i in `ps -efww | grep "gds_lock_mgr" | grep -v "grep" | awk '{print $2}' ` do kill $i done } #------------------------------------------------------------------------ # Run process and check status runAndCheckExit() { Cmd=$* # echo $Cmd $Cmd ExitCode=$? if [ $ExitCode -ne 0 ] then echo "Install aborted: The command $Cmd " echo " failed with error code $ExitCode" exit $ExitCode fi } #------------------------------------------------------------------------ # Display message if this is being run interactively. displayMessage() { msgText=$1 if [ ! -z "$InteractiveInstall" ] then echo $msgText fi } #------------------------------------------------------------------------ # Archive any existing prior installed files. # The 'cd' stuff is to avoid the "leading '/' removed message from tar. # for the same reason the DestFile is specified without the leading "/" archivePriorInstallSystemFiles() { oldPWD=`pwd` archiveFileList="" cd / DestFile="opt/interbase" if [ -e "$DestFile" ] then echo "" echo "" echo "" echo "--- Warning ----------------------------------------------" echo " The installation target directory: $IBRootDir" echo " Already contains a prior installation of InterBase/Firebird." echo " This and files found in /usr/include and /usr/lib will be" echo " archived in the file : ${ArchiveMainFile}" echo "" if [ ! -z "$InteractiveInstall" ] then AskQuestion "Press return to continue or ^C to abort" fi if [ -e $DestFile ] then archiveFileList="$archiveFileList $DestFile" fi fi for i in gds.h ibase.h iberror.h ib_util.h do DestFile=usr/include/$i if [ -e $DestFile ] then archiveFileList="$archiveFileList $DestFile" fi done for i in gds_pyxis.a gds.a libgds.so.0 libgds.so ib_util.so do DestFile=usr/lib/$i if [ -e $DestFile ] then archiveFileList="$archiveFileList $DestFile" fi done if [ ! -z "$archiveFileList" ] then displayMessage "Archiving..." runAndCheckExit "tar -czf $ArchiveMainFile $archiveFileList" displayMessage "Done." displayMessage "Deleting..." for i in $archiveFileList do rm -rf $i done displayMessage "Done." fi cd $oldPWD } #------------------------------------------------------------------------ # Check for installed RPM package checkForRPMInstall() { PackageName=$1 rpm -q $PackageName STATUS=$? if [ $STATUS -eq 0 ] then echo "Previous version of $PackageName is detected on your system." echo "this will conflict with the current install of Firebird" echo "Please unistall the previous version `rpm -q $PackageName` and then proceed." exit $STATUS fi } #= Main Pre ================================================================ IBRootDir=/opt/interbase IBBin=$IBRootDir/bin ArchiveDateTag=`date +"%Y%m%d_%H%M"` ArchiveMainFile="${IBRootDir}_${ArchiveDateTag}.tar.gz" # Ok so any of the following packages are a problem # these don't work at least in the latest rpm manager, since it # has the rpm database locked and it fails. # checkForRPMInstall InterBase # checkForRPMInstall FirebirdCS # checkForRPMInstall FirebirdSS checkIfServerRunning # Failing that we archive any files we find archivePriorInstallSystemFiles %post #!/bin/sh # The post install script for Firebird Classic #------------------------------------------------------------------------ # Prompt for response, store result in Answer Answer="" AskQuestion() { Test=$1 DefaultAns=$2 echo -n "${1}" Answer="$DefaultAns" read Answer } #------------------------------------------------------------------------ # add a service line in the (usually) /etc/services or /etc/inetd.conf file # Here there are three cases, not found => add service line, # found & different => ask user to check # found & same => do nothing # replaceLineInFile() { FileName=$1 newLine=$2 oldLine=$3 if [ -z "$oldLine" ] then echo "$newLine" >> $FileName elif [ "$oldLine" != "$newLine" ] then echo "" echo "--- Warning ----------------------------------------------" echo "" echo " In file $FileName found line: " echo " $oldLine" echo " Which differs from the expected line:" echo " $newLine" echo "" # AskQuestion "Press return to update file or ^C to abort install" cat $FileName | grep -v "$oldLine" > ${FileName}.tmp mv ${FileName}.tmp $FileName echo "$newLine" >> $FileName echo "Updated." fi } #------------------------------------------------------------------------ # Generate new sysdba password - this routine is used only in the # rpm file not in the install acript. generateNewDBAPassword() { DBAPasswordFile=$IBRootDir/SYSDBA.password NewPasswd=`mkpasswd -l 8` echo "Firebird generated password " > $DBAPasswordFile echo "for user SYSDBA is : $NewPasswd" >> $DBAPasswordFile echo "generated on `hostname` at time `date`" >> $DBAPasswordFile echo "(For superserver you will also want to check the password in the" >> $DBAPasswordFile echo "daemon init routine in the file /etc/rc.d/init.d/firebird)" >> $DBAPasswordFile echo "" >> $DBAPasswordFile echo "Your password can be changed to a more suitable one using the" >> $DBAPasswordFile echo "/opt/interbase/bin/gsec program as show below:" >> $DBAPasswordFile echo "" >> $DBAPasswordFile echo ">cd /opt/interbase" >> $DBAPasswordFile echo ">bin/gsec -user sysdba -password <password>" >> $DBAPasswordFile echo "GSEC>modify sysdba -pw <newpassword>" >> $DBAPasswordFile echo "GSEC>quit" >> $DBAPasswordFile chmod u=r,go= $DBAPasswordFile $IBBin/gsec -user sysdba -password masterkey <<EOF modify sysdba -pw $NewPasswd EOF } #------------------------------------------------------------------------ # Change sysdba password - this routine is interactive and is only # used in the install shell script not the rpm one. askUserForNewDBAPassword() { NewPasswd="" while [ -z "$NewPasswd" ] do # If using a generated password # DBAPasswordFile=$IBRootDir/SYSDBA.password # NewPasswd=`mkpasswd -l 8` # echo "Password for SYSDBA on `hostname` is : $NewPasswd" > $DBAPasswordFile # chmod ga-rwx $DBAPasswordFile AskQuestion "Please enter new password for SYSDBA user: " NewPasswd=$Answer if [ ! -z "$NewPasswd" ] then $IBBin/gsec -user sysdba -password masterkey <<EOF modify sysdba -pw $NewPasswd EOF echo "" fi done } #------------------------------------------------------------------------ # Change sysdba password - this routine is interactive and is only # used in the install shell script not the rpm one. changeDBAPassword() { if [ -z "$InteractiveInstall" ] then generateNewDBAPassword else askUserForNewDBAPassword fi } #= Main Post =============================================================== # Make sure the links are in place if [ ! -L /opt/interbase -a ! -d /opt/interbase ] then # Main link and... ln -s $RPM_INSTALL_PREFIX/interbase /opt/interbase fi IBRootDir=/opt/interbase IBBin=$IBRootDir/bin RunUser=root # Update /etc/services FileName=/etc/services newLine="gds_db 3050/tcp # InterBase Database Remote Protocol" oldLine=`grep "^gds_db" $FileName` replaceLineInFile "$FileName" "$newLine" "$oldLine" # Update the /etc/inetd.conf FileName=/etc/inetd.conf newLine="gds_db stream tcp nowait.30000 $RunUser $IBBin/gds_inet_server gds_inet_server # InterBase Database Remote Server" oldLine=`grep "^gds_db" $FileName` replaceLineInFile "$FileName" "$newLine" "$oldLine" # Update ownership and SUID bits for programs. chown -R $RunUser.$RunUser $IBRootDir cd $IBBin for i in gds_lock_mgr gds_drop gds_inet_server do chmod ug+s $i done # Get inetd to reread new init files. if [ -f /var/run/inetd.pid ] then kill -HUP `cat /var/run/inetd.pid` fi # Lock files # remember isc_guard1 in addition for super cd $IBRootDir for i in isc_init1 isc_lock1 isc_event1 do FileName=$i.`hostname` touch $FileName chmod uga+rw $FileName done touch interbase.log chmod uga+rw interbase.log # Change sysdba password changeDBAPassword %preun #! /bin/sh # The pre uninstall routines for Firebird Classic #------------------------------------------------------------------------ # stop server if it is running checkIfServerRunning() { # Check is server is being actively used. checkString=`ps -ef| egrep "(gds_inet_server|gds_pipe)" |grep -v grep` if [ ! -z "$checkString" ] then echo "An instance of the Firebird/InterBase server seems to be running." echo "Please quit all interbase applications and then proceed." exit 1 fi # Stop lock manager if it is the only thing running. for i in `ps -ef | grep "gds_lock_mgr" | grep -v "grep" | cut -d' ' -f3` do kill $i done } #= Main PreUn ================================================================ # This is a bit simple, but should work for now. # cron will remove files in /tmp after a while. IBRootDir=/opt/interbase IBBin=$IBRootDir/bin checkIfServerRunning cd $IBRootDir if [ -f isc4.gdb ] then cp isc4.gdb /tmp echo "Saved a copy of isc4.gdb in /tmp" fi for i in isc_init1* isc_event1* isc_lock1* interbase.log SYSDBA.password do if [ -f $i ] then rm -f $i fi done %postun #!/bin/sh # The post uninstall routine for Firebird Classic. #------------------------------------------------------------------------ # remove line from config file if it exists in it. removeLineFromFile() { FileName=$1 oldLine=$2 if [ ! -z "$oldLine" ] then cat $FileName | grep -v "$oldLine" > ${FileName}.tmp mv ${FileName}.tmp $FileName echo "Updated." fi } #= Main PostUn ============================================================ if [ -L /usr/lib/libgds.so ] then rm /usr/lib/libgds.so fi if [ "$1"=0 ] then # Lose the gds_db line from /etc/services FileName=/etc/services oldLine=`grep "^gds_db" $FileName` removeLineFromFile "$FileName" "$oldLine" # Next, lose the gds_db line from /etc/inetd.conf FileName=/etc/inetd.conf oldLine=`grep "^gds_db" $FileName` removeLineFromFile "$FileName" "$oldLine" # Get inetd to reread new inetd.conf file if [ -f /var/run/inetd.pid ] then kill -HUP `cat /var/run/inetd.pid` fi fi --- NEW FILE --- .PHONY: all CSrpmscript SSrpmscript csinstall ssinstall ClassicSrcDir=classic/ SuperSrcDir=super/ all: CSrpmscript SSrpmscript csinstall ssinstall CSrpmscript: echo $@ cat $(ClassicSrcDir)CSrpmheader.txt > $@ echo "" >> $@ echo "%prep" >> $@ # cat $(ClassicSrcDir)CSprepinstall.sh >> $@ echo "" >> $@ echo "%build" >> $@ # cat $(ClassicSrcDir)CSbuildinstall.sh >> $@ echo "" >> $@ echo "%install" >> $@ # cat $(ClassicSrcDir)CSinstall.sh >> $@ echo "" >> $@ echo "%files" >> $@ cat $(ClassicSrcDir)CSrpmfiles.txt >> $@ echo "" >> $@ echo "%pre" >> $@ cat $(ClassicSrcDir)CSpreinstall.sh >> $@ echo "" >> $@ echo "%post" >> $@ cat $(ClassicSrcDir)CSpostinstall.sh >> $@ echo "" >> $@ echo "%preun" >> $@ cat $(ClassicSrcDir)CSpreuninstall.sh >> $@ echo "" >> $@ echo "%postun" >> $@ cat $(ClassicSrcDir)CSpostuninstall.sh >> $@ SSrpmscript: echo $@ cat $(SuperSrcDir)SSrpmheader.txt > $@ echo "" >> $@ echo "%prep" >> $@ # cat $(SuperSrcDir)SSprepinstall.sh >> $@ echo "" >> $@ echo "%build" >> $@ # cat $(SuperSrcDir)SSbuildinstall.sh >> $@ echo "" >> $@ echo "%install" >> $@ # cat $(SuperSrcDir)SSinstall.sh >> $@ echo "" >> $@ echo "%files" >> $@ cat $(SuperSrcDir)SSrpmfiles.txt >> $@ echo "" >> $@ echo "%pre" >> $@ cat $(SuperSrcDir)SSpreinstall.sh >> $@ echo "" >> $@ echo "%post" >> $@ cat $(SuperSrcDir)SSpostinstall.sh >> $@ echo "" >> $@ echo "%preun" >> $@ cat $(SuperSrcDir)SSpreuninstall.sh >> $@ echo "" >> $@ echo "%postun" >> $@ cat $(SuperSrcDir)SSpostuninstall.sh >> $@ CSTarInstallDir=csinstall csinstall: mkdir -p $(CSTarInstallDir)/scripts cp $(ClassicSrcDir)CSpreinstall.sh $(CSTarInstallDir)/scripts cp $(ClassicSrcDir)CSinstall.sh $(CSTarInstallDir)/scripts cp $(ClassicSrcDir)CSpostinstall.sh $(CSTarInstallDir)/scripts cp $(ClassicSrcDir)CSTarInstall.sh $(CSTarInstallDir)/install.sh SSTarInstallDir=ssinstall ssinstall: mkdir -p $(SSTarInstallDir)/scripts cp $(SuperSrcDir)SSpreinstall.sh $(SSTarInstallDir)/scripts cp $(SuperSrcDir)SSinstall.sh $(SSTarInstallDir)/scripts cp $(SuperSrcDir)SSpostinstall.sh $(SSTarInstallDir)/scripts cp $(SuperSrcDir)SSTarInstall.sh $(SSTarInstallDir)/install.sh --- NEW FILE --- Summary: Firebird Database Server and Client tools. Name: FirebirdSS Version: 0.9 Release: 1 Copyright: Distributable Group: Applications/Databases Source: FirebirdSS0.9src.tar.gz URL: http://firebird.sourceforge.net Prefix: /opt AutoReqProv: no %description Firebird is a powerful, high-performance relational database designed to be embedded into applications on multiple platforms. %prep %build %install %files %dir /opt/interbase %dir /opt/interbase/bin %dir /opt/interbase/lib %dir /opt/interbase/UDF %dir /opt/interbase/intl %dir /opt/interbase/help /opt/interbase/bin/gbak /opt/interbase/bin/gdef /opt/interbase/bin/gds_lock_print /opt/interbase/bin/gfix /opt/interbase/bin/gpre /opt/interbase/bin/gsec /opt/interbase/bin/gsplit /opt/interbase/bin/gstat /opt/interbase/bin/isc4.gbak /opt/interbase/bin/isql /opt/interbase/bin/qli /opt/interbase/bin/ibmgr.bin /opt/interbase/bin/ibserver /opt/interbase/bin/ibguard /opt/interbase/examples /opt/interbase/help/help.gbak /opt/interbase/help/help.gdb /opt/interbase/include /usr/include/gds.h /usr/include/iberror.h /usr/include/ibase.h /opt/interbase/doc /opt/interbase/interbase.msg /opt/interbase/isc4.gdb /opt/interbase/isc_config /usr/lib/libgds.so.0 /usr/lib/libgds.so /usr/lib/libib_util.so /usr/lib/libgds_pyxis.a /opt/interbase/intl/gdsintl /opt/interbase/UDF/ib_udf /opt/interbase/services.isc /opt/interbase/README /etc/rc.d/init.d/firebird %pre #! /bin/sh #------------------------------------------------------------------------ # Prompt for response, store result in Answer Answer="" AskQuestion() { Test=$1 DefaultAns=$2 echo -n "${1}" Answer="$DefaultAns" read Answer } #------------------------------------------------------------------------ # stop super server if it is running # Also will only stop firebird, since that has the init script stopServerIfRunning() { checkString=`ps -efww| egrep "(ibserver|ibguard)" |grep -v grep` if [ ! -z "$checkString" ] then if [ -f /etc/rc.d/init.d/firebird ] then /etc/rc.d/init.d/firebird stop fi fi } #------------------------------------------------------------------------ # Check if server is running checkIfServerRunning() { stopServerIfRunning checkString=`ps -efww| egrep "(ibserver|ibguard)" |grep -v grep` if [ ! -z "$checkString" ] then echo "An instance of the Firebird/InterBase Super server seems to be running." echo "Please quit all interbase applications and then proceed" exit 1 fi checkString=`ps -efww| egrep "(gds_inet_server|gds_pipe)" |grep -v grep` if [ ! -z "$checkString" ] then echo "An instance of the Firebird/InterBase server seems to be running." echo "Please quit all interbase applications and then proceed." exit 1 fi # Stop lock manager if it is the only thing running. for i in `ps -efww | grep "gds_lock_mgr" | grep -v "grep" | awk '{print $2}' ` do kill $i done } #------------------------------------------------------------------------ # Run process and check status runAndCheckExit() { Cmd=$* # echo $Cmd $Cmd ExitCode=$? if [ $ExitCode -ne 0 ] then echo "Install aborted: The command $Cmd " echo " failed with error code $ExitCode" exit $ExitCode fi } #------------------------------------------------------------------------ # Display message if this is being run interactively. displayMessage() { msgText=$1 if [ ! -z "$InteractiveInstall" ] then echo $msgText fi } #------------------------------------------------------------------------ # Archive any existing prior installed files. # The 'cd' stuff is to avoid the "leading '/' removed message from tar. # for the same reason the DestFile is specified without the leading "/" archivePriorInstallSystemFiles() { oldPWD=`pwd` archiveFileList="" cd / DestFile="opt/interbase" if [ -e "$DestFile" ] then echo "" echo "" echo "" echo "--- Warning ----------------------------------------------" echo " The installation target directory: $IBRootDir" echo " Already contains a prior installation of InterBase/Firebird." echo " This and files found in /usr/include and /usr/lib will be" echo " archived in the file : ${ArchiveMainFile}" echo "" if [ ! -z "$InteractiveInstall" ] then AskQuestion "Press return to continue or ^C to abort" fi if [ -e $DestFile ] then archiveFileList="$archiveFileList $DestFile" fi fi for i in gds.h ibase.h iberror.h ib_util.h do DestFile=usr/include/$i if [ -e $DestFile ] then archiveFileList="$archiveFileList $DestFile" fi done for i in gds_pyxis.a gds.a libgds.so.0 libgds.so ib_util.so do DestFile=usr/lib/$i if [ -e $DestFile ] then archiveFileList="$archiveFileList $DestFile" fi done if [ ! -z "$archiveFileList" ] then displayMessage "Archiving..." runAndCheckExit "tar -czf $ArchiveMainFile $archiveFileList" displayMessage "Done." displayMessage "Deleting..." for i in $archiveFileList do rm -rf $i done displayMessage "Done." fi cd $oldPWD } #------------------------------------------------------------------------ # Check for installed RPM package checkForRPMInstall() { PackageName=$1 rpm -q $PackageName STATUS=$? if [ $STATUS -eq 0 ] then echo "Previous version of $PackageName is detected on your system." echo "this will conflict with the current install of Firebird" echo "Please unistall the previous version `rpm -q $PackageName` and then proceed." exit $STATUS fi } #== Main Pre ================================================================= IBRootDir=/opt/interbase IBBin=$IBRootDir/bin ArchiveDateTag=`date +"%Y%m%d_%H%M"` ArchiveMainFile="${IBRootDir}_${ArchiveDateTag}.tar.gz" # Ok so any of the following packages are a problem # these don't work at least in the latest rpm manager, since it # has the rpm database locked and it fails. # checkForRPMInstall InterBase # checkForRPMInstall FirebirdCS # checkForRPMInstall FirebirdSS checkIfServerRunning # Failing that we archive any files we find archivePriorInstallSystemFiles %post #! /bin/sh #------------------------------------------------------------------------ # Prompt for response, store result in Answer Answer="" AskQuestion() { Test=$1 DefaultAns=$2 echo -n "${1}" Answer="$DefaultAns" read Answer } #------------------------------------------------------------------------ # add a service line in the (usually) /etc/services or /etc/inetd.conf file # Here there are three cases, not found => add service line, # found & different => ask user to check # found & same => do nothing # replaceLineInFile() { FileName=$1 newLine=$2 oldLine=$3 if [ -z "$oldLine" ] then echo "$newLine" >> $FileName elif [ "$oldLine" != "$newLine" ] then echo "" echo "--- Warning ----------------------------------------------" echo "" echo " In file $FileName found line: " echo " $oldLine" echo " Which differs from the expected line:" echo " $newLine" echo "" # AskQuestion "Press return to update file or ^C to abort install" cat $FileName | grep -v "$oldLine" > ${FileName}.tmp mv ${FileName}.tmp $FileName echo "$newLine" >> $FileName echo "Updated." fi } #------------------------------------------------------------------------ # remove line from config file if it exists in it. removeLineFromFile() { FileName=$1 oldLine=$2 if [ ! -z "$oldLine" ] then cat $FileName | grep -v "$oldLine" > ${FileName}.tmp mv ${FileName}.tmp $FileName echo "Updated." fi } #------------------------------------------------------------------------ # changeInitPassword changeInitPassword() { NewPasswd=$1 InitFile=/etc/rc.d/init.d/firebird if [ -f $InitFile ] then ed $InitFile <<EOF /ISC_PASSWORD/s/ISC_PASSWORD:=.*\}/ISC_PASSWORD=$NewPasswd\}/g w q EOF chmod u=rwx,g=rx,o= $InitFile fi } #------------------------------------------------------------------------ # Generate new sysdba password generateNewDBAPassword() { DBAPasswordFile=$IBRootDir/SYSDBA.password NewPasswd=`mkpasswd -l 8` echo "Firebird generated password " > $DBAPasswordFile echo "for user SYSDBA is : $NewPasswd" >> $DBAPasswordFile echo "generated on `hostname` at time `date`" >> $DBAPasswordFile echo "" >> $DBAPasswordFile echo "(For superserver you will also want to check the password in the" >> $DBAPasswordFile echo "daemon init routine in the file /etc/rc.d/init.d/firebird)" >> $DBAPasswordFile echo "" >> $DBAPasswordFile echo "Your password can be changed to a more suitable one using the" >> $DBAPasswordFile echo "/opt/interbase/bin/gsec program as show below:" >> $DBAPasswordFile echo "" >> $DBAPasswordFile echo ">cd /opt/interbase" >> $DBAPasswordFile echo ">bin/gsec -user sysdba -password <password>" >> $DBAPasswordFile echo "GSEC>modify sysdba -pw <newpassword>" >> $DBAPasswordFile echo "GSEC>quit" >> $DBAPasswordFile chmod u=rw,go= $DBAPasswordFile $IBBin/gsec -user sysdba -password masterkey <<EOF modify sysdba -pw $NewPasswd EOF changeInitPassword "$NewPasswd" } #------------------------------------------------------------------------ # Change sysdba password - this routine is interactive and is only # used in the install shell script not the rpm one. askUserForNewDBAPassword() { NewPasswd="" echo "" while [ -z "$NewPasswd" ] do AskQuestion "Please enter new password for SYSDBA user: " NewPasswd=$Answer if [ ! -z "$NewPasswd" ] then $IBBin/gsec -user sysdba -password masterkey <<EOF modify sysdba -pw $NewPasswd EOF echo "" changeInitPassword "$NewPasswd" fi done } #------------------------------------------------------------------------ # Change sysdba password - this routine is interactive and is only # used in the install shell script not the rpm one. changeDBAPassword() { if [ -z "$InteractiveInstall" ] then generateNewDBAPassword else askUserForNewDBAPassword fi } #= Main Post =============================================================== # Make sure the links are in place if [ ! -L /opt/interbase -a ! -d /opt/interbase ] then # Main link and... ln -s $RPM_INSTALL_PREFIX/interbase /opt/interbase fi IBRootDir=/opt/interbase IBBin=$IBRootDir/bin RunUser=root # Update /etc/services FileName=/etc/services newLine="gds_db 3050/tcp # InterBase Database Remote Protocol" oldLine=`grep "^gds_db" $FileName` replaceLineInFile "$FileName" "$newLine" "$oldLine" # remove any gds_db line in the /etc/inetd.conf FileName=/etc/inetd.conf oldLine=`grep "^gds_db" $FileName` removeLineFromFile "$FileName" "$oldLine" # Get inetd to reread new init files. if [ -f /var/run/inetd.pid ] then kill -HUP `cat /var/run/inetd.pid` fi # Update ownership of programs chown -R $RunUser.$RunUser $IBRootDir cd $IBBin # Create the ibmgr shell script. cat > ibmgr <<EOF #!/bin/sh INTERBASE=$IBRootDir export INTERBASE exec \$INTERBASE/bin/ibmgr.bin \$@ EOF chmod u=rwx,go=rx * # These two should only be executed by firebird user. chmod u=rwx,go= ibguard ibserver # Lock files cd $IBRootDir for i in isc_init1 isc_lock1 isc_event1 isc_guard1 do FileName=$i.`hostname` touch $FileName chmod ug=rw,o= $FileName done touch interbase.log chmod u=rw,go= interbase.log chmod ug+rx,o= /etc/rc.d/init.d/firebird # This will start it at runlevel defined within the firebird file itself. /sbin/chkconfig --add firebird # start the db server so we can change the password (cd /etc/rc.d/init.d; ./firebird start) # Change sysdba password changeDBAPassword %preun #! /bin/sh #------------------------------------------------------------------------ # stop server if it is running stopServerIfRunning() { checkString=`ps -ef| egrep "(ibserver|ibguard)" |grep -v grep` if [ ! -z "$checkString" ] then /etc/rc.d/init.d/firebird stop fi } #= Main PreUn ================================================================ IBRootDir=/opt/interbase IBBin=$IBRootDir/bin stopServerIfRunning /sbin/chkconfig --del firebird cd $IBRootDir if [ -f isc4.gdb ] then cp isc4.gdb /tmp echo "Saved a copy of isc4.gdb in /tmp" fi for i in isc_init1* isc_event1* isc_lock1* isc_guard* interbase.log SYSDBA.password do if [ -f $i ] then rm -f $i fi done rm -f $IBBin/ibmgr %postun #! /bin/sh #------------------------------------------------------------------------ # remove line from config file if it exists in it. removeLineFromFile() { FileName=$1 oldLine=$2 if [ ! -z "$oldLine" ] then cat $FileName | grep -v "$oldLine" > ${FileName}.tmp mv ${FileName}.tmp $FileName echo "Updated." fi } #= Main ProstUn =============================================================== if [ -L /usr/lib/libgds.so ] then rm -f /usr/lib/libgds.so fi # Update /etc/services FileName=/etc/services oldLine=`grep "^gds_db" $FileName` removeLineFromFile "$FileName" "$oldLine" |