8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 10:40:38 +01:00

Added config_root.cpp file for posix.

This commit is contained in:
skywalker 2002-11-05 16:49:05 +00:00
parent 7cb98409ea
commit a91efa1ae8
8 changed files with 388 additions and 146 deletions

View File

@ -232,7 +232,7 @@ FBCOMMON_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(FBCOMMON_So
# #
# Platform Manager # Platform Manager
OS_SPECIFIC_Files= path_utils.cpp mod_loader.cpp OS_SPECIFIC_Files= config_root.cpp path_utils.cpp mod_loader.cpp
OS_SPECIFIC_Sources = $(addprefix $(PLATFORM_PATH)/, $(OS_SPECIFIC_Files)) OS_SPECIFIC_Sources = $(addprefix $(PLATFORM_PATH)/, $(OS_SPECIFIC_Files))
OS_SPECIFIC_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(OS_SPECIFIC_Sources)))) OS_SPECIFIC_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(OS_SPECIFIC_Sources))))

View File

@ -1,4 +1,4 @@
dnl $Id: configure.in,v 1.62 2002-11-05 13:15:47 kkuznetsov Exp $ dnl $Id: configure.in,v 1.63 2002-11-05 16:48:59 skywalker Exp $
dnl ############################# INITIALISATION ############################### dnl ############################# INITIALISATION ###############################
@ -237,6 +237,14 @@ AC_CHECK_TYPE(socklen_t,int)
AC_SYS_LARGEFILE AC_SYS_LARGEFILE
AC_CHECK_SIZEOF(void*) AC_CHECK_SIZEOF(void*)
dnl MOD: Check for /proc/self/exe mainly used on linux systems
dnl this is used to determine path to executable file.
AC_MSG_CHECKING(for file /proc/self/exe)
AC_CHECK_FILES(/proc/self/exe)
dnl EKU: try to determine the alignment of long and double dnl EKU: try to determine the alignment of long and double
dnl replaces ALIGNMENT and DOUBLE_ALIGN in src/jrd/common.h dnl replaces ALIGNMENT and DOUBLE_ALIGN in src/jrd/common.h
AC_MSG_CHECKING(alignment of long) AC_MSG_CHECKING(alignment of long)
@ -462,6 +470,8 @@ mkdir -p gen/libfbembed/common/memory
MAKE_SRC_DIR=builds/posix MAKE_SRC_DIR=builds/posix
INSTALL_SRC_DIR=src/install/${FIREBIRD_ARCH_TYPE}
AC_DEFINE_UNQUOTED(ISC_PREFIX,$(if test "x$prefix" = "xNONE" ; then echo \"$ac_default_prefix\"; else echo \"$prefix\"; fi)) AC_DEFINE_UNQUOTED(ISC_PREFIX,$(if test "x$prefix" = "xNONE" ; then echo \"$ac_default_prefix\"; else echo \"$prefix\"; fi))
AC_OUTPUT( AC_OUTPUT(
@ -505,12 +515,13 @@ gen/Makefile.embed.gpre:${MAKE_SRC_DIR}/Makefile.in.embed.gpre
src/v5_examples/Makefile:${MAKE_SRC_DIR}/Makefile.in.example5 src/v5_examples/Makefile:${MAKE_SRC_DIR}/Makefile.in.example5
gen/Makefile.install:${MAKE_SRC_DIR}/Makefile.in.install gen/Makefile.install:${MAKE_SRC_DIR}/Makefile.in.install
Makefile:Makefile.in Makefile:Makefile.in
gen/install/scripts/preinstall.sh:src/install/${FIREBIRD_ARCH_TYPE}/preinstall.sh.in gen/install/makeInstallImage.sh:${INSTALL_SRC_DIR}/makeInstallImage.sh.in
gen/install/scripts/install.sh:src/install/${FIREBIRD_ARCH_TYPE}/install.sh.in gen/install/scripts/preinstall.sh:${INSTALL_SRC_DIR}/preinstall.sh.in
gen/install/scripts/postinstall.sh:src/install/${FIREBIRD_ARCH_TYPE}/postinstall.sh.in gen/install/scripts/install.sh:${INSTALL_SRC_DIR}/install.sh.in
gen/install/scripts/preuninstall.sh:src/install/${FIREBIRD_ARCH_TYPE}/preuninstall.sh.in gen/install/scripts/postinstall.sh:${INSTALL_SRC_DIR}/postinstall.sh.in
gen/install/scripts/postuninstall.sh:src/install/${FIREBIRD_ARCH_TYPE}/postuninstall.sh.in gen/install/scripts/preuninstall.sh:${INSTALL_SRC_DIR}/preuninstall.sh.in
gen/install/install.sh:src/install/${FIREBIRD_ARCH_TYPE}/tarInstall.sh.in gen/install/scripts/postuninstall.sh:${INSTALL_SRC_DIR}/postuninstall.sh.in
gen/install/install.sh:${INSTALL_SRC_DIR}/tarInstall.sh.in
src/install/misc/firebird.xinetd src/install/misc/firebird.xinetd
dnl SINIX-Z start dnl SINIX-Z start
gen/install/sinixz/Makefile:src/install/arch-specific/sinixz/Makefile.in gen/install/sinixz/Makefile:src/install/arch-specific/sinixz/Makefile.in

View File

@ -70,7 +70,7 @@ addFirebirdUser() {
testStr=`grep firebird /etc/passwd` testStr=`grep firebird /etc/passwd`
if [ -z "$testDir" ] if [ -z "$testDir" ]
then then
useradd -o -r -m -d $FBRootDir -s /bin/bash \ useradd -o -r -m -d $IBRootDir -s /bin/bash \
-c "Firebird Database Administrator" -g firebird -u 84 firebird -c "Firebird Database Administrator" -g firebird -u 84 firebird
# >/dev/null 2>&1 # >/dev/null 2>&1
@ -99,8 +99,8 @@ changeXinetdServiceUser() {
InitFile=/etc/xinetd.d/firebird InitFile=/etc/xinetd.d/firebird
if [ -f $InitFile ] if [ -f $InitFile ]
then then
ed -s $InitFile <<EOF ex -s $InitFile <<EOF
/ user /s/=.*$/= $RunUser/g / user /s/=.*\$/= $RunUser/g
w w
q q
EOF EOF
@ -114,7 +114,7 @@ EOF
updateInetdEntry() { updateInetdEntry() {
FileName=/etc/inetd.conf FileName=/etc/inetd.conf
newLine="gds_db stream tcp nowait.30000 $RunUser $FBBin/gds_inet_server gds_inet_server # InterBase Database Remote Server" newLine="gds_db stream tcp nowait.30000 $RunUser $IBBin/gds_inet_server gds_inet_server # InterBase Database Remote Server"
oldLine=`grep "^gds_db" $FileName` oldLine=`grep "^gds_db" $FileName`
replaceLineInFile "$FileName" "$newLine" "$oldLine" replaceLineInFile "$FileName" "$newLine" "$oldLine"
@ -125,7 +125,10 @@ updateInetdEntry() {
updateXinetdEntry() { updateXinetdEntry() {
cp $FBRootDir/misc/firebird.xinetd /etc/xinetd.d/firebird InitFile=/etc/xinetd.d/firebird
cp $IBRootDir/misc/firebird.xinetd $InitFile
chown root:root $InitFile
chmod o=rw,go=r $InitFile
changeXinetdServiceUser changeXinetdServiceUser
} }
@ -156,7 +159,7 @@ updateInetdServiceEntry() {
keepOrigDBAPassword() { keepOrigDBAPassword() {
DBAPasswordFile=$FBRootDir/SYSDBA.password DBAPasswordFile=$IBRootDir/SYSDBA.password
NewPasswd='masterkey' NewPasswd='masterkey'
echo "Firebird initial install password " > $DBAPasswordFile echo "Firebird initial install password " > $DBAPasswordFile
@ -170,7 +173,7 @@ keepOrigDBAPassword() {
echo "daemon init routine in the file /etc/init.d/firebird)" >> $DBAPasswordFile echo "daemon init routine in the file /etc/init.d/firebird)" >> $DBAPasswordFile
echo "" >> $DBAPasswordFile echo "" >> $DBAPasswordFile
echo "Your should password can be changed to a more suitable one using the" >> $DBAPasswordFile echo "Your should password can be changed to a more suitable one using the" >> $DBAPasswordFile
echo "@prefix@/bin/changeDBAPassword.sh script" >> $DBAPasswordFile echo "/opt/interbase/bin/changeDBAPassword.sh script" >> $DBAPasswordFile
echo "" >> $DBAPasswordFile echo "" >> $DBAPasswordFile
chmod u=r,go= $DBAPasswordFile chmod u=r,go= $DBAPasswordFile
@ -186,9 +189,14 @@ keepOrigDBAPassword() {
generateNewDBAPassword() { generateNewDBAPassword() {
DBAPasswordFile=$FBRootDir/SYSDBA.password DBAPasswordFile=$IBRootDir/SYSDBA.password
NewPasswd=`/usr/bin/mkpasswd -l 8` NewPasswd=`/usr/bin/mkpasswd -l 8`
if [ -z "$NewPasswd" ]
then
keepOrigDBAPassword
return
fi
echo "Firebird generated password " > $DBAPasswordFile echo "Firebird generated password " > $DBAPasswordFile
echo "for user SYSDBA is : $NewPasswd" >> $DBAPasswordFile echo "for user SYSDBA is : $NewPasswd" >> $DBAPasswordFile
@ -197,11 +205,11 @@ generateNewDBAPassword() {
echo "daemon init routine in the file /etc/rc.d/init.d/firebird)" >> $DBAPasswordFile echo "daemon init routine in the file /etc/rc.d/init.d/firebird)" >> $DBAPasswordFile
echo "" >> $DBAPasswordFile echo "" >> $DBAPasswordFile
echo "Your password can be changed to a more suitable one using the" >> $DBAPasswordFile echo "Your password can be changed to a more suitable one using the" >> $DBAPasswordFile
echo "@prefix@/bin/changeDBAPassword.sh script" >> $DBAPasswordFile echo "/opt/interbase/bin/changeDBAPassword.sh script" >> $DBAPasswordFile
echo "" >> $DBAPasswordFile echo "" >> $DBAPasswordFile
chmod u=r,go= $DBAPasswordFile chmod u=r,go= $DBAPasswordFile
$FBBin/gsec -user sysdba -password masterkey <<EOF $IBBin/gsec -user sysdba -password masterkey <<EOF
modify sysdba -pw $NewPasswd modify sysdba -pw $NewPasswd
EOF EOF
@ -219,7 +227,7 @@ askUserForNewDBAPassword() {
while [ -z "$NewPasswd" ] while [ -z "$NewPasswd" ]
do do
# If using a generated password # If using a generated password
# DBAPasswordFile=$FBRootDir/SYSDBA.password # DBAPasswordFile=$IBRootDir/SYSDBA.password
# NewPasswd=`mkpasswd -l 8` # NewPasswd=`mkpasswd -l 8`
# echo "Password for SYSDBA on `hostname` is : $NewPasswd" > $DBAPasswordFile # echo "Password for SYSDBA on `hostname` is : $NewPasswd" > $DBAPasswordFile
# chmod ga-rwx $DBAPasswordFile # chmod ga-rwx $DBAPasswordFile
@ -228,7 +236,7 @@ askUserForNewDBAPassword() {
NewPasswd=$Answer NewPasswd=$Answer
if [ ! -z "$NewPasswd" ] if [ ! -z "$NewPasswd" ]
then then
$FBBin/gsec -user sysdba -password masterkey <<EOF $IBBin/gsec -user sysdba -password masterkey <<EOF
modify sysdba -pw $NewPasswd modify sysdba -pw $NewPasswd
EOF EOF
echo "" echo ""
@ -274,13 +282,13 @@ changeDBAPassword() {
fixFilePermissions() { fixFilePermissions() {
# Turn other access off. # Turn other access off.
chmod -R o= $FBRootDir chmod -R o= $IBRootDir
# Now fix up the mess. # Now fix up the mess.
# fix up directories # fix up directories
for i in `find $FBRootDir -print` for i in `find $IBRootDir -print`
do do
FileName=$i FileName=$i
if [ -d $FileName ] if [ -d $FileName ]
@ -290,7 +298,7 @@ fixFilePermissions() {
done done
cd $FBBin cd $IBBin
# set up the defaults for bin # set up the defaults for bin
@ -315,7 +323,7 @@ fixFilePermissions() {
done done
cd $FBRootDir cd $IBRootDir
# Fix lock files # Fix lock files
for i in isc_init1 isc_lock1 isc_event1 for i in isc_init1 isc_lock1 isc_event1
@ -328,9 +336,24 @@ fixFilePermissions() {
chmod ug=rw,o= interbase.log chmod ug=rw,o= interbase.log
chmod a=r interbase.msg chmod a=r interbase.msg
chmod a=r README
chmod ug=rw,o= help/help.gdb chmod ug=rw,o= help/help.gdb
chmod ug=rw,o= isc4.gdb chmod ug=rw,o= isc4.gdb
chmod a=r isc_config
# Set a default of read all files in includes
for i in include lib UDF intl misc
do
cd $i
for j in `ls`
do
chmod a=r $j
done
cd ..
done
# Set a default of read all files in examples # Set a default of read all files in examples
@ -344,28 +367,6 @@ fixFilePermissions() {
# make examples db's writable by group # make examples db's writable by group
chmod ug=rw,o= *.gdb 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 ..
} }
@ -375,17 +376,22 @@ fixFilePermissions() {
# running the server as root user. I hope to remove this mode # running the server as root user. I hope to remove this mode
# of running before the next version, since it's security level # of running before the next version, since it's security level
# is absolutely woeful. # is absolutely woeful.
#
# The main difference between fixFIlePermissionsRoot and fixFilePermissions
# is that non root assumes you must be a member of the group to access most
# of the files, wheras root user install gives world writable permission to
# the installation.
fixFilePermissionsRoot() { fixFilePermissionsRoot() {
# Turn other access off. # Turn other access off.
chmod -R o= $FBRootDir chmod -R o= $IBRootDir
# Now fix up the mess. # Now fix up the mess.
# fix up directories # fix up directories
for i in `find $FBRootDir -print` for i in `find $IBRootDir -print`
do do
FileName=$i FileName=$i
if [ -d $FileName ] if [ -d $FileName ]
@ -395,7 +401,7 @@ fixFilePermissionsRoot() {
done done
cd $FBBin cd $IBBin
# set up the defaults for bin # set up the defaults for bin
@ -413,7 +419,21 @@ fixFilePermissionsRoot() {
done done
cd $FBRootDir cd $IBRootDir
# Set a default of read all files in includes
for i in include lib UDF intl misc
do
cd $i
for j in `ls`
do
chmod a=r $j
done
cd ..
done
# Fix lock files # Fix lock files
for i in isc_init1 isc_lock1 isc_event1 for i in isc_init1 isc_lock1 isc_event1
@ -426,8 +446,10 @@ fixFilePermissionsRoot() {
chmod a=rw interbase.log chmod a=rw interbase.log
chmod a=r interbase.msg chmod a=r interbase.msg
chmod a=r README
chmod a=rw help/help.gdb chmod a=rw help/help.gdb
chmod a=rw isc4.gdb chmod a=rw isc4.gdb
chmod a=r isc_config
# Set a default of read all files in examples # Set a default of read all files in examples
@ -442,29 +464,37 @@ fixFilePermissionsRoot() {
# make examples db's writable by group # make examples db's writable by group
chmod a=rw *.gdb 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 ..
} }
#------------------------------------------------------------------------
# UpdateHostsDotEquivFile
# The /etc/hosts.equiv file is needed to allow local access for super server
# from processes on the machine to port 3050 on the local machine.
# The two host names that are needed there are
# localhost.localdomain and whatever hostname returns.
UpdateHostsDotEquivFile() {
hostEquivFile=/etc/hosts.equiv
if [ ! -f $hostEquivFile ]
then
touch $hostEquivFile
chown root:root $hostEquivFile
chmod u=rw,go=r $hostEquivFile
fi
newLine="localhost.localdomain"
oldLine=`grep "$newLine" $hostEquivFile`
replaceLineInFile "$hostEquivFile" "$newLine" "$oldLine"
newLine="`hostname`"
oldLine=`grep "$newLine" $hostEquivFile`
replaceLineInFile "$hostEquivFile" "$newLine" "$oldLine"
}
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# resetXinitdServer # resetXinitdServer
# Check for both inetd and xinetd, only one will actually be running. # Check for both inetd and xinetd, only one will actually be running.
@ -479,28 +509,22 @@ resetInetdServer() {
if [ -f /var/run/xinetd.pid ] if [ -f /var/run/xinetd.pid ]
then then
kill -HUP `cat /var/run/xinetd.pid` kill -USR2 `cat /var/run/xinetd.pid`
fi fi
} }
#= Main Post =============================================================== #= Main Post ===============================================================
# Make sure the links are in place # Make sure the links are in place
if [ -z "$FirebirdInstallPrefix" ] if [ ! -L /opt/interbase -a ! -d /opt/interbase ]
then then
FirebirdInstallPrefix=@prefix@ # Main link and...
ln -s $RPM_INSTALL_PREFIX/interbase /opt/interbase
fi fi
# Hopefully we are done with this link.
# if [ ! -L /opt/interbase -a ! -d /opt/interbase ]
# then
# # Main link and...
# ln -s $RPM_INSTALL_PREFIX/interbase /opt/interbase
# fi
IBRootDir=/opt/interbase
FBRootDir=$FirebirdInstallPrefix IBBin=$IBRootDir/bin
FBBin=$FBRootDir/bin
RunUser=root RunUser=root
# RunUser=firebird # RunUser=firebird
@ -510,9 +534,9 @@ resetInetdServer() {
FileName=/etc/services FileName=/etc/services
newLine="gds_db 3050/tcp # InterBase Database Remote Protocol" newLine="gds_db 3050/tcp # InterBase Database Remote Protocol"
oldLine=`grep "^gds_db" $FileName` oldLine=`grep "^gds_db" $FileName`
replaceLineInFile "$FileName" "$newLine" "$oldLine" replaceLineInFile "$FileName" "$newLine" "$oldLine"
UpdateHostsDotEquivFile
# add Firebird user # add Firebird user
if [ $RunUser = "firebird" ] if [ $RunUser = "firebird" ]
@ -522,7 +546,7 @@ resetInetdServer() {
# Create Lock files # Create Lock files
cd $FBRootDir cd $IBRootDir
for i in isc_init1 isc_lock1 isc_event1 for i in isc_init1 isc_lock1 isc_event1
do do
@ -535,13 +559,9 @@ resetInetdServer() {
# Update ownership and SUID bits for programs. # Update ownership and SUID bits for programs.
chown -R $RunUser.$RunUser $FBRootDir chown -R $RunUser.$RunUser $IBRootDir
if [ "$RunUser" = "root" ] # fixFilePermissions
then
fixFilePermissionsRoot fixFilePermissionsRoot
else
fixFilePermissions
fi
# Update the /etc/inetd.conf or xinetd entry # Update the /etc/inetd.conf or xinetd entry
updateInetdServiceEntry updateInetdServiceEntry
@ -551,9 +571,11 @@ resetInetdServer() {
resetInetdServer resetInetdServer
cd $FBRootDir cd $IBRootDir
# Change sysdba password # Change sysdba password
changeDBAPassword #changeDBAPassword
keepOrigDBAPassword

View File

@ -20,22 +20,29 @@ removeLineFromFile() {
} }
#= Main PostUn ============================================================ #------------------------------------------------------------------------
# remove the xinetd config file and restart the service
if [ -L /usr/lib/libgds.so ] removeXInetDService() {
if [ -f /etc/xinetd.d/firebird ]
then then
rm /usr/lib/libgds.so rm -f /etc/xinetd.d/firebird
fi fi
if [ "$1"=0 ]
if [ -f /var/run/xinetd.pid ]
then then
kill -USR2 `cat /var/run/xinetd.pid`
fi
# Lose the gds_db line from /etc/services }
FileName=/etc/services
oldLine=`grep "^gds_db" $FileName`
removeLineFromFile "$FileName" "$oldLine"
#------------------------------------------------------------------------
# remove the inetd file and restart the service.
removeInetDService() {
# Next, lose the gds_db line from /etc/inetd.conf # Next, lose the gds_db line from /etc/inetd.conf
FileName=/etc/inetd.conf FileName=/etc/inetd.conf
@ -48,4 +55,33 @@ removeLineFromFile() {
then then
kill -HUP `cat /var/run/inetd.pid` kill -HUP `cat /var/run/inetd.pid`
fi fi
}
#= Main PostUn ============================================================
# I don't think this is needed anymore.
# 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"
if [ -d /etc/xinetd.d ]
then
removeXInetDService
elif [ -f /etc/inetd.d ]
then
removeInetDService
fi
fi fi

View File

@ -29,7 +29,10 @@ stopServerIfRunning() {
if [ ! -z "$checkString" ] if [ ! -z "$checkString" ]
then then
if [ -f /etc/rc.d/init.d/firebird ] if [ -f /etc/init.d/firebird ]
then
/etc/init.d/firebird stop
elif [ -f /etc/rc.d/init.d/firebird ]
then then
/etc/rc.d/init.d/firebird stop /etc/rc.d/init.d/firebird stop
fi fi
@ -51,8 +54,9 @@ checkIfServerRunning() {
if [ ! -z "$checkString" ] if [ ! -z "$checkString" ]
then then
echo "An instance of the Firebird super server seems to be running." echo "An instance of the Firebird/InterBase Super server seems to be running."
echo "Please quit all firebird applications and then proceed" echo "(the ibserver or ibguard process was detected running on your system)"
echo "Please quit all Firebird applications and then proceed"
exit 1 exit 1
fi fi
@ -60,20 +64,27 @@ checkIfServerRunning() {
if [ ! -z "$checkString" ] if [ ! -z "$checkString" ]
then then
echo "An instance of the Firebird server seems to be running." echo "An instance of the Firebird/InterBase classic server seems to be running."
echo "(the gds_inet_server or gds_pipe process was detected running on your system)"
echo "Please quit all Firebird applications and then proceed." echo "Please quit all Firebird applications and then proceed."
exit 1 exit 1
fi fi
checkString=`netstat -an | egrep '3050.*LISTEN'`
if [ ! -z "$checkString" ]
then
echo "An instance of the Firebird server seems to be running."
echo "Please quit all Firebird applications and then proceed."
exit 1
fi
# This one is commented out, since it usually works out ok, we have
# checked that no procesers are active, but inetd/xinetd is still listening
# the best thing would be to turn the service off, but I don't have time
# to do all the xinetd/inetd stuff, see the preunistall.sh script for details
#
# checkString=`netstat -an | egrep '3050.*LISTEN'`
#
# if [ ! -z "$checkString" ]
# then
# echo "An instance of the Firebird/InterBase server seems to be running."
# echo "(netstat -an reports a process is already listening on port 3050)"
# echo "Please quit all Firebird applications and then proceed."
# exit 1
# fi
# Stop lock manager if it is the only thing running. # Stop lock manager if it is the only thing running.
@ -83,7 +94,6 @@ checkIfServerRunning() {
kill $i kill $i
done done
} }
#------------------------------------------------------------------------ #------------------------------------------------------------------------
@ -135,15 +145,15 @@ archivePriorInstallSystemFiles() {
cd / cd /
DestFile="$FBRootDir" DestFile="opt/interbase"
if [ -e "$DestFile" ] if [ -e "$DestFile" ]
then then
echo "" echo ""
echo "" echo ""
echo "" echo ""
echo "--- Warning ----------------------------------------------" echo "--- Warning ----------------------------------------------"
echo " The installation target directory: $FBRootDir" echo " The installation target directory: $IBRootDir"
echo " Already contains a prior installation of Firebird." echo " Already contains a prior installation of InterBase/Firebird."
echo " This and files found in /usr/include and /usr/lib will be" echo " This and files found in /usr/include and /usr/lib will be"
echo " archived in the file : ${ArchiveMainFile}" echo " archived in the file : ${ArchiveMainFile}"
echo "" echo ""
@ -169,7 +179,7 @@ archivePriorInstallSystemFiles() {
fi fi
done done
for i in gds.a @FIREBIRD_LIBGDS_SO@ ib_util.so for i in gds_pyxis.a gds.a libgds.so.0 libgds.so libib_util.so libgds.a
do do
DestFile=usr/lib/$i DestFile=usr/lib/$i
if [ -e $DestFile ] if [ -e $DestFile ]
@ -178,6 +188,15 @@ archivePriorInstallSystemFiles() {
fi fi
done done
for i in usr/sbin/rcfirebird etc/init.d/firebird etc/rc.d/init.d/firebird
do
DestFile=$i
if [ -e $DestFile ]
then
archiveFileList="$archiveFileList $DestFile"
fi
done
if [ ! -z "$archiveFileList" ] if [ ! -z "$archiveFileList" ]
then then
@ -205,6 +224,11 @@ archivePriorInstallSystemFiles() {
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# Check for installed RPM package # Check for installed RPM package
# (Pavel I've left this in since originally I could test for other packages,
# even if they did not conflict with current ones, ie we can test InterBase
# and CS/SS The package manager does not allow it currently but I've left
# this in in case that sort of thing gets allowed again
checkForRPMInstall() { checkForRPMInstall() {
PackageName=$1 PackageName=$1
@ -224,15 +248,10 @@ checkForRPMInstall() {
#= Main Pre ================================================================ #= Main Pre ================================================================
IBRootDir=/opt/interbase
if [ -z "$FirebirdInstallPrefix" ] IBBin=$IBRootDir/bin
then
FirebirdInstallPrefix=@prefix@
fi
FBRootDir=$FirebirdInstallPrefix
FBBin=$FBRootDir/bin
ArchiveDateTag=`date +"%Y%m%d_%H%M"` ArchiveDateTag=`date +"%Y%m%d_%H%M"`
ArchiveMainFile="${FBRootDir}_${ArchiveDateTag}.tar.gz" ArchiveMainFile="${IBRootDir}_${ArchiveDateTag}.tar.gz"

View File

@ -15,6 +15,7 @@ checkIfServerRunning() {
if [ ! -z "$checkString" ] if [ ! -z "$checkString" ]
then then
echo "An instance of the Firebird/InterBase server seems to be running." echo "An instance of the Firebird/InterBase server seems to be running."
echo "(the gds_inet_server or gds_pipe process was detected running on your system)"
echo "Please quit all interbase applications and then proceed." echo "Please quit all interbase applications and then proceed."
exit 1 exit 1
fi fi
@ -35,18 +36,12 @@ checkIfServerRunning() {
# This is a bit simple, but should work for now. # This is a bit simple, but should work for now.
# cron will remove files in /tmp after a while. # cron will remove files in /tmp after a while.
IBRootDir=/opt/interbase
if [ -z "$FirebirdInstallPrefix" ] IBBin=$IBRootDir/bin
then
FirebirdInstallPrefix=%prefix%
fi
FBRootDir=$FirebirdInstallPrefix/firebird
FBBin=$FBRootDir/bin
checkIfServerRunning checkIfServerRunning
cd $FBRootDir cd $IBRootDir
if [ -f isc4.gdb ] if [ -f isc4.gdb ]
then then
@ -54,7 +49,7 @@ checkIfServerRunning() {
echo "Saved a copy of isc4.gdb in /tmp" echo "Saved a copy of isc4.gdb in /tmp"
fi fi
for i in isc_init1* isc_event1* isc_lock1* interbase.log SYSDBA.password for i in isc_init1* isc_event1* isc_lock1* isc_guard* interbase.log SYSDBA.password
do do
if [ -f $i ] if [ -f $i ]
then then

View File

@ -0,0 +1,154 @@
/*
* PROGRAM: Client/Server Common Code
* MODULE: config_root.cpp
* DESCRIPTION: Configuration manager (platform specific - linux/posix)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* You may obtain a copy of the Licence at
* http://www.gnu.org/licences/lgpl.html
*
* As a special exception this file can also be included in modules
* with other source code as long as that source code has been
* released under an Open Source Initiative certificed licence.
* More information about OSI certification can be found at:
* http://www.opensource.org
*
* This module 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
* GNU Lesser General Public Licence for more details.
*
* This module was created by members of the firebird development
* team. All individual contributions remain the Copyright (C) of
* those individuals and all rights are reserved. Contributors to
* this file are either listed below or can be obtained from a CVS
* history command.
*
* Created by: Mark O'Donohue <skywalker@users.sourceforge.net>
*
* Contributor(s):
*
*
* $Id: config_root.cpp,v 1.1 2002-11-05 16:49:05 skywalker Exp $
*/
#include "firebird.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "fb_types.h"
#include "fb_string.h"
#include "../jrd/os/config_root.h"
#include "../jrd/os/path_utils.h"
typedef Firebird::string string;
const string CONFIG_FILE = "firebird.conf";
/******************************************************************************
*
* Platform-specific root locator
*/
#ifdef HAVE__PROC_SELF_EXE
static string getExePathViaProcEntry()
{
char buffer[MAXPATHLEN];
int len = readlink("/proc/self/exe", buffer, sizeof(buffer));
buffer[len]=0;
string pathName = buffer;
return pathName;
}
#endif
/******************************************************************************
*
*
*/
static string getRootPathFromExePath()
{
// get the pathname of the running executable
string bin_dir;
#ifdef HAVE__PROC_SELF_EXE
bin_dir = getExePathViaProcEntry();
#endif
// get rid of the filename
int index = bin_dir.rfind(PathUtils::dir_sep);
bin_dir = bin_dir.substr(0, index);
// how should we decide to use bin_dir instead of root_dir? any ideas?
// ???
// go to the parent directory
index = bin_dir.rfind(PathUtils::dir_sep, bin_dir.length());
string root_dir = (index ? bin_dir.substr(0, index) : bin_dir) + PathUtils::dir_sep;
return root_dir;
}
static string getRootPathFromEnvVar()
{
const char* varPtr = getenv("FIREBIRD");
string rootpath;
if (varPtr == NULL) {
rootpath = varPtr;
}
return rootpath;
}
static string getRootPathFromInstallDir()
{
// Need to speak to Erik about this one, as the variable
// needs to come from the autoconf file.
string rootpath;
return rootpath;
}
ConfigRoot::ConfigRoot()
{
// Try getting the root path from the executable
root_dir = getRootPathFromExePath();
if (root_dir.length() != 0) {
return;
}
// Try getting the root path from environment variable
root_dir = getRootPathFromEnvVar();
if (root_dir.length() != 0) {
return;
}
// As a last resort get it from the default install directory
root_dir = ISC_PREFIX;
}
string ConfigRoot::getRootDirectory() const
{
return root_dir;
}
string ConfigRoot::getConfigFile() const
{
return "/etc/" + CONFIG_FILE;
}

View File

@ -1,4 +1,4 @@
#ident "$Id: config.h.in,v 1.44 2002-11-05 13:48:42 kkuznetsov Exp $" #ident "$Id: config.h.in,v 1.45 2002-11-05 16:49:05 skywalker Exp $"
/* /*
* 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete ports: * 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete ports:
@ -74,6 +74,7 @@
#undef HAVE_GETPAGESIZE #undef HAVE_GETPAGESIZE
#undef HAVE_XDR_HYPER #undef HAVE_XDR_HYPER
/* Types */ /* Types */
#undef socklen_t #undef socklen_t
@ -108,6 +109,10 @@
/* Support databases on Raw Devices (UNIX only) */ /* Support databases on Raw Devices (UNIX only) */
#undef SUPPORT_RAW_DEVICES #undef SUPPORT_RAW_DEVICES
/* Support /etc/proc/exe as link to current executable
* enables us to find path to install directory (Linux only) */
#undef HAVE__PROC_SELF_EXE
/* CPU types */ /* CPU types */
#undef PowerPC #undef PowerPC
#undef sparc #undef sparc