mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 16:43:03 +01:00
Added the linux/unix install to fb2
also modified a bit to start working with autoconf
This commit is contained in:
parent
9d3b9ed3ae
commit
5dc9d07e52
222
src/install/Makefile.in
Normal file
222
src/install/Makefile.in
Normal file
@ -0,0 +1,222 @@
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
# Alternatively, the contents of this file may be used under the
|
||||
# terms of the GNU General Public License Version 2 or later (the
|
||||
# "GPL"), in which case the provisions of the GPL are applicable
|
||||
# instead of those above. You may obtain a copy of the Licence at
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# Relevant for more details.
|
||||
#
|
||||
# This file was created by members of the firebird development team.
|
||||
# All individual contributions remain the Copyright (C) of those
|
||||
# individuals. Contributors to this file are either listed here or
|
||||
# can be obtained from a CVS history command.
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Created by: Mark O'Donohue <mark.odonohue@ludwig.edu.au>
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
#
|
||||
# $Id: Makefile.in,v 1.1 2001-08-01 07:59:14 skywalker Exp $
|
||||
#
|
||||
|
||||
ROOT=../..
|
||||
|
||||
|
||||
|
||||
include $(ROOT)/src/make.rules
|
||||
include $(ROOT)/src/make.defaults
|
||||
include $(ROOT)/src/make.platform
|
||||
include $(ROOT)/src/make.shared.variables
|
||||
|
||||
INSTALLDIR=@prefix@
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
|
||||
.PHONY: all CSrpmscript SSrpmscript ssinstall runclassicinstall \
|
||||
classicpackages
|
||||
|
||||
|
||||
# Some of these targets are run from the root tree of the build.
|
||||
# those need to know where the install subdirectory is kept.
|
||||
# Others are run locally these need to know the path back to the
|
||||
# root of the build tree.
|
||||
|
||||
BuildRoot=$(GEN_ROOT)
|
||||
|
||||
InstallRoot=$(SRC_ROOT)/src/install/linux
|
||||
RedhatPackageDir=/usr/src/redhat/RPMS/i386
|
||||
|
||||
Version=1.5.0-1
|
||||
|
||||
|
||||
ClassicTarFile=FirebirdCS-$(Version).tar.gz
|
||||
SuperTarFile=FirebirdSS-$(Version).tar.gz
|
||||
|
||||
ClassicRPMFile=FirebirdCS-$(Version).i386.rpm
|
||||
SuperRPMFile=FirebirdSS-$(Version).i386.rpm
|
||||
|
||||
ClassicSrcDir=$(InstallRoot)/classic
|
||||
SuperSrcDir=$(InstallRoot)/super
|
||||
|
||||
LastClassicInstallFlg=.classicinstallflg
|
||||
LastSuperInstallFlg=.superinstallflg
|
||||
|
||||
install:
|
||||
@echo "you need to make a choice here "
|
||||
@echo "make target"
|
||||
@echo ""
|
||||
@echo "Firebird classic targets:"
|
||||
@echo "runclassicinstall - install classic from build tree"
|
||||
@echo "classicpackages - build tar and rpm install files"
|
||||
@echo "classictarfile - build tar install file"
|
||||
@echo "classicrpmfile - build redhat rpm install file"
|
||||
@echo ""
|
||||
@echo "Firebird super targets:"
|
||||
@echo "runsuperinstall - install super from build tree"
|
||||
@echo "superpackages - build tar and rpm install files"
|
||||
@echo "supertarfile - build tar install file"
|
||||
@echo "superrpmfile - build redhat rpm install file"
|
||||
@echo ""
|
||||
|
||||
all2: CSrpmscript SSrpmscript csinstall ssinstall
|
||||
|
||||
|
||||
classicpackages: classictarfile classicrpmfile
|
||||
|
||||
runclassicinstall: $(LastClassicInstallFlg)
|
||||
|
||||
|
||||
classictarfile: runclassicinstall $(ClassicTarFile)
|
||||
|
||||
classicrpmfile: runclassicinstall $(ClassicRPMFile)
|
||||
|
||||
|
||||
$(LastClassicInstallFlg) : $(BIN)/gsec
|
||||
sh $(InstallRoot)/classic/CSTarInstall.sh
|
||||
touch $(LastClassicInstallFlg)
|
||||
|
||||
$(ClassicTarFile) : csinstall runclassicinstall
|
||||
mv csinstall install
|
||||
tar -czf $(ClassicTarFile) install
|
||||
mv install csinstall
|
||||
|
||||
|
||||
$(ClassicRPMFile): CSrpmscript
|
||||
rpm -bb CSrpmscript
|
||||
cp $(RedhatPackageDir)/$(ClassicRPMFile) .
|
||||
|
||||
|
||||
superpackages: supertarfile superrpmfile
|
||||
|
||||
runsuperinstall: $(LastSuperInstallFlg)
|
||||
|
||||
|
||||
supertarfile: runsuperinstall $(SuperTarFile)
|
||||
|
||||
superrpmfile: runsuperinstall $(SuperRPMFile)
|
||||
|
||||
|
||||
$(LastSuperInstallFlg) : interbase/bin/gsec
|
||||
sh $(InstallRoot)/super/SSTarInstall.sh
|
||||
touch $(LastSuperInstallFlg)
|
||||
|
||||
$(SuperTarFile) : ssinstall runsuperinstall
|
||||
mv ssinstall install
|
||||
tar -czf $(SuperTarFile) install
|
||||
mv install ssinstall
|
||||
|
||||
|
||||
$(SuperRPMFile): SSrpmscript
|
||||
rpm -bb SSrpmscript
|
||||
cp $(RedhatPackageDir)/$(SuperRPMFile) .
|
||||
|
||||
|
||||
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
|
||||
# (cd $(BuildRoot); tar -czf - interbase ) | cat > $(CSTarInstallDir)/interbase.tar.gz
|
||||
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
|
||||
tar -czf $(CSTarInstallDir)/interbase.tar.gz interbase
|
||||
|
||||
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
|
||||
tar -czf $(SSTarInstallDir)/interbase.tar.gz interbase
|
697
src/install/arch-specific/linux/CSrpmscript
Normal file
697
src/install/arch-specific/linux/CSrpmscript
Normal file
@ -0,0 +1,697 @@
|
||||
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
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Unable to generate the password for the rpm, so put out a message
|
||||
# instead
|
||||
|
||||
|
||||
keepOrigDBAPassword() {
|
||||
|
||||
DBAPasswordFile=$IBRootDir/SYSDBA.password
|
||||
|
||||
NewPasswd='masterkey'
|
||||
echo "Firebird initial install password " > $DBAPasswordFile
|
||||
echo "for user SYSDBA is : $NewPasswd" >> $DBAPasswordFile
|
||||
|
||||
echo "for install on `hostname` at time `date`" >> $DBAPasswordFile
|
||||
echo "You should change this password at the earliest oportunity" >> $DBAPasswordFile
|
||||
echo ""
|
||||
|
||||
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 should 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
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Generate new sysdba password - this routine is used only in the
|
||||
# rpm file not in the install acript.
|
||||
|
||||
|
||||
generateNewDBAPassword() {
|
||||
|
||||
DBAPasswordFile=$IBRootDir/SYSDBA.password
|
||||
|
||||
NewPasswd=`/usr/bin/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.
|
||||
|
||||
# On some systems the mkpasswd program doesn't appear and on others
|
||||
# there is another mkpasswd which does a different operation. So if
|
||||
# the specific one isn't available then keep the original password.
|
||||
|
||||
|
||||
changeDBAPassword() {
|
||||
|
||||
if [ -z "$InteractiveInstall" ]
|
||||
then
|
||||
if [ -f /usr/bin/mkpasswd ]
|
||||
then
|
||||
generateNewDBAPassword
|
||||
else
|
||||
keepOrigDBAPassword
|
||||
fi
|
||||
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
|
||||
|
||||
|
||||
# make examples writable by anyone
|
||||
chmod uga+rw examples/*.gdb
|
||||
|
||||
# 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
|
3
src/install/arch-specific/linux/Makefile.in
Normal file
3
src/install/arch-specific/linux/Makefile.in
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
|
||||
# Hello 1
|
672
src/install/arch-specific/linux/SSrpmscript
Normal file
672
src/install/arch-specific/linux/SSrpmscript
Normal file
@ -0,0 +1,672 @@
|
||||
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"
|
||||
|
125
src/install/classic/CSTarInstall.sh
Executable file
125
src/install/classic/CSTarInstall.sh
Executable file
@ -0,0 +1,125 @@
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Prompt for response, store result in Answer
|
||||
|
||||
Answer=""
|
||||
|
||||
AskQuestion() {
|
||||
Test=$1
|
||||
DefaultAns=$2
|
||||
echo -n "${1}"
|
||||
Answer="$DefaultAns"
|
||||
read Answer
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Prompt for yes or no answer - returns non-zero for no
|
||||
|
||||
AskYNQuestion() {
|
||||
while echo -n "${*} (y/n): "
|
||||
do
|
||||
read answer rest
|
||||
case $answer in
|
||||
[yY]*)
|
||||
return 0
|
||||
;;
|
||||
[nN]*)
|
||||
return 1
|
||||
;;
|
||||
*)
|
||||
echo "Please answer y or n"
|
||||
;;
|
||||
esac
|
||||
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
|
||||
fi
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Check for a previous install
|
||||
|
||||
|
||||
checkInstallUser() {
|
||||
|
||||
if [ "`whoami`" != "root" ];
|
||||
then
|
||||
echo ""
|
||||
echo "--- Warning ----------------------------------------------"
|
||||
echo ""
|
||||
echo " You need to be 'root' user to install"
|
||||
echo ""
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
#== Main Program ==========================================================
|
||||
|
||||
|
||||
InteractiveInstall=1
|
||||
export InteractiveInstall
|
||||
|
||||
|
||||
checkInstallUser
|
||||
|
||||
# Ok, here we are installing from a CVS tree
|
||||
|
||||
if [ -e firebird ]
|
||||
then
|
||||
ScriptsSrcDir=./src/install/linux
|
||||
|
||||
( $ScriptsSrcDir/classic/CSpreinstall.sh )
|
||||
|
||||
cp $ScriptsSrcDir/misc/README interbase
|
||||
|
||||
for i in CSchangeRunUser.sh CSrestoreRootRunUser.sh changeDBAPassword.sh
|
||||
do
|
||||
cp $ScriptsSrcDir/misc/$i interbase/bin/$i
|
||||
chmod ugo=rx interbase/bin/$i
|
||||
done
|
||||
|
||||
mkdir -p interbase/misc
|
||||
cp $ScriptsSrcDir/misc/firebird.xinetd interbase/misc
|
||||
|
||||
($ScriptsSrcDir/classic/CSinstall.sh)
|
||||
|
||||
($ScriptsSrcDir/classic/CSpostinstall.sh)
|
||||
fi
|
||||
|
||||
# Here we are installing from a install tar.gz file
|
||||
|
||||
if [ -e scripts ]
|
||||
then
|
||||
echo "Extracting install data"
|
||||
runAndCheckExit "tar -xzf interbase.tar.gz"
|
||||
|
||||
(./scripts/CSpreinstall.sh)
|
||||
(./scripts/CSinstall.sh)
|
||||
(./scripts/CSpostinstall.sh)
|
||||
|
||||
rm -rf interbase
|
||||
fi
|
||||
|
||||
echo "Install completed"
|
||||
|
27
src/install/classic/CSTarKullFiles.sh
Executable file
27
src/install/classic/CSTarKullFiles.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
IBRootDir=`pwd`/interbase
|
||||
IBBin=$IBRootDir/bin
|
||||
RunUser=root
|
||||
|
||||
|
||||
chown -R $RunUser.$RunUser $IBRootDir
|
||||
|
||||
cd $IBBin
|
||||
|
||||
for i in gds_lock_mgr gds_drop gds_inet_server
|
||||
do
|
||||
chmod ug+s $i
|
||||
done
|
||||
|
||||
|
||||
|
||||
cd $IBRootDir
|
||||
|
||||
rm -f isc_init1*
|
||||
rm -f isc_lock1*
|
||||
|
||||
chmod ugo=rw isc4.gdb
|
||||
|
||||
rm -f inetd.conf.isc install
|
||||
|
104
src/install/classic/CSinstall.sh
Executable file
104
src/install/classic/CSinstall.sh
Executable file
@ -0,0 +1,104 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Script to install files from the build/transport area
|
||||
|
||||
# cd InterBase
|
||||
|
||||
|
||||
# A little bit of tidying up of some odd files not in the original build
|
||||
# These files will exist in the CVS tree.
|
||||
# If this is a tar.gz install rather than the result of a build then
|
||||
# We assume the files have already been copied here manually.
|
||||
|
||||
BuildDir=gen/firebird
|
||||
DestDir=/opt/interbase
|
||||
|
||||
if [ -z "$InteractiveInstall" ]
|
||||
then
|
||||
ScriptsSrcDir=src/install/linux
|
||||
cp $ScriptsSrcDir/misc/README $BuildDir
|
||||
fi
|
||||
|
||||
# The guts of the tranfer of files to /opt and other directories
|
||||
|
||||
if [ -d $DestDir ]
|
||||
then
|
||||
rm -rf $DestDir
|
||||
fi
|
||||
mkdir $DestDir
|
||||
mkdir $DestDir/bin
|
||||
mkdir $DestDir/examples
|
||||
mkdir $DestDir/help
|
||||
mkdir $DestDir/include
|
||||
mkdir $DestDir/intl
|
||||
mkdir $DestDir/lib
|
||||
mkdir $DestDir/doc
|
||||
mkdir $DestDir/UDF
|
||||
mkdir $DestDir/misc
|
||||
|
||||
cp -f $BuildDir/bin/gds_inet_server $DestDir/bin/gds_inet_server
|
||||
|
||||
cp $BuildDir/bin/gbak $DestDir/bin/gbak
|
||||
cp $BuildDir/bin/gdef $DestDir/bin/gdef
|
||||
cp $BuildDir/bin/gds_lock_print $DestDir/bin/gds_lock_print
|
||||
cp $BuildDir/bin/gds_drop $DestDir/bin/gds_drop
|
||||
cp $BuildDir/bin/gds_lock_mgr $DestDir/bin/gds_lock_mgr
|
||||
cp $BuildDir/bin/gds_pipe $DestDir/bin/gds_pipe
|
||||
cp $BuildDir/bin/gfix $DestDir/bin/gfix
|
||||
cp $BuildDir/bin/gpre $DestDir/bin/gpre
|
||||
cp $BuildDir/bin/gsec $DestDir/bin/gsec
|
||||
cp $BuildDir/bin/gsplit $DestDir/bin/gsplit
|
||||
cp $BuildDir/bin/gstat $DestDir/bin/gstat
|
||||
cp $BuildDir/bin/isc4.gbak $DestDir/bin/isc4.gbak
|
||||
cp $BuildDir/bin/isql $DestDir/bin/isql
|
||||
cp $BuildDir/bin/qli $DestDir/bin/qli
|
||||
|
||||
cp $BuildDir/bin/CSchangeRunUser.sh $DestDir/bin
|
||||
cp $BuildDir/bin/CSrestoreRootRunUser.sh $DestDir/bin
|
||||
cp $BuildDir/bin/changeDBAPassword.sh $DestDir/bin
|
||||
|
||||
cp $BuildDir/examples/v5/*.[ceh] $DestDir/examples
|
||||
cp $BuildDir/examples/v5/*.sql $DestDir/examples
|
||||
cp $BuildDir/examples/v5/*.gbk $DestDir/examples
|
||||
cp $BuildDir/examples/v5/*.gdb $DestDir/examples
|
||||
cp $BuildDir/examples/v5/makefile $DestDir/examples
|
||||
cp $BuildDir/help/help.gbak $DestDir/help
|
||||
cp $BuildDir/help/help.gdb $DestDir/help
|
||||
#cp -r $BuildDir/doc $DestDir
|
||||
cp $BuildDir/interbase.msg $DestDir/interbase.msg
|
||||
cp $BuildDir/isc4.gdb $DestDir/isc4.gdb
|
||||
cp $BuildDir/isc_config $DestDir/isc_config
|
||||
|
||||
cp -f $BuildDir/include/gds.h /usr/include/gds.h
|
||||
cp -f $BuildDir/include/iberror.h /usr/include/iberror.h
|
||||
cp -f $BuildDir/include/ibase.h /usr/include/ibase.h
|
||||
cp -f $BuildDir/include/ib_util.h /usr/include/ib_util.h
|
||||
|
||||
cp $BuildDir/include/gds.f $DestDir/include
|
||||
cp $BuildDir/include/gds.hxx $DestDir/include
|
||||
cp $BuildDir/include/*.h $DestDir/include
|
||||
|
||||
cp -f $BuildDir/lib/gds.so /usr/lib/libgds.so.0
|
||||
if [ -L /usr/lib/libgds.so ]
|
||||
then
|
||||
rm -f /usr/lib/libgds.so
|
||||
fi
|
||||
ln -s libgds.so.0 /usr/lib/libgds.so
|
||||
|
||||
cp -f $BuildDir/lib/gds.a /usr/lib/libgds.a
|
||||
cp -f $BuildDir/lib/ib_util.so /usr/lib/libib_util.so
|
||||
|
||||
|
||||
cp $BuildDir/intl/libgdsintl.so $DestDir/intl/
|
||||
cp $BuildDir/UDF/ib_udf $DestDir/UDF/ib_udf
|
||||
|
||||
cp $BuildDir/services.isc $DestDir/services.isc
|
||||
cp $BuildDir/README $DestDir/README
|
||||
|
||||
cp $BuildDir/misc/firebird.xinetd $DestDir/misc/firebird.xinetd
|
||||
|
||||
# June 23 2000, 6:00AM
|
||||
#TIMESTAMP="200006230600.00"
|
||||
#cd $DestDir/
|
||||
#touch -t $TIMESTAMP `find . -print`
|
||||
|
553
src/install/classic/CSpostinstall.sh
Executable file
553
src/install/classic/CSpostinstall.sh
Executable file
@ -0,0 +1,553 @@
|
||||
#!/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
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Add new user and group
|
||||
|
||||
|
||||
addFirebirdUser() {
|
||||
|
||||
testStr=`grep firebird /etc/group`
|
||||
|
||||
if [ -z "$testStr" ]
|
||||
then
|
||||
groupadd -g 84 -o -r firebird
|
||||
fi
|
||||
|
||||
testStr=`grep firebird /etc/passwd`
|
||||
if [ -z "$testDir" ]
|
||||
then
|
||||
useradd -o -r -m -d $IBRootDir -s /bin/bash \
|
||||
-c "Firebird Database Administrator" -g firebird -u 84 firebird
|
||||
|
||||
# >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Delete new user and group
|
||||
|
||||
|
||||
deleteFirebirdUser() {
|
||||
|
||||
userdel firebird
|
||||
# groupdel firebird
|
||||
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# changeXinetdServiceUser
|
||||
# Change the run user of the xinetd service
|
||||
|
||||
changeXinetdServiceUser() {
|
||||
|
||||
InitFile=/etc/xinetd.d/firebird
|
||||
if [ -f $InitFile ]
|
||||
then
|
||||
ed -s $InitFile <<EOF
|
||||
/ user /s/=.*$/= $RunUser/g
|
||||
w
|
||||
q
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Update inetd service entry
|
||||
# This just adds/replaces the service entry line
|
||||
|
||||
updateInetdEntry() {
|
||||
|
||||
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 xinetd service entry
|
||||
|
||||
updateXinetdEntry() {
|
||||
|
||||
cp $IBRootDir/misc/firebird.xinetd /etc/xinetd.d/firebird
|
||||
changeXinetdServiceUser
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Update inetd service entry
|
||||
# Check to see if we have xinetd installed or plain inetd. Install differs
|
||||
# for each of them.
|
||||
|
||||
updateInetdServiceEntry() {
|
||||
|
||||
if [ -d /etc/xinetd.d ]
|
||||
then
|
||||
updateXinetdEntry
|
||||
else
|
||||
updateInetdEntry
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Unable to generate the password for the rpm, so put out a message
|
||||
# instead
|
||||
|
||||
|
||||
keepOrigDBAPassword() {
|
||||
|
||||
DBAPasswordFile=$IBRootDir/SYSDBA.password
|
||||
|
||||
NewPasswd='masterkey'
|
||||
echo "Firebird initial install password " > $DBAPasswordFile
|
||||
echo "for user SYSDBA is : $NewPasswd" >> $DBAPasswordFile
|
||||
|
||||
echo "for install on `hostname` at time `date`" >> $DBAPasswordFile
|
||||
echo "You should change this password at the earliest oportunity" >> $DBAPasswordFile
|
||||
echo ""
|
||||
|
||||
echo "(For superserver you will also want to check the password in the" >> $DBAPasswordFile
|
||||
echo "daemon init routine in the file /etc/init.d/firebird)" >> $DBAPasswordFile
|
||||
echo "" >> $DBAPasswordFile
|
||||
echo "Your should password can be changed to a more suitable one using the" >> $DBAPasswordFile
|
||||
echo "/opt/interbase/bin/changeDBAPassword.sh script" >> $DBAPasswordFile
|
||||
echo "" >> $DBAPasswordFile
|
||||
|
||||
chmod u=r,go= $DBAPasswordFile
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Generate new sysdba password - this routine is used only in the
|
||||
# rpm file not in the install acript.
|
||||
|
||||
|
||||
generateNewDBAPassword() {
|
||||
|
||||
DBAPasswordFile=$IBRootDir/SYSDBA.password
|
||||
|
||||
NewPasswd=`/usr/bin/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/changeDBAPassword.sh script" >> $DBAPasswordFile
|
||||
echo "" >> $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.
|
||||
|
||||
# On some systems the mkpasswd program doesn't appear and on others
|
||||
# there is another mkpasswd which does a different operation. So if
|
||||
# the specific one isn't available then keep the original password.
|
||||
|
||||
|
||||
changeDBAPassword() {
|
||||
|
||||
if [ -z "$InteractiveInstall" ]
|
||||
then
|
||||
if [ -f /usr/bin/mkpasswd ]
|
||||
then
|
||||
generateNewDBAPassword
|
||||
else
|
||||
keepOrigDBAPassword
|
||||
fi
|
||||
else
|
||||
askUserForNewDBAPassword
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# fixFilePermissions
|
||||
# Change the permissions to restrict access to server programs to
|
||||
# firebird group only. This is MUCH better from a saftey point of
|
||||
# view than installing as root user, even if it requires a little
|
||||
# more work.
|
||||
|
||||
|
||||
fixFilePermissions() {
|
||||
|
||||
# Turn other access off.
|
||||
chmod -R o= $IBRootDir
|
||||
|
||||
|
||||
# Now fix up the mess.
|
||||
|
||||
# fix up directories
|
||||
for i in `find $IBRootDir -print`
|
||||
do
|
||||
FileName=$i
|
||||
if [ -d $FileName ]
|
||||
then
|
||||
chmod o=rx $FileName
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
cd $IBBin
|
||||
|
||||
|
||||
# set up the defaults for bin
|
||||
for i in `ls`
|
||||
do
|
||||
chmod ug=rx,o= $i
|
||||
done
|
||||
|
||||
# User can run these programs, they need to talk to server though.
|
||||
# and they cannot actually create a database.
|
||||
|
||||
|
||||
chmod a=rx isql
|
||||
chmod a=rx qli
|
||||
|
||||
# SUID is still needed for group direct access. General users
|
||||
# cannot run though.
|
||||
for i in gds_lock_mgr gds_drop gds_inet_server
|
||||
do
|
||||
chmod ug=rx,o= $i
|
||||
chmod ug+s $i
|
||||
done
|
||||
|
||||
|
||||
cd $IBRootDir
|
||||
|
||||
# Fix lock files
|
||||
for i in isc_init1 isc_lock1 isc_event1
|
||||
do
|
||||
FileName=$i.`hostname`
|
||||
chmod ug=rw,o= $FileName
|
||||
done
|
||||
|
||||
|
||||
chmod ug=rw,o= interbase.log
|
||||
|
||||
chmod a=r interbase.msg
|
||||
chmod ug=rw,o= help/help.gdb
|
||||
chmod ug=rw,o= isc4.gdb
|
||||
|
||||
|
||||
# Set a default of read all files in examples
|
||||
|
||||
cd examples
|
||||
|
||||
for i in `ls`
|
||||
do
|
||||
chmod a=r $i
|
||||
done
|
||||
|
||||
# make examples db's writable by group
|
||||
chmod ug=rw,o= *.gdb
|
||||
|
||||
cd ..
|
||||
|
||||
|
||||
# make include files world readable
|
||||
cd include
|
||||
|
||||
for i in `ls`
|
||||
do
|
||||
chmod a=r $i
|
||||
done
|
||||
|
||||
cd ..
|
||||
|
||||
# make intl library world readable
|
||||
cd intl
|
||||
|
||||
for i in `ls`
|
||||
do
|
||||
chmod a=r $i
|
||||
done
|
||||
|
||||
cd ..
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# fixFilePermissionsForRoot
|
||||
# This sets the file permissions up to what you need if you are
|
||||
# running the server as root user. I hope to remove this mode
|
||||
# of running before the next version, since it's security level
|
||||
# is absolutely woeful.
|
||||
|
||||
|
||||
fixFilePermissionsRoot() {
|
||||
|
||||
# Turn other access off.
|
||||
chmod -R o= $IBRootDir
|
||||
|
||||
# Now fix up the mess.
|
||||
|
||||
# fix up directories
|
||||
for i in `find $IBRootDir -print`
|
||||
do
|
||||
FileName=$i
|
||||
if [ -d $FileName ]
|
||||
then
|
||||
chmod o=rx $FileName
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
cd $IBBin
|
||||
|
||||
|
||||
# set up the defaults for bin
|
||||
for i in `ls`
|
||||
do
|
||||
chmod o=rx $i
|
||||
done
|
||||
|
||||
|
||||
# SUID is still needed for group direct access. General users
|
||||
# cannot run though.
|
||||
for i in gds_lock_mgr gds_drop gds_inet_server
|
||||
do
|
||||
chmod ug+s $i
|
||||
done
|
||||
|
||||
|
||||
cd $IBRootDir
|
||||
|
||||
# Fix lock files
|
||||
for i in isc_init1 isc_lock1 isc_event1
|
||||
do
|
||||
FileName=$i.`hostname`
|
||||
chmod a=rw $FileName
|
||||
done
|
||||
|
||||
|
||||
chmod a=rw interbase.log
|
||||
|
||||
chmod a=r interbase.msg
|
||||
chmod a=rw help/help.gdb
|
||||
chmod a=rw isc4.gdb
|
||||
|
||||
|
||||
# Set a default of read all files in examples
|
||||
|
||||
cd examples
|
||||
|
||||
for i in `ls`
|
||||
do
|
||||
chmod a=r $i
|
||||
done
|
||||
|
||||
# make examples db's writable by group
|
||||
chmod a=rw *.gdb
|
||||
|
||||
cd ..
|
||||
|
||||
# make include files world readable
|
||||
cd include
|
||||
|
||||
for i in `ls`
|
||||
do
|
||||
chmod a=r $i
|
||||
done
|
||||
|
||||
cd ..
|
||||
|
||||
# make intl library world readable
|
||||
cd intl
|
||||
|
||||
for i in `ls`
|
||||
do
|
||||
chmod a=r $i
|
||||
done
|
||||
|
||||
cd ..
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# resetXinitdServer
|
||||
# Check for both inetd and xinetd, only one will actually be running.
|
||||
# depending upon your system.
|
||||
|
||||
resetInetdServer() {
|
||||
|
||||
if [ -f /var/run/inetd.pid ]
|
||||
then
|
||||
kill -HUP `cat /var/run/inetd.pid`
|
||||
fi
|
||||
|
||||
if [ -f /var/run/xinetd.pid ]
|
||||
then
|
||||
kill -HUP `cat /var/run/xinetd.pid`
|
||||
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
|
||||
# RunUser=firebird
|
||||
|
||||
|
||||
# Update /etc/services
|
||||
|
||||
FileName=/etc/services
|
||||
newLine="gds_db 3050/tcp # InterBase Database Remote Protocol"
|
||||
oldLine=`grep "^gds_db" $FileName`
|
||||
|
||||
replaceLineInFile "$FileName" "$newLine" "$oldLine"
|
||||
|
||||
|
||||
# add Firebird user
|
||||
if [ $RunUser = "firebird" ]
|
||||
then
|
||||
addFirebirdUser
|
||||
fi
|
||||
|
||||
|
||||
# Create Lock files
|
||||
cd $IBRootDir
|
||||
|
||||
for i in isc_init1 isc_lock1 isc_event1
|
||||
do
|
||||
FileName=$i.`hostname`
|
||||
touch $FileName
|
||||
done
|
||||
|
||||
# Create log
|
||||
touch interbase.log
|
||||
|
||||
|
||||
# Update ownership and SUID bits for programs.
|
||||
chown -R $RunUser.$RunUser $IBRootDir
|
||||
if [ "$RunUser" = "root" ]
|
||||
then
|
||||
fixFilePermissionsRoot
|
||||
else
|
||||
fixFilePermissions
|
||||
fi
|
||||
|
||||
# Update the /etc/inetd.conf or xinetd entry
|
||||
updateInetdServiceEntry
|
||||
|
||||
|
||||
# Get inetd to reread new init files.
|
||||
resetInetdServer
|
||||
|
||||
|
||||
cd $IBRootDir
|
||||
# Change sysdba password
|
||||
changeDBAPassword
|
||||
|
||||
|
||||
|
51
src/install/classic/CSpostuninstall.sh
Executable file
51
src/install/classic/CSpostuninstall.sh
Executable file
@ -0,0 +1,51 @@
|
||||
#!/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
|
240
src/install/classic/CSpreinstall.sh
Executable file
240
src/install/classic/CSpreinstall.sh
Executable file
@ -0,0 +1,240 @@
|
||||
#!/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
|
||||
|
||||
|
57
src/install/classic/CSpreuninstall.sh
Executable file
57
src/install/classic/CSpreuninstall.sh
Executable file
@ -0,0 +1,57 @@
|
||||
#! /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
|
60
src/install/classic/CSrpmfiles.txt
Normal file
60
src/install/classic/CSrpmfiles.txt
Normal file
@ -0,0 +1,60 @@
|
||||
%dir /opt/interbase
|
||||
%dir /opt/interbase/bin
|
||||
%dir /opt/interbase/lib
|
||||
%dir /opt/interbase/UDF
|
||||
%dir /opt/interbase/intl
|
||||
%dir /opt/interbase/help
|
||||
%dir /opt/interbase/misc
|
||||
|
||||
/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/bin/CSchangeRunUser.sh
|
||||
/opt/interbase/bin/CSrestoreRootRunUser.sh
|
||||
/opt/interbase/bin/changeDBAPassword.sh
|
||||
|
||||
/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
|
||||
|
||||
/opt/interbase/misc/firebird.xinetd
|
||||
|
||||
|
||||
|
||||
|
16
src/install/classic/CSrpmheader.txt
Normal file
16
src/install/classic/CSrpmheader.txt
Normal file
@ -0,0 +1,16 @@
|
||||
Summary: Firebird Relational Database Server and Client tools.
|
||||
Name: FirebirdCS
|
||||
Version: 0.9
|
||||
Release: 4
|
||||
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.
|
||||
|
372
src/install/misc/CSchangeRunUser.sh
Executable file
372
src/install/misc/CSchangeRunUser.sh
Executable file
@ -0,0 +1,372 @@
|
||||
#!/bin/sh
|
||||
|
||||
# A routine to change the user that runs interbase Firebird
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Prompt for response, store result in Answer
|
||||
|
||||
Answer=""
|
||||
|
||||
AskQuestion() {
|
||||
Test=$1
|
||||
DefaultAns=$2
|
||||
echo -n "${1}"
|
||||
Answer="$DefaultAns"
|
||||
read Answer
|
||||
}
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Check for a previous install
|
||||
|
||||
|
||||
checkInstallUser() {
|
||||
|
||||
if [ "`whoami`" != "root" ];
|
||||
then
|
||||
ehco ""
|
||||
echo "--- Warning ----------------------------------------------"
|
||||
echo ""
|
||||
echo " You need to be 'root' user to do this change"
|
||||
echo ""
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# check if it is running
|
||||
|
||||
|
||||
checkIfServerRunning() {
|
||||
|
||||
# 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
|
||||
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Add new user and group
|
||||
|
||||
|
||||
addFirebirdUser() {
|
||||
|
||||
testStr=`grep firebird /etc/group`
|
||||
|
||||
if [ -z "$testStr" ]
|
||||
then
|
||||
groupadd -g 84 -o -r firebird
|
||||
fi
|
||||
|
||||
testStr=`grep firebird /etc/passwd`
|
||||
if [ -z "$testDir" ]
|
||||
then
|
||||
useradd -o -r -m -d $IBRootDir -s /bin/bash \
|
||||
-c "Firebird Database Administrator" -g firebird -u 84 firebird
|
||||
|
||||
# >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Delete new user and group
|
||||
|
||||
|
||||
deleteFirebirdUser() {
|
||||
|
||||
userdel firebird
|
||||
# groupdel firebird
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# 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
|
||||
# We really expect this to be the case.
|
||||
|
||||
cat $FileName | grep -v "$oldLine" > ${FileName}.tmp
|
||||
mv ${FileName}.tmp $FileName
|
||||
echo "$newLine" >> $FileName
|
||||
echo "Updated."
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# changeXinetdServiceUser
|
||||
# Change the run user of the xinetd service
|
||||
|
||||
changeXinetdServiceUser() {
|
||||
|
||||
InitFile=/etc/xinetd.d/firebird
|
||||
if [ -f $InitFile ]
|
||||
then
|
||||
ed -s $InitFile <<EOF
|
||||
/ user /s/=.*$/= $RunUser/g
|
||||
w
|
||||
q
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Update inetd service entry
|
||||
# This just adds/replaces the service entry line
|
||||
|
||||
updateInetdEntry() {
|
||||
|
||||
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 xinetd service entry
|
||||
|
||||
updateXinetdEntry() {
|
||||
|
||||
cp $IBRootDir/misc/firebird.xinetd /etc/xinetd.d/firebird
|
||||
changeXinetdServiceUser
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Update inetd service entry
|
||||
# Check to see if we have xinetd installed or plain inetd. Install differs
|
||||
# for each of them.
|
||||
|
||||
updateInetdServiceEntry() {
|
||||
|
||||
if [ -d /etc/xinetd.d ]
|
||||
then
|
||||
updateXinetdEntry
|
||||
else
|
||||
updateInetdEntry
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# fixFilePermissions
|
||||
# Change the permissions to restrict access to server programs to
|
||||
# firebird group only. This is MUCH better from a saftey point of
|
||||
# view than installing as root user, even if it requires a little
|
||||
# more work.
|
||||
|
||||
|
||||
fixFilePermissions() {
|
||||
|
||||
# Turn other access off.
|
||||
chmod -R o= $IBRootDir
|
||||
|
||||
|
||||
# Now fix up the mess.
|
||||
|
||||
# fix up directories
|
||||
for i in `find $IBRootDir -print`
|
||||
do
|
||||
FileName=$i
|
||||
if [ -d $FileName ]
|
||||
then
|
||||
chmod o=rx $FileName
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
cd $IBBin
|
||||
|
||||
|
||||
# set up the defaults for bin
|
||||
for i in `ls`
|
||||
do
|
||||
chmod ug=rx,o= $i
|
||||
done
|
||||
|
||||
# User can run these programs, they need to talk to server though.
|
||||
# and they cannot actually create a database.
|
||||
|
||||
|
||||
chmod a=rx isql
|
||||
chmod a=rx qli
|
||||
|
||||
# SUID is still needed for group direct access. General users
|
||||
# cannot run though.
|
||||
for i in gds_lock_mgr gds_drop gds_inet_server
|
||||
do
|
||||
chmod ug=rx,o= $i
|
||||
chmod ug+s $i
|
||||
done
|
||||
|
||||
|
||||
cd $IBRootDir
|
||||
|
||||
# Fix lock files
|
||||
for i in isc_init1 isc_lock1 isc_event1
|
||||
do
|
||||
FileName=$i.`hostname`
|
||||
chmod ug=rw,o= $FileName
|
||||
done
|
||||
|
||||
|
||||
chmod ug=rw,o= interbase.log
|
||||
|
||||
chmod a=r interbase.msg
|
||||
chmod ug=rw,o= help/help.gdb
|
||||
chmod ug=rw,o= isc4.gdb
|
||||
|
||||
|
||||
# Set a default of read all files in examples
|
||||
|
||||
cd examples
|
||||
|
||||
for i in `ls`
|
||||
do
|
||||
chmod a=r $i
|
||||
done
|
||||
|
||||
# make examples db's writable by group
|
||||
chmod ug=rw,o= *.gdb
|
||||
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# resetXinitdServer
|
||||
# Check for both inetd and xinetd, only one will be running but script
|
||||
# will work.
|
||||
|
||||
resetInetdServer() {
|
||||
|
||||
if [ -f /var/run/inetd.pid ]
|
||||
then
|
||||
kill -HUP `cat /var/run/inetd.pid`
|
||||
fi
|
||||
|
||||
if [ -f /var/run/xinetd.pid ]
|
||||
then
|
||||
kill -HUP `cat /var/run/xinetd.pid`
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
#= Main Program ============================================================
|
||||
|
||||
IBRootDir=/opt/interbase
|
||||
IBBin=$IBRootDir/bin
|
||||
|
||||
|
||||
|
||||
|
||||
RunUser=firebird
|
||||
RunGroup=firebird
|
||||
|
||||
# Well if you really insist, here it is ;-) - Mark.
|
||||
#RunUser=interbase
|
||||
#RunGroup=interbase
|
||||
|
||||
|
||||
# If you want to root user (server run restructed to group root)
|
||||
# RunUser=root
|
||||
# RunGroup=root
|
||||
|
||||
|
||||
checkInstallUser
|
||||
|
||||
checkIfServerRunning
|
||||
|
||||
|
||||
echo ""
|
||||
echo "Change Firebird install for $IBRootDir to uid=$RunUser gid=$RunGroup"
|
||||
echo "(User or group options can be changed by editing this script)"
|
||||
echo ""
|
||||
AskQuestion "Press return to continue - or ^C to abort"
|
||||
|
||||
|
||||
if [ $RunUser = "firebird" ]
|
||||
then
|
||||
# deleteFirebirdUser
|
||||
addFirebirdUser
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Update the /etc/inetd.conf or xinetd entry
|
||||
echo "Updating /etc/services file"
|
||||
updateInetdServiceEntry
|
||||
|
||||
|
||||
# Update ownership and SUID bits for programs.
|
||||
echo "Updating $IBRootDir"
|
||||
|
||||
|
||||
chown -R $RunUser.$RunGroup $IBRootDir
|
||||
|
||||
fixFilePermissions
|
||||
|
||||
# Get inetd to reread new init files.
|
||||
resetInetdServer
|
||||
|
||||
|
||||
cd $IBRootDir
|
||||
|
||||
touch interbase.log
|
||||
chmod ug=rw,o= interbase.log
|
||||
|
||||
|
||||
# make examples writable by group
|
||||
chmod ug=rw,o= examples/*.gdb
|
||||
|
||||
echo "Completed."
|
328
src/install/misc/CSrestoreRootRunUser.sh
Executable file
328
src/install/misc/CSrestoreRootRunUser.sh
Executable file
@ -0,0 +1,328 @@
|
||||
#!/bin/sh
|
||||
|
||||
# A routine to change the user that runs interbase Firebird
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Prompt for response, store result in Answer
|
||||
|
||||
Answer=""
|
||||
|
||||
AskQuestion() {
|
||||
Test=$1
|
||||
DefaultAns=$2
|
||||
echo -n "${1}"
|
||||
Answer="$DefaultAns"
|
||||
read Answer
|
||||
}
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Check for a previous install
|
||||
|
||||
|
||||
checkInstallUser() {
|
||||
|
||||
if [ "`whoami`" != "root" ];
|
||||
then
|
||||
ehco ""
|
||||
echo "--- Warning ----------------------------------------------"
|
||||
echo ""
|
||||
echo " You need to be 'root' user to do this change"
|
||||
echo ""
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# check if it is running
|
||||
|
||||
|
||||
checkIfServerRunning() {
|
||||
|
||||
# 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
|
||||
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Add new user and group
|
||||
|
||||
|
||||
addFirebirdUser() {
|
||||
|
||||
groupadd -g 84 -o -r firebird
|
||||
|
||||
useradd -o -r -m -d /home/firebird -s /bin/bash \
|
||||
-c "Firebird Database Administrator" -g firebird -u 84 firebird
|
||||
|
||||
# >/dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Delete new user and group
|
||||
|
||||
|
||||
deleteFirebirdUser() {
|
||||
|
||||
userdel firebird
|
||||
# groupdel firebird
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# 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
|
||||
# We really expect this to be the case.
|
||||
|
||||
cat $FileName | grep -v "$oldLine" > ${FileName}.tmp
|
||||
mv ${FileName}.tmp $FileName
|
||||
echo "$newLine" >> $FileName
|
||||
echo "Updated."
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# changeXinetdServiceUser
|
||||
# Change the run user of the xinetd service
|
||||
|
||||
changeXinetdServiceUser() {
|
||||
|
||||
InitFile=/etc/xinetd.d/firebird
|
||||
if [ -f $InitFile ]
|
||||
then
|
||||
ed -s $InitFile <<EOF
|
||||
/ user /s/=.*$/= $RunUser/g
|
||||
w
|
||||
q
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Update inetd service entry
|
||||
# This just adds/replaces the service entry line
|
||||
|
||||
updateInetdEntry() {
|
||||
|
||||
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 xinetd service entry
|
||||
# we assume the xinetd script file already exists since we are changing user
|
||||
# not installing from scratch.
|
||||
|
||||
updateXinetdEntry() {
|
||||
|
||||
# cp $IBRootDir/misc/firebird.xinetd /etc/xinetd.d/firebird
|
||||
changeXinetdServiceUser
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Update inetd service entry
|
||||
# Check to see if we have xinetd installed or plain inetd. Install differs
|
||||
# for each of them.
|
||||
|
||||
updateInetdServiceEntry() {
|
||||
|
||||
if [ -d /etc/xinetd.d ]
|
||||
then
|
||||
updateXinetdEntry
|
||||
else
|
||||
updateInetdEntry
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# resetXinitdServer
|
||||
# Check for both inetd and xinetd, only one will actually be running.
|
||||
# depending upon your system.
|
||||
|
||||
resetInetdServer() {
|
||||
|
||||
if [ -f /var/run/inetd.pid ]
|
||||
then
|
||||
kill -HUP `cat /var/run/inetd.pid`
|
||||
fi
|
||||
|
||||
if [ -f /var/run/xinetd.pid ]
|
||||
then
|
||||
kill -HUP `cat /var/run/xinetd.pid`
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#== Main Start ==============================================================
|
||||
|
||||
|
||||
IBRootDir=/opt/interbase
|
||||
IBBin=$IBRootDir/bin
|
||||
|
||||
|
||||
|
||||
|
||||
#RunUser=firebird
|
||||
#RunGroup=firebird
|
||||
|
||||
# Well if you really insist, here it is ;-) - Mark.
|
||||
#RunUser=interbase
|
||||
#RunGroup=interbase
|
||||
|
||||
|
||||
|
||||
RunUser=root
|
||||
RunGroup=root
|
||||
|
||||
checkInstallUser
|
||||
|
||||
checkIfServerRunning
|
||||
|
||||
|
||||
echo ""
|
||||
echo "Restore Firebird install for $IBRootDir to uid=$RunUser gid=$RunGroup"
|
||||
echo "(User or group options can be changed by editing this script)"
|
||||
echo ""
|
||||
AskQuestion "Press return to continue - or ^C to abort"
|
||||
|
||||
|
||||
|
||||
# Update the /etc/inetd.conf
|
||||
echo "Updating /etc/services file"
|
||||
|
||||
|
||||
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.
|
||||
echo "Updating $IBRootDir"
|
||||
|
||||
|
||||
chown -R $RunUser.$RunGroup $IBRootDir
|
||||
|
||||
# Turn everybody to read only.
|
||||
chmod -R o=r $IBRootDir
|
||||
|
||||
# Now fix up the mess.
|
||||
|
||||
# fix up directories
|
||||
for i in `find $IBRootDir -print`
|
||||
do
|
||||
FileName=$i
|
||||
if [ -d $FileName ]
|
||||
then
|
||||
chmod o=rx $FileName
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
|
||||
cd $IBBin
|
||||
|
||||
# all users can run everything.
|
||||
chmod o=rx *
|
||||
|
||||
# SUID is needed for running server programs.
|
||||
|
||||
for i in gds_lock_mgr gds_drop gds_inet_server
|
||||
do
|
||||
chmod ug+s $i
|
||||
done
|
||||
|
||||
|
||||
cd $IBRootDir
|
||||
|
||||
# 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 ugo=rw interbase.log
|
||||
|
||||
|
||||
# make databases writable by all
|
||||
chmod ugo=rw examples/*.gdb
|
||||
chmod ugo=rw help/*.gdb
|
||||
chmod ugo=rw isc4.gdb
|
||||
|
||||
|
||||
|
||||
|
||||
# Update the /etc/inetd.conf or xinetd entry
|
||||
updateInetdServiceEntry
|
||||
|
||||
|
||||
# Get inetd to reread new init files.
|
||||
resetInetdServer
|
||||
|
||||
|
||||
echo "Completed."
|
22
src/install/misc/README
Normal file
22
src/install/misc/README
Normal file
@ -0,0 +1,22 @@
|
||||
Firebird 1.0 Classic Server for Linux
|
||||
|
||||
|
||||
More information can be found about the Firebird
|
||||
database engine from:
|
||||
http://firebird.sourceforge.net
|
||||
http://sourceforge.net/projects/firebird
|
||||
|
||||
or affiliated sites:
|
||||
|
||||
http://www.ibphoenix.com
|
||||
http://www.interbase2000.com
|
||||
|
||||
|
||||
|
||||
The Firebird database engine is derived from the
|
||||
InterBase(tm) product currently owned by Inprise.
|
||||
The documentation for InterBase v 6.0 applies also to
|
||||
the current FireBird release. InterBase documentation
|
||||
is available in Adobe Acrobat format from
|
||||
http://www.interbase.com.
|
||||
|
268
src/install/misc/SSchangeRunUser.sh
Executable file
268
src/install/misc/SSchangeRunUser.sh
Executable file
@ -0,0 +1,268 @@
|
||||
#!/bin/sh
|
||||
|
||||
# A routine to change the user that runs interbase Firebird
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Prompt for response, store result in Answer
|
||||
|
||||
Answer=""
|
||||
|
||||
AskQuestion() {
|
||||
Test=$1
|
||||
DefaultAns=$2
|
||||
echo -n "${1}"
|
||||
Answer="$DefaultAns"
|
||||
read Answer
|
||||
}
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Check for a previous install
|
||||
|
||||
|
||||
checkInstallUser() {
|
||||
|
||||
if [ "`whoami`" != "root" ];
|
||||
then
|
||||
ehco ""
|
||||
echo "--- Warning ----------------------------------------------"
|
||||
echo ""
|
||||
echo " You need to be 'root' user to do this change"
|
||||
echo ""
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# 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 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
|
||||
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Add new user and group
|
||||
|
||||
|
||||
addFirebirdUser() {
|
||||
|
||||
groupadd -g 84 -o -r firebird
|
||||
|
||||
useradd -o -r -m -d /home/firebird -s /bin/bash \
|
||||
-c "Firebird Database Administrator" -g firebird -u 84 firebird
|
||||
|
||||
# >/dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Delete new user and group
|
||||
|
||||
|
||||
deleteFirebirdUser() {
|
||||
|
||||
userdel firebird
|
||||
# groupdel firebird
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# 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
|
||||
# We really expect this to be the case.
|
||||
|
||||
cat $FileName | grep -v "$oldLine" > ${FileName}.tmp
|
||||
mv ${FileName}.tmp $FileName
|
||||
echo "$newLine" >> $FileName
|
||||
echo "Updated."
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# changeInitRunUser
|
||||
|
||||
|
||||
changeInitRunUser() {
|
||||
|
||||
NewUser=$1
|
||||
|
||||
InitFile=/etc/rc.d/init.d/firebird
|
||||
if [ -f $InitFile ]
|
||||
then
|
||||
ed $InitFile <<EOF
|
||||
/FBRunUser:=/s/FBRunUser:=.*\}/FBRunUser:=$NewUser\}/g
|
||||
w
|
||||
q
|
||||
EOF
|
||||
chmod u=rwx,g=rx,o= $InitFile
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
IBRootDir=/opt/interbase
|
||||
IBBin=$IBRootDir/bin
|
||||
|
||||
|
||||
|
||||
|
||||
RunUser=firebird
|
||||
RunGroup=firebird
|
||||
|
||||
# Well if you really insist, here it is ;-) - Mark.
|
||||
#RunUser=interbase
|
||||
#RunGroup=interbase
|
||||
|
||||
|
||||
# If you want to root user (server run restructed to group root)
|
||||
# RunUser=root
|
||||
# RunGroup=root
|
||||
|
||||
|
||||
checkInstallUser
|
||||
|
||||
|
||||
|
||||
echo ""
|
||||
echo "Change Firebird install for $IBRootDir to uid=$RunUser gid=$RunGroup"
|
||||
echo "(User or group options can be changed by editing this script)"
|
||||
echo ""
|
||||
AskQuestion "Press return to continue - or ^C to abort"
|
||||
|
||||
|
||||
checkIfServerRunning
|
||||
|
||||
if [ $RunUser = "firebird" ]
|
||||
then
|
||||
# deleteFirebirdUser
|
||||
addFirebirdUser
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
# Update ownership and SUID bits for programs.
|
||||
echo "Updating $IBRootDir"
|
||||
|
||||
|
||||
chown -R $RunUser.$RunGroup $IBRootDir
|
||||
|
||||
# Turn everybody option off.
|
||||
chmod -R o= $IBRootDir
|
||||
|
||||
# Now fix up the mess.
|
||||
|
||||
# fix up directories
|
||||
for i in `find $IBRootDir -print`
|
||||
do
|
||||
FileName=$i
|
||||
if [ -d $FileName ]
|
||||
then
|
||||
chmod o=rx $FileName
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
|
||||
cd $IBBin
|
||||
|
||||
|
||||
# User can run these programs, they need to talk to server though.
|
||||
# and they cannot actually create a database.
|
||||
|
||||
chmod o=rx isql
|
||||
chmod o=rx qli
|
||||
|
||||
|
||||
|
||||
cd $IBRootDir
|
||||
|
||||
touch interbase.log
|
||||
chmod ug=rw,o= interbase.log
|
||||
chmod ug=rw,o=r interbase.msg
|
||||
|
||||
|
||||
# make examples writable by group
|
||||
chmod ug=rw,o= examples/*.gdb
|
||||
|
||||
|
||||
changeInitRunUser $RunUser
|
||||
|
||||
# start the db server so we can change the password
|
||||
|
||||
(cd /etc/rc.d/init.d; ./firebird start)
|
||||
|
||||
echo "Completed."
|
257
src/install/misc/SSrestoreRootRunUser.sh
Executable file
257
src/install/misc/SSrestoreRootRunUser.sh
Executable file
@ -0,0 +1,257 @@
|
||||
#!/bin/sh
|
||||
|
||||
# A routine to change the user that runs interbase Firebird
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Prompt for response, store result in Answer
|
||||
|
||||
Answer=""
|
||||
|
||||
AskQuestion() {
|
||||
Test=$1
|
||||
DefaultAns=$2
|
||||
echo -n "${1}"
|
||||
Answer="$DefaultAns"
|
||||
read Answer
|
||||
}
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Check for a previous install
|
||||
|
||||
|
||||
checkInstallUser() {
|
||||
|
||||
if [ "`whoami`" != "root" ];
|
||||
then
|
||||
ehco ""
|
||||
echo "--- Warning ----------------------------------------------"
|
||||
echo ""
|
||||
echo " You need to be 'root' user to do this change"
|
||||
echo ""
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# 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 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
|
||||
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Add new user and group
|
||||
|
||||
|
||||
addFirebirdUser() {
|
||||
|
||||
groupadd -g 84 -o -r firebird
|
||||
|
||||
useradd -o -r -m -d /home/firebird -s /bin/bash \
|
||||
-c "Firebird Database Administrator" -g firebird -u 84 firebird
|
||||
|
||||
# >/dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Delete new user and group
|
||||
|
||||
|
||||
deleteFirebirdUser() {
|
||||
|
||||
userdel firebird
|
||||
# groupdel firebird
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# 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
|
||||
# We really expect this to be the case.
|
||||
|
||||
cat $FileName | grep -v "$oldLine" > ${FileName}.tmp
|
||||
mv ${FileName}.tmp $FileName
|
||||
echo "$newLine" >> $FileName
|
||||
echo "Updated."
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# changeInitRunUser
|
||||
|
||||
|
||||
changeInitRunUser() {
|
||||
|
||||
NewUser=$1
|
||||
|
||||
InitFile=/etc/rc.d/init.d/firebird
|
||||
if [ -f $InitFile ]
|
||||
then
|
||||
ed $InitFile <<EOF
|
||||
/FBRunUser:=/s/FBRunUser:=.*\}/FBRunUser:=$NewUser\}/g
|
||||
w
|
||||
q
|
||||
EOF
|
||||
chmod u=rwx,g=rx,o= $InitFile
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
IBRootDir=/opt/interbase
|
||||
IBBin=$IBRootDir/bin
|
||||
|
||||
|
||||
|
||||
|
||||
#RunUser=firebird
|
||||
#RunGroup=firebird
|
||||
|
||||
# Well if you really insist, here it is ;-) - Mark.
|
||||
#RunUser=interbase
|
||||
#RunGroup=interbase
|
||||
|
||||
|
||||
# If you want to root user (server run restructed to group root)
|
||||
RunUser=root
|
||||
RunGroup=root
|
||||
|
||||
|
||||
checkInstallUser
|
||||
|
||||
|
||||
echo ""
|
||||
echo "Change Firebird install for $IBRootDir to uid=$RunUser gid=$RunGroup"
|
||||
echo "(User or group options can be changed by editing this script)"
|
||||
echo ""
|
||||
AskQuestion "Press return to continue - or ^C to abort"
|
||||
|
||||
|
||||
checkIfServerRunning
|
||||
|
||||
|
||||
# Update ownership and SUID bits for programs.
|
||||
echo "Updating $IBRootDir"
|
||||
|
||||
|
||||
chown -R $RunUser.$RunGroup $IBRootDir
|
||||
|
||||
# Turn everybody option off.
|
||||
chmod -R o= $IBRootDir
|
||||
|
||||
# Now fix up the mess.
|
||||
|
||||
# fix up directories
|
||||
for i in `find $IBRootDir -print`
|
||||
do
|
||||
FileName=$i
|
||||
if [ -d $FileName ]
|
||||
then
|
||||
chmod o=rx $FileName
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
cd $IBBin
|
||||
|
||||
|
||||
# User can run these programs, they need to talk to server though.
|
||||
# and they cannot actually create a database.
|
||||
|
||||
chmod o=rx isql
|
||||
chmod o=rx qli
|
||||
|
||||
|
||||
|
||||
cd $IBRootDir
|
||||
|
||||
touch interbase.log
|
||||
chmod ug=rw,o= interbase.log
|
||||
|
||||
|
||||
# make examples writable by group
|
||||
chmod ug=rw,o= examples/*.gdb
|
||||
|
||||
|
||||
changeInitRunUser $RunUser
|
||||
|
||||
# start the db server
|
||||
|
||||
(cd /etc/rc.d/init.d; ./firebird start)
|
||||
|
||||
echo "Completed."
|
138
src/install/misc/changeDBAPassword.sh
Executable file
138
src/install/misc/changeDBAPassword.sh
Executable file
@ -0,0 +1,138 @@
|
||||
#! /bin/sh
|
||||
|
||||
|
||||
# This shell script changes both the SYSDBA user
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Prompt for response, store result in Answer
|
||||
|
||||
Answer=""
|
||||
|
||||
AskQuestion() {
|
||||
Test=$1
|
||||
DefaultAns=$2
|
||||
echo -n "${1}"
|
||||
Answer="$DefaultAns"
|
||||
read Answer
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# 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() {
|
||||
|
||||
OrigPasswd=""
|
||||
while [ -z "$OrigPasswd" ]
|
||||
do
|
||||
AskQuestion "Please enter current password for SYSDBA user: "
|
||||
OrigPasswd=$Answer
|
||||
|
||||
done
|
||||
|
||||
NewPasswd=""
|
||||
|
||||
while [ -z "$NewPasswd" ]
|
||||
do
|
||||
AskQuestion "Please enter new password for SYSDBA user: "
|
||||
NewPasswd=$Answer
|
||||
if [ ! -z "$NewPasswd" ]
|
||||
then
|
||||
$IBBin/gsec -user sysdba -password $OrigPasswd <<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 ===============================================================
|
||||
|
||||
|
||||
IBRootDir=/opt/interbase
|
||||
IBBin=$IBRootDir/bin
|
||||
RunUser=root
|
||||
|
||||
InteractiveInstall=true
|
||||
export InteractiveInstall
|
||||
|
||||
changeDBAPassword
|
60
src/install/misc/firebird.init.d.generic
Executable file
60
src/install/misc/firebird.init.d.generic
Executable file
@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
|
||||
# chkconfig: 345 20 80
|
||||
# description: Start/Stop firebird database server
|
||||
#
|
||||
# This file belongs in /etc/init.d where it will be run
|
||||
# on system startup and shutdown to start the background
|
||||
# Firebird/interbase database server daemon
|
||||
|
||||
|
||||
|
||||
: ${INTERBASE:=/opt/interbase}
|
||||
: ${ISC_USER:=SYSDBA}
|
||||
: ${ISC_PASSWORD:=masterkey}
|
||||
: ${FBRunUser:=root}
|
||||
# WARNING: in a real-world installation, you should not put the
|
||||
# SYSDBA password in a publicly-readable file.
|
||||
# Eventually this file should not need to contain any passwords.
|
||||
# as root user alone should be sufficient privledge to stop/start
|
||||
# the server.
|
||||
|
||||
|
||||
export INTERBASE
|
||||
export ISC_USER
|
||||
export ISC_PASSWORD
|
||||
|
||||
|
||||
# Check the file is there and is executable.
|
||||
[ -x $INTERBASE/bin/ibmgr ] || exit 0
|
||||
|
||||
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting Firebird server: "
|
||||
echo '$INTERBASE/bin/ibmgr -start -forever' | su $FBRunUser
|
||||
RETVAL=$?
|
||||
;;
|
||||
stop)
|
||||
echo -n "Stopping Firebird server: "
|
||||
$INTERBASE/bin/ibmgr -shut
|
||||
RETVAL=$?
|
||||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/identd
|
||||
;;
|
||||
status)
|
||||
RETVAL=0
|
||||
;;
|
||||
restart|reload)
|
||||
$0 stop
|
||||
$0 start
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: firebird {start|stop|status|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
||||
|
70
src/install/misc/firebird.init.d.mandrake
Executable file
70
src/install/misc/firebird.init.d.mandrake
Executable file
@ -0,0 +1,70 @@
|
||||
#!/bin/sh
|
||||
|
||||
# chkconfig: 345 20 80
|
||||
# description: Start/Stop firebird database server
|
||||
#
|
||||
# This file belongs in /etc/init.d where it will be run
|
||||
# on system startup and shutdown to start the background
|
||||
# Firebird/interbase database server daemon
|
||||
|
||||
|
||||
# This init script contains functions specific for redhat
|
||||
# and mandrake init scripts.
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
|
||||
: ${INTERBASE:=/opt/interbase}
|
||||
: ${ISC_USER:=SYSDBA}
|
||||
: ${ISC_PASSWORD:=masterkey}
|
||||
: ${FBRunUser:=root}
|
||||
# WARNING: in a real-world installation, you should not put the
|
||||
# SYSDBA password in a publicly-readable file.
|
||||
# Eventually this file should not need to contain any passwords.
|
||||
# as root user alone should be sufficient privledge to stop/start
|
||||
# the server.
|
||||
|
||||
|
||||
export INTERBASE
|
||||
export ISC_USER
|
||||
export ISC_PASSWORD
|
||||
|
||||
|
||||
# Check the file is there and is executable.
|
||||
[ -x $INTERBASE/bin/ibmgr ] || exit 0
|
||||
|
||||
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting Firebird server: "
|
||||
daemon --user $FBRunUser $INTERBASE/bin/ibmgr -start -forever
|
||||
# echo '$INTERBASE/bin/ibmgr -start -forever' | su $FBRunUser
|
||||
RETVAL=$?
|
||||
;;
|
||||
stop)
|
||||
echo -n "Stopping Firebird server: "
|
||||
$INTERBASE/bin/ibmgr -shut
|
||||
# killproc ibserver
|
||||
RETVAL=$?
|
||||
# echo
|
||||
# [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/identd
|
||||
;;
|
||||
status)
|
||||
status ibserver
|
||||
RETVAL=$?
|
||||
;;
|
||||
restart|reload)
|
||||
$0 stop
|
||||
$0 start
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: firebird {start|stop|status|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
||||
|
13
src/install/misc/firebird.xinetd
Executable file
13
src/install/misc/firebird.xinetd
Executable file
@ -0,0 +1,13 @@
|
||||
# default: on
|
||||
# description: Interbase server
|
||||
service gds_db
|
||||
{
|
||||
flags = REUSE
|
||||
socket_type = stream
|
||||
wait = no
|
||||
user = root
|
||||
log_on_success += USERID
|
||||
log_on_failure += USERID
|
||||
server = /opt/interbase/bin/gds_inet_server
|
||||
disable = no
|
||||
}
|
125
src/install/super/SSTarInstall.sh
Executable file
125
src/install/super/SSTarInstall.sh
Executable file
@ -0,0 +1,125 @@
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Prompt for response, store result in Answer
|
||||
|
||||
Answer=""
|
||||
|
||||
AskQuestion() {
|
||||
Test=$1
|
||||
DefaultAns=$2
|
||||
echo -n "${1}"
|
||||
Answer="$DefaultAns"
|
||||
read Answer
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Prompt for yes or no answer - returns non-zero for no
|
||||
|
||||
AskYNQuestion() {
|
||||
while echo -n "${*} (y/n): "
|
||||
do
|
||||
read answer rest
|
||||
case $answer in
|
||||
[yY]*)
|
||||
return 0
|
||||
;;
|
||||
[nN]*)
|
||||
return 1
|
||||
;;
|
||||
*)
|
||||
echo "Please answer y or n"
|
||||
;;
|
||||
esac
|
||||
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
|
||||
fi
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Check for a previous install
|
||||
|
||||
|
||||
checkInstallUser() {
|
||||
|
||||
if [ "`whoami`" != "root" ];
|
||||
then
|
||||
echo ""
|
||||
echo "--- Warning ----------------------------------------------"
|
||||
echo ""
|
||||
echo " You need to be 'root' user to install"
|
||||
echo ""
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
#== Main Program ==========================================================
|
||||
|
||||
|
||||
InteractiveInstall=1
|
||||
export InteractiveInstall
|
||||
|
||||
checkInstallUser
|
||||
|
||||
|
||||
# Ok, here we are installing from a CVS tree
|
||||
|
||||
if [ -e firebird ]
|
||||
then
|
||||
ScriptsSrcDir=./firebird/skywalker/install
|
||||
|
||||
( $ScriptsSrcDir/super/SSpreinstall.sh )
|
||||
|
||||
cp $ScriptsSrcDir/misc/firebird interbase
|
||||
cp $ScriptsSrcDir/misc/README interbase
|
||||
|
||||
for i in SSchangeRunUser.sh SSrestoreRootRunUser.sh changeDBAPassword.sh
|
||||
do
|
||||
cp $ScriptsSrcDir/misc/$i interbase/bin/$i
|
||||
chmod ugo=rx interbase/bin/$i
|
||||
done
|
||||
|
||||
|
||||
($ScriptsSrcDir/super/SSinstall.sh)
|
||||
|
||||
($ScriptsSrcDir/super/SSpostinstall.sh)
|
||||
fi
|
||||
|
||||
|
||||
# Here we are installing from a install tar.gz file
|
||||
|
||||
if [ -e scripts ]
|
||||
then
|
||||
echo "Extracting install data"
|
||||
runAndCheckExit "tar -xzf interbase.tar.gz"
|
||||
|
||||
(./scripts/SSpreinstall.sh)
|
||||
(./scripts/SSinstall.sh)
|
||||
(./scripts/SSpostinstall.sh)
|
||||
|
||||
rm -rf interbase
|
||||
fi
|
||||
|
||||
echo "Install completed"
|
||||
|
139
src/install/super/SSchangePasswd.sh
Executable file
139
src/install/super/SSchangePasswd.sh
Executable file
@ -0,0 +1,139 @@
|
||||
#! /bin/sh
|
||||
|
||||
|
||||
# This shell script changes both the SYSDBA user and the firebird
|
||||
# install script.
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Prompt for response, store result in Answer
|
||||
|
||||
Answer=""
|
||||
|
||||
AskQuestion() {
|
||||
Test=$1
|
||||
DefaultAns=$2
|
||||
echo -n "${1}"
|
||||
Answer="$DefaultAns"
|
||||
read Answer
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# 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() {
|
||||
|
||||
OrigPasswd=""
|
||||
while [ -z "$OrigPasswd" ]
|
||||
do
|
||||
AskQuestion "Please enter current password for SYSDBA user: "
|
||||
OrigPasswd=$Answer
|
||||
|
||||
done
|
||||
|
||||
NewPasswd=""
|
||||
|
||||
while [ -z "$NewPasswd" ]
|
||||
do
|
||||
AskQuestion "Please enter new password for SYSDBA user: "
|
||||
NewPasswd=$Answer
|
||||
if [ ! -z "$NewPasswd" ]
|
||||
then
|
||||
$IBBin/gsec -user sysdba -password $OrigPasswd <<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 ===============================================================
|
||||
|
||||
|
||||
IBRootDir=/opt/interbase
|
||||
IBBin=$IBRootDir/bin
|
||||
RunUser=root
|
||||
|
||||
InteractiveInstall=true
|
||||
export InteractiveInstall
|
||||
|
||||
changeDBAPassword
|
95
src/install/super/SSinstall.sh
Executable file
95
src/install/super/SSinstall.sh
Executable file
@ -0,0 +1,95 @@
|
||||
#! /bin/sh
|
||||
|
||||
|
||||
# Script to install files from the build/transport area
|
||||
|
||||
|
||||
# cd interbase
|
||||
|
||||
|
||||
|
||||
|
||||
# The guts of the tranfer of files to /opt and other directories
|
||||
|
||||
|
||||
if [ -d /opt/interbase ]
|
||||
then
|
||||
rm -fr /opt/interbase
|
||||
fi
|
||||
mkdir /opt/interbase
|
||||
mkdir /opt/interbase/bin
|
||||
mkdir /opt/interbase/examples
|
||||
mkdir /opt/interbase/help
|
||||
mkdir /opt/interbase/include
|
||||
mkdir /opt/interbase/intl
|
||||
mkdir /opt/interbase/lib
|
||||
mkdir /opt/interbase/doc
|
||||
mkdir /opt/interbase/UDF
|
||||
|
||||
cp interbase/bin/gbak /opt/interbase/bin/gbak
|
||||
cp interbase/bin/gdef /opt/interbase/bin/gdef
|
||||
cp interbase/bin/gds_lock_print /opt/interbase/bin/gds_lock_print
|
||||
cp interbase/bin/gfix /opt/interbase/bin/gfix
|
||||
cp interbase/bin/gpre /opt/interbase/bin/gpre
|
||||
cp interbase/bin/gsec /opt/interbase/bin/gsec
|
||||
cp interbase/bin/gsplit /opt/interbase/bin/gsplit
|
||||
cp interbase/bin/gstat /opt/interbase/bin/gstat
|
||||
cp interbase/bin/isc4.gbak /opt/interbase/bin/isc4.gbak
|
||||
cp interbase/bin/isql /opt/interbase/bin/isql
|
||||
cp interbase/bin/qli /opt/interbase/bin/qli
|
||||
cp interbase/bin/ibmgr.bin /opt/interbase/bin/ibmgr.bin
|
||||
#cp interbase/bin/ibmgr /opt/interbase/bin/ibmgr
|
||||
cp interbase/bin/ibserver /opt/interbase/bin/ibserver
|
||||
cp interbase/bin/ibguard /opt/interbase/bin/ibguard
|
||||
|
||||
cp interbase/bin/SSchangeRunUser.sh /opt/interbase/bin
|
||||
cp interbase/bin/SSrestoreRootRunUser.sh /opt/interbase/bin
|
||||
cp interbase/bin/changeDBAPassword.sh /opt/interbase/bin
|
||||
|
||||
cp interbase/examples/v5/*.[ceh] /opt/interbase/examples
|
||||
cp interbase/examples/v5/*.sql /opt/interbase/examples
|
||||
cp interbase/examples/v5/*.gbk /opt/interbase/examples
|
||||
cp interbase/examples/v5/*.gdb /opt/interbase/examples
|
||||
cp interbase/examples/v5/makefile /opt/interbase/examples
|
||||
cp interbase/help/help.gbak /opt/interbase/help
|
||||
cp interbase/help/help.gdb /opt/interbase/help
|
||||
#cp -r interbase/doc /opt/interbase
|
||||
cp interbase/interbase.msg /opt/interbase/interbase.msg
|
||||
cp interbase/isc4.gdb /opt/interbase/isc4.gdb
|
||||
cp interbase/isc_config /opt/interbase/isc_config
|
||||
|
||||
cp -f interbase/include/gds.h /usr/include/gds.h
|
||||
cp -f interbase/include/iberror.h /usr/include/iberror.h
|
||||
cp -f interbase/include/ibase.h /usr/include/ibase.h
|
||||
|
||||
cp interbase/include/gds.f /opt/interbase/include
|
||||
cp interbase/include/gds.hxx /opt/interbase/include
|
||||
cp interbase/include/*.h /opt/interbase/include
|
||||
|
||||
cp -f interbase/lib/gds.so.1 /usr/lib/libgds.so.0
|
||||
if [ -L /usr/lib/libgds.so ]
|
||||
then
|
||||
rm -f /usr/lib/libgds.so
|
||||
fi
|
||||
ln -s libgds.so.0 /usr/lib/libgds.so
|
||||
cp -f interbase/lib/ib_util.so /usr/lib/libib_util.so
|
||||
cp -f interbase/lib/gds_pyxis.a /usr/lib/libgds_pyxis.a
|
||||
|
||||
cp interbase/intl/gdsintl /opt/interbase/intl/gdsintl
|
||||
cp interbase/UDF/ib_udf /opt/interbase/UDF/ib_udf
|
||||
|
||||
cp interbase/services.isc /opt/interbase/services.isc
|
||||
#cp interbase/license.txt /opt/interbase/license.txt
|
||||
#cp interbase/license.html /opt/interbase/license.html
|
||||
#cp interbase/ReleaseNotes.pdf /opt/interbase/ReleaseNotes.pdf
|
||||
|
||||
|
||||
cp interbase/README /opt/interbase/README
|
||||
cp interbase/firebird /etc/rc.d/init.d
|
||||
|
||||
# June 23 2000, 6:00AM
|
||||
#TIMESTAMP="200006230600.00"
|
||||
#cd /opt/interbase/
|
||||
#touch -t $TIMESTAMP `find . -print`
|
||||
|
||||
|
319
src/install/super/SSpostinstall.sh
Executable file
319
src/install/super/SSpostinstall.sh
Executable file
@ -0,0 +1,319 @@
|
||||
#! /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
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Unable to generate the password for the rpm, so put out a message
|
||||
# instead
|
||||
|
||||
|
||||
keepOrigDBAPassword() {
|
||||
|
||||
DBAPasswordFile=$IBRootDir/SYSDBA.password
|
||||
|
||||
NewPasswd='masterkey'
|
||||
echo "Firebird initial install password " > $DBAPasswordFile
|
||||
echo "for user SYSDBA is : $NewPasswd" >> $DBAPasswordFile
|
||||
|
||||
echo "for install on `hostname` at time `date`" >> $DBAPasswordFile
|
||||
echo "You should change this password at the earliest oportunity" >> $DBAPasswordFile
|
||||
echo ""
|
||||
|
||||
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 should 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
|
||||
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Generate new sysdba password
|
||||
|
||||
|
||||
generateNewDBAPassword() {
|
||||
|
||||
|
||||
# Not all systems have mkpasswd, and there is also another mkpasswd which
|
||||
# does different things. So if not at this specific place leave as default
|
||||
|
||||
|
||||
NewPasswd=`/usr/bin/mkpasswd -l 8`
|
||||
|
||||
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.
|
||||
|
||||
# On some systems the mkpasswd program doesn't appear and on others
|
||||
# there is another mkpasswd which does a different operation. So if
|
||||
# the specific one isn't available then keep the original password.
|
||||
|
||||
|
||||
changeDBAPassword() {
|
||||
|
||||
if [ -z "$InteractiveInstall" ]
|
||||
then
|
||||
if [ -f /usr/bin/mkpasswd ]
|
||||
then
|
||||
generateNewDBAPassword
|
||||
else
|
||||
keepOrigDBAPassword
|
||||
fi
|
||||
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
|
||||
|
||||
# make examples writable by anyone
|
||||
chmod uga+rw examples/*.gdb
|
||||
|
||||
|
||||
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
|
37
src/install/super/SSpostuninstall.sh
Executable file
37
src/install/super/SSpostuninstall.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#! /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"
|
||||
|
237
src/install/super/SSpreinstall.sh
Executable file
237
src/install/super/SSpreinstall.sh
Executable file
@ -0,0 +1,237 @@
|
||||
#! /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
|
||||
|
57
src/install/super/SSpreuninstall.sh
Executable file
57
src/install/super/SSpreuninstall.sh
Executable file
@ -0,0 +1,57 @@
|
||||
#! /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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
47
src/install/super/SSrpmfiles.txt
Normal file
47
src/install/super/SSrpmfiles.txt
Normal file
@ -0,0 +1,47 @@
|
||||
%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/bin/SSchangeRunUser.sh
|
||||
/opt/interbase/bin/SSrestoreRootRunUser.sh
|
||||
/opt/interbase/bin/changeDBAPassword.sh
|
||||
|
||||
/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
|
||||
|
15
src/install/super/SSrpmheader.txt
Normal file
15
src/install/super/SSrpmheader.txt
Normal file
@ -0,0 +1,15 @@
|
||||
Summary: Firebird Database Server and Client tools.
|
||||
Name: FirebirdSS
|
||||
Version: 0.9
|
||||
Release: 4
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user