8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 18:43:02 +01:00

Added support for systemd

Removed scripts to change firebird runuser to root and back to firebird
Removed script changing SYSDBA password (nothing except gsec call left in it)
Reorganize posix/linux install files minimizing OS-specific part of .tgz install scripts
Related cleanup and bugfixing in posix install
This commit is contained in:
alexpeshkoff 2013-09-13 12:27:16 +00:00
parent 7c243418a9
commit 957b696b5c
30 changed files with 336 additions and 313 deletions

View File

@ -0,0 +1,10 @@
[Unit]
Description=Firebird Database Server ( Classic )
After=local-fs.target
[Service]
User=firebird
Group=firebird
ExecStart=@FB_SBINDIR@/firebird
StandardInput=socket
StandardError=syslog

View File

@ -0,0 +1,10 @@
[Unit]
Description=Firebird Classic Activation Socket
Conflicts=firebird-superserver.service
[Socket]
ListenStream=3050
Accept=true
[Install]
WantedBy=sockets.target

View File

@ -0,0 +1,15 @@
[Unit]
Description=Firebird Database Server ( SuperServer )
After=syslog.target network.target
Conflicts=firebird-classic.socket
[Service]
User=firebird
Group=firebird
Type=forking
PIDFile=/var/run/firebird/default.pid
ExecStart=@FB_SBINDIR@/fbguard -pidfile /var/run/firebird/default.pid -daemon -forever
StandardError=syslog
[Install]
WantedBy=multi-user.target

View File

@ -32,7 +32,7 @@ makeFbDir $lockDir 0770
pidfile="$runDir/$INSTANCE.pid" pidfile="$runDir/$INSTANCE.pid"
FULLNAME="Firebird server [$INSTANCE]" FULLNAME="Firebird server [$INSTANCE]"
LD_LIBRARY_PATH=$FIREBIRD/lib LD_LIBRARY_PATH=$FIREBIRD/lib:$LD_LIBRARY_PATH
export FIREBIRD LD_LIBRARY_PATH export FIREBIRD LD_LIBRARY_PATH

View File

@ -36,7 +36,7 @@ makeFbDir $lockDir 0770
pidfile="$runDir/$INSTANCE.pid" pidfile="$runDir/$INSTANCE.pid"
FULLNAME="firebird server [$INSTANCE]" FULLNAME="firebird server [$INSTANCE]"
LD_LIBRARY_PATH=$FIREBIRD/lib LD_LIBRARY_PATH=$FIREBIRD/lib:$LD_LIBRARY_PATH
FB_OPTS="-pidfile $pidfile -daemon -forever" FB_OPTS="-pidfile $pidfile -daemon -forever"
export FIREBIRD LD_LIBRARY_PATH export FIREBIRD LD_LIBRARY_PATH

View File

@ -52,7 +52,7 @@ makeFbDir $lockDir 0770
pidfile="$runDir/$INSTANCE.pid" pidfile="$runDir/$INSTANCE.pid"
FULLNAME="Firebird server [$INSTANCE]" FULLNAME="Firebird server [$INSTANCE]"
LD_LIBRARY_PATH=$FIREBIRD/lib LD_LIBRARY_PATH=$FIREBIRD/lib:$LD_LIBRARY_PATH
export FIREBIRD LD_LIBRARY_PATH export FIREBIRD LD_LIBRARY_PATH

View File

@ -36,7 +36,7 @@ makeFbDir $lockDir 0770
pidfile="$runDir/$INSTANCE.pid" pidfile="$runDir/$INSTANCE.pid"
FULLNAME="Firebird server [$INSTANCE]" FULLNAME="Firebird server [$INSTANCE]"
LD_LIBRARY_PATH=$FIREBIRD/lib LD_LIBRARY_PATH=$FIREBIRD/lib:$LD_LIBRARY_PATH
export FIREBIRD LD_LIBRARY_PATH export FIREBIRD LD_LIBRARY_PATH

View File

@ -29,6 +29,9 @@ export RunGroup
PidDir=/var/run/firebird PidDir=/var/run/firebird
export PidDir export PidDir
# Additional OS settings
OS_Has_Specific_Classic_Startup=yes
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# Get correct options & misc. # Get correct options & misc.
@ -73,18 +76,18 @@ TryAddUser() {
addFirebirdUser() { addFirebirdUser() {
TryAddGroup "-g 84 -r" >/dev/null 2>&1 TryAddGroup "-g 84 -r" >/dev/null 2>/dev/null
TryAddGroup "-g 84" >/dev/null 2>&1 TryAddGroup "-g 84" >/dev/null 2>/dev/null
TryAddGroup "-r" >/dev/null 2>&1 TryAddGroup "-r" >/dev/null 2>/dev/null
TryAddGroup " " TryAddGroup " "
TryAddUser "-u 84 -r -M" >/dev/null 2>&1 TryAddUser "-u 84 -r -M" >/dev/null 2>/dev/null
TryAddUser "-u 84 -M" >/dev/null 2>&1 TryAddUser "-u 84 -M" >/dev/null 2>/dev/null
TryAddUser "-r -M" >/dev/null 2>&1 TryAddUser "-r -M" >/dev/null 2>/dev/null
TryAddUser "-M" >/dev/null 2>&1 TryAddUser "-M" >/dev/null 2>/dev/null
TryAddUser "-u 84 -r" >/dev/null 2>&1 TryAddUser "-u 84 -r" >/dev/null 2>/dev/null
TryAddUser "-u 84" >/dev/null 2>&1 TryAddUser "-u 84" >/dev/null 2>/dev/null
TryAddUser "-r" >/dev/null 2>&1 TryAddUser "-r" >/dev/null 2>/dev/null
TryAddUser " " TryAddUser " "
} }
@ -149,6 +152,120 @@ getInitScriptLocation() {
} }
#------------------------------------------------------------------------
# register/start/stop server using systemd
SYSTEMCTL=systemctl
CLASSIC_CTRL=firebird-classic.socket
SUPER_CTRL=firebird-superserver.service
SYSTEMD_DIR=/usr/lib/systemd/system
TMPFILE_CONF=/usr/lib/tmpfiles.d/firebird.conf
systemdPresent() {
proc1=`ps -p 1 -o comm=`
[ "${proc1}" = systemd ] && return 0
return 1
}
systemdError() {
echo Fatal systemctl error - exiting
exit 1
}
installSystemdCtrlFiles() {
if systemdPresent
then
cp @FB_MISCDIR@/*.service @FB_MISCDIR@/*.socket ${SYSTEMD_DIR}
tempdir=/var/run/firebird
mkdir -p ${tempdir}
chown firebird:firebird ${tempdir}
chmod 0775 ${tempdir}
echo "d ${tempdir} 0775 firebird firebird -" >${TMPFILE_CONF}
fi
}
osRemoveStartupFiles() {
rm -f ${SYSTEMD_DIR}/firebird-*
rm -f ${TMPFILE_CONF}
}
systemdSrv() {
op=${1}
ctrl=${2}
if [ "${op}" = "stop" -o "${op}" = "disable" ]
then
if [ ! -f ${SYSTEMD_DIR}/${ctrl} ]
then
return 0
fi
fi
if systemdPresent
then
${SYSTEMCTL} --quiet ${op} ${ctrl} || systemdError
return 0
fi
return 1
}
classicSrv() {
op=${1}
systemdSrv ${op} ${CLASSIC_CTRL}
}
superSrv() {
op=${1}
systemdSrv ${op} ${SUPER_CTRL}
}
osRegisterClassicServer() {
installSystemdCtrlFiles
classicSrv enable
}
osUnregisterClassicServer() {
classicSrv disable
}
osStartClassicServer() {
classicSrv start
}
osStopClassicServer() {
classicSrv stop
}
registerSuperServer() {
installSystemdCtrlFiles
superSrv enable && return 0
}
unregisterSuperServer() {
superSrv disable && return 0
}
startSuperServer() {
superSrv start && return 0
}
stopSuperServer() {
superSrv stop && return 0
init_d=`getInitScriptLocation`
if [ -x "$init_d" ]
then
$init_d stop
return 0
fi
return 1
}
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# stop super server if it is running # stop super server if it is running
@ -157,23 +274,18 @@ stopSuperServerIfRunning() {
if [ ! -z "$checkString" ] if [ ! -z "$checkString" ]
then then
init_d=`getInitScriptLocation` i=1
while [ $i -le 20 ]
if [ -x "$init_d" ] do
then stopSuperServer || return # silently giveup
i=1 sleep 1
while [ $i -le 20 ] checkString=`grepProcess "fbserver|fbguard|fb_smp_server|firebird"`
do if [ -z "$checkString" ]
$init_d stop then
sleep 1 return
checkString=`grepProcess "fbserver|fbguard|fb_smp_server|firebird"` fi
if [ -z "$checkString" ] i=$((i+1))
then done
return
fi
i=$((i+1))
done
fi
fi fi
} }
@ -183,7 +295,7 @@ stopSuperServerIfRunning() {
createNewPassword() { createNewPassword() {
# openssl generates random data. # openssl generates random data.
openssl </dev/null >/dev/null 2&>/dev/null openssl </dev/null >/dev/null 2>/dev/null
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
# We generate 40 random chars, strip any '/''s and get the first 20 # We generate 40 random chars, strip any '/''s and get the first 20
@ -206,30 +318,6 @@ createNewPassword() {
echo "$NewPasswd" echo "$NewPasswd"
} }
#------------------------------------------------------------------------
# Generate new sysdba password - this routine is used only in
# silent mode of the install script.
generateNewDBAPassword() {
NewPasswd=`createNewPassword`
writeNewPassword $NewPasswd
}
#------------------------------------------------------------------------
# change init.d RunUser
changeInitRunUser() {
NewUser=$1
InitFile=`getInitScriptLocation`
if [ -f "$InitFile" ]
then
editFile "$InitFile" FBRunUser "FBRunUser=$NewUser"
chmod u=rwx,g=rx,o= "$InitFile"
fi
}
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# installInitdScript # installInitdScript
# Everbody stores this one in a seperate location, so there is a bit of # Everbody stores this one in a seperate location, so there is a bit of
@ -238,6 +326,9 @@ changeInitRunUser() {
# initd script for SuSE >= 7.2 is a part of RPM package # initd script for SuSE >= 7.2 is a part of RPM package
installInitdScript() { installInitdScript() {
# systemd case
registerSuperServer && return 0 # systemd's service file takes care about PidDir
srcScript="" srcScript=""
initScript= initScript=
@ -359,6 +450,9 @@ EOF
# start init.d service # start init.d service
startService() { startService() {
# systemd case
startSuperServer && return 0
InitFile=`getInitScriptLocation` InitFile=`getInitScriptLocation`
if [ -f "$InitFile" ]; then if [ -f "$InitFile" ]; then
"$InitFile" start "$InitFile" start
@ -385,7 +479,10 @@ startService() {
# If we have right systems remove the service autostart stuff. # If we have right systems remove the service autostart stuff.
removeServiceAutostart() { removeServiceAutostart() {
if standaloneServerInstalled; then if standaloneServerInstalled
then
# systemd case
unregisterSuperServer && return 0
# Unregister using OS command # Unregister using OS command
if [ -x /sbin/insserv ]; then if [ -x /sbin/insserv ]; then
@ -416,6 +513,11 @@ removeServiceAutostart() {
# Returns TRUE if SA server is installed # Returns TRUE if SA server is installed
standaloneServerInstalled() { standaloneServerInstalled() {
if systemdPresent; then
${SYSTEMCTL} --quiet is-enabled ${SUPER_CTRL} && return 0
return 1
fi
InitFile=`getInitScriptLocation` InitFile=`getInitScriptLocation`
if [ -f "$InitFile" ]; then if [ -f "$InitFile" ]; then
return 0 return 0

View File

@ -167,11 +167,8 @@ copyFiles() {
cp -f $BuiltFBDir/bin/fbguard ${TargetDir}@FB_SBINDIR@ cp -f $BuiltFBDir/bin/fbguard ${TargetDir}@FB_SBINDIR@
copyIfExists $BuiltFBDir/bin/fb_lock_print ${TargetDir}@FB_SBINDIR@ copyIfExists $BuiltFBDir/bin/fb_lock_print ${TargetDir}@FB_SBINDIR@
addLibs $BuiltFBDir/bin changeRunUser.sh ${TargetDir}@FB_SBINDIR@
addLibs $BuiltFBDir/bin restoreRootRunUser.sh ${TargetDir}@FB_SBINDIR@
addLibs $BuiltFBDir/bin changeDBAPassword.sh ${TargetDir}@FB_SBINDIR@
addLibs $BuiltFBDir/bin changeServerMode.sh ${TargetDir}@FB_SBINDIR@ addLibs $BuiltFBDir/bin changeServerMode.sh ${TargetDir}@FB_SBINDIR@
cp $BuiltFBDir/bin/createAliasDB.sh ${TargetDir}@FB_SBINDIR@ cp $BuiltFBDir/bin/registerDatabase.sh ${TargetDir}@FB_SBINDIR@
cp $BuiltFBDir/bin/fb_config ${TargetDir}@FB_SBINDIR@ cp $BuiltFBDir/bin/fb_config ${TargetDir}@FB_SBINDIR@
chown root:root ${TargetDir}@FB_SBINDIR@/* chown root:root ${TargetDir}@FB_SBINDIR@/*
@ -300,6 +297,7 @@ copyFiles() {
cp $BuildRootDir/gen/install/misc/firebird.xinetd ${TargetDir}@FB_MISCDIR@ cp $BuildRootDir/gen/install/misc/firebird.xinetd ${TargetDir}@FB_MISCDIR@
cp $BuildRootDir/gen/install/misc/firebird.init.d.* ${TargetDir}@FB_MISCDIR@ cp $BuildRootDir/gen/install/misc/firebird.init.d.* ${TargetDir}@FB_MISCDIR@
cp $BuildRootDir/gen/install/misc/rc.config.firebird ${TargetDir}@FB_MISCDIR@ cp $BuildRootDir/gen/install/misc/rc.config.firebird ${TargetDir}@FB_MISCDIR@
cp $BuildRootDir/gen/install/misc/firebird-* ${TargetDir}@FB_MISCDIR@
chown -R root:root ${TargetDir}@FB_MISCDIR@ chown -R root:root ${TargetDir}@FB_MISCDIR@
chmod -R go-rwx ${TargetDir}@FB_MISCDIR@ chmod -R go-rwx ${TargetDir}@FB_MISCDIR@

View File

@ -1,7 +0,0 @@
# This shell script changes both the SYSDBA user
# Firebird install library should be inserted before this file
echo "This script is deprecated and should be removed in newer FB versions."
echo "Please use gsec utility directly to change SYSDBA password."
askUserForNewDBAPassword

View File

@ -1,60 +0,0 @@
#!/bin/sh
#
# The contents of this file are subject to the Initial
# Developer's Public License Version 1.0 (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.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
#
# Software distributed under the License is distributed AS IS,
# WITHOUT WARRANTY OF ANY KIND, either express or implied.
# See the License for the specific language governing rights
# and limitations under the License.
#
# The Original Code was created by Mark O'Donohue
# for the Firebird Open Source RDBMS project.
#
# Copyright (c) Mark O'Donohue <mark.odonohue@ludwig.edu.au>
# and all contributors signed below.
#
# All Rights Reserved.
# Contributor(s): ______________________________________.
# Alex Peshkoff
#
# A routine to change the user that runs Firebird
RunUser=firebird
RunGroup=firebird
checkInstallUser
checkIfServerRunning
# Get confirmation
echo ""
echo "Change Firebird install for @FB_CONFDIR@ 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"
# Add user and group, if missing
if [ $RunUser != "root" ]
then
addFirebirdUser
fi
# Update the /etc/inetd.conf or xinetd entry or /etc/init.d/firebird
echo "Updating /etc file(s)"
updateInetdServiceEntry
changeInitRunUser $RunUser
# Update ownership and SUID bits for programs
echo "Updating permissions"
fixFilePermissions
# Start server again
startFirebird
echo "Completed."

View File

@ -1,60 +0,0 @@
#!/bin/sh
#
# The contents of this file are subject to the Initial
# Developer's Public License Version 1.0 (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.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
#
# Software distributed under the License is distributed AS IS,
# WITHOUT WARRANTY OF ANY KIND, either express or implied.
# See the License for the specific language governing rights
# and limitations under the License.
#
# The Original Code was created by Mark O'Donohue
# for the Firebird Open Source RDBMS project.
#
# Copyright (c) Mark O'Donohue <mark.odonohue@ludwig.edu.au>
# and all contributors signed below.
#
# All Rights Reserved.
# Contributor(s): ______________________________________.
# Alex Peshkoff
#
# A routine to change the user that runs Firebird
RunUser=root
RunGroup=root
checkInstallUser
checkIfServerRunning
# Get confirmation
echo ""
echo "Change Firebird install for @FB_CONFDIR@ 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"
# Add user and group, if missing
if [ $RunUser != "root" ]
then
addFirebirdUser
fi
# Update the /etc/inetd.conf or xinetd entry or /etc/init.d/firebird
echo "Updating /etc file(s)"
updateInetdServiceEntry
changeInitRunUser $RunUser
# Update ownership and SUID bits for programs
echo "Updating permissions"
fixFilePermissions
# Start server again
startFirebird
echo "Completed."

View File

@ -27,8 +27,6 @@ cat <<EOF
Firebird server may run in 2 different modes - super and classic. Firebird server may run in 2 different modes - super and classic.
Super server provides better performance, classic - better availability. Super server provides better performance, classic - better availability.
*** Warning: runuser will be reset to firebird.
EOF EOF
AskQuestion "Which option would you like to choose: (super|classic) [super] " "super" AskQuestion "Which option would you like to choose: (super|classic) [super] " "super"

View File

@ -110,7 +110,8 @@ AskYNQuestion() {
runSilent() { runSilent() {
MakeTemp MakeTemp
$1 >$TmpFile 2>&1 rm -f $TmpFile
$1 >>$TmpFile 2>>$TmpFile
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
cat $TmpFile cat $TmpFile
@ -150,6 +151,11 @@ checkInstallUser() {
# Works for both inetd and xinetd # Works for both inetd and xinetd
resetInetdServer() { resetInetdServer() {
if [ "$OS_Has_Specific_Classic_Startup" ]
then
return
fi
pid=`grepProcess "inetd|xinetd" | awk '{print $2}'` pid=`grepProcess "inetd|xinetd" | awk '{print $2}'`
if [ "$pid" ] if [ "$pid" ]
then then
@ -158,15 +164,34 @@ resetInetdServer() {
} }
#------------------------------------------------------------------------
# check does directory have files
hasFiles() {
dir=$1
for i in $dir/*
do
if [ -f "$i" ]
then
return 0
fi
done
return 1
}
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# remove the xinetd config file(s) # remove the xinetd config file(s)
# take into account possible pre-firebird xinetd services # take into account possible pre-firebird xinetd services
removeXinetdEntry() { removeXinetdEntry() {
for i in `grep -l "service @FB_SERVICE_NAME@" /etc/xinetd.d/*` if hasFiles /etc/xinetd.d
do then
rm -f $i for i in `grep -l "service @FB_SERVICE_NAME@" /etc/xinetd.d/*`
done do
rm -f $i
done
fi
} }
@ -186,7 +211,14 @@ removeInetdEntry() {
# Install differs for each of them. # Install differs for each of them.
removeInetdServiceEntry() { removeInetdServiceEntry() {
if [ -d /etc/xinetd.d ] if [ "$OS_Has_Specific_Classic_Startup" ]
then
osStopClassicServer
osUnregisterClassicServer
return
fi
if [ -d /etc/xinetd.d ]
then then
removeXinetdEntry removeXinetdEntry
elif [ -f /etc/inetd.conf ] elif [ -f /etc/inetd.conf ]
@ -311,35 +343,6 @@ getNewDBAPasswordFromUser()
} }
#------------------------------------------------------------------------
# Modify DBA password to value, asked from user.
# $1 may be set to original DBA password
# !! This routine is interactive !!
askUserForNewDBAPassword() {
if [ -z $1 ]
then
askForOrigDBAPassword
else
OrigPasswd=$1
fi
NewPasswd=""
while [ -z "$NewPasswd" ]
do
getNewDBAPasswordFromUser
if [ ! -z "$NewPasswd" ]
then
if ! runSilent "@FB_BINDIR@/gsec -user sysdba -password $OrigPasswd -modify sysdba -pw $NewPasswd"
then
NewPasswd=""
fi
fi
done
}
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# add a line in the (usually) /etc/services or /etc/inetd.conf file # add a line in the (usually) /etc/services or /etc/inetd.conf file
# Here there are three cases, not found => add # Here there are three cases, not found => add
@ -403,39 +406,24 @@ removeLineFromFile() {
writeNewPassword() { writeNewPassword() {
NewPasswd=$1 NewPasswd=$1
DBAPasswordFile=@FB_CONFDIR@/SYSDBA.password DBAPasswordFile=@FB_CONFDIR@/SYSDBA.password
FB_HOST=`hostname`
FB_TIME=`date`
cat <<EOT >$DBAPasswordFile cat <<EOT >$DBAPasswordFile
#
# Firebird generated password for user SYSDBA is: # Firebird generated password for user SYSDBA is:
#
ISC_USER=sysdba ISC_USER=sysdba
ISC_PASSWD=$NewPasswd ISC_PASSWD=$NewPasswd
#
EOT # generated on $FB_HOST at time $FB_TIME
#
if [ $NewPasswd = "masterkey" ]
then
echo "# for install on `hostname` at time `date`" >> $DBAPasswordFile
echo "# You should change this password at the earliest oportunity" >> $DBAPasswordFile
else
echo "# generated on `hostname` at time `date`" >> $DBAPasswordFile
fi
cat <<EOT >>$DBAPasswordFile
# Your password can be changed to a more suitable one using the # Your password can be changed to a more suitable one using the
# @FB_BINDIR@/gsec utility. # @FB_BINDIR@/gsec utility.
#
EOT EOT
chmod u=r,go= $DBAPasswordFile chmod u=r,go= $DBAPasswordFile
# Only if we have changed the password from the default do we need
# to update the entry in the database
if [ $NewPasswd != "masterkey" ]
then
runSilent "@FB_BINDIR@/gsec -user sysdba -password masterkey -modify sysdba -pw $NewPasswd"
fi
} }
@ -443,21 +431,45 @@ EOT
# Set sysdba password. # Set sysdba password.
setDBAPassword() { setDBAPassword() {
if [ -z "$InteractiveInstall" ] writePassword=
then
passwd=`createNewPassword`
else
NewPasswd=""
getNewDBAPasswordFromUser
passwd=$NewPasswd
fi
if [ -z "$passwd" ] if [ -z "$InteractiveInstall" ]
then then
passwd=masterkey passwd=`createNewPassword`
fi writePassword=yes
else
NewPasswd=""
getNewDBAPasswordFromUser
passwd=$NewPasswd
if [ -z "$passwd" ]
then
echo " "
echo "Press enter once more if you need random password"
echo "or enter non-empty password."
echo " "
getNewDBAPasswordFromUser
passwd=$NewPasswd
if [ -z "$passwd" ]
then
passwd=`createNewPassword`
writePassword=yes
fi
fi
fi
if [ -z "$passwd" ]
then
passwd=masterkey
fi
runSilent "@FB_BINDIR@/gsec -add sysdba -pw $passwd" runSilent "@FB_BINDIR@/gsec -add sysdba -pw $passwd"
if [ "$writePassword" ]
then
writeNewPassword $passwd
fi
} }
@ -764,9 +776,9 @@ removeEmptyDirs() {
@FB_HELPDIR@ @FB_INTLDIR@ @FB_MISCDIR@ @FB_SECDBDIR@ @FB_MSGDIR@ @FB_LOGDIR@ @FB_GUARDDIR@ @FB_PLUGDIR@ \ @FB_HELPDIR@ @FB_INTLDIR@ @FB_MISCDIR@ @FB_SECDBDIR@ @FB_MSGDIR@ @FB_LOGDIR@ @FB_GUARDDIR@ @FB_PLUGDIR@ \
@FB_CONFDIR@; do @FB_CONFDIR@; do
if [ -d $rootDir ]; then if [ -d $rootDir ]; then
for i in `find $rootDir -type d -print`; do for i in `find $rootDir -type d -print`; do
ls $i/* >/dev/null 2>&1 ls $i/* >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
rmdir $i && dirContentChanged=$i rmdir $i && dirContentChanged=$i
fi fi
@ -878,6 +890,13 @@ updateXinetdEntry() {
updateInetdServiceEntry() { updateInetdServiceEntry() {
if ! standaloneServerInstalled if ! standaloneServerInstalled
then then
if [ "$OS_Has_Specific_Classic_Startup" ]
then
osRegisterClassicServer
osStartClassicServer
return
fi
if [ -d /etc/xinetd.d ] if [ -d /etc/xinetd.d ]
then then
updateXinetdEntry updateXinetdEntry

View File

@ -55,14 +55,8 @@ createLinksInSystemLib
# Create libgds.so links # Create libgds.so links
createLinksForBackCompatibility createLinksForBackCompatibility
#Update the /etc/inetd.conf or xinetd entry
#updateInetdServiceEntry
# Add sysdba and set password (use embedded access) # Add sysdba and set password (use embedded access)
setDBAPassword setDBAPassword
# Get inetd to reread new init files.
#resetInetdServer
# start the RDBMS server # start the RDBMS server
startService startService

View File

@ -25,12 +25,12 @@
# The post uninstall routine for Firebird Server. # The post uninstall routine for Firebird Server.
if [ "$1"=0 ] if [ "$1"=0 ]
then then
removeLinksForBackCompatibility removeLinksForBackCompatibility
removeServiceAutostart removeServiceAutostart
removeInetdServiceEntry removeInetdServiceEntry
fi fi
if [ -d $PidDir ] if [ -d $PidDir ]
then then

View File

@ -26,12 +26,12 @@
checkIfServerRunning checkIfServerRunning
if [ -f @FB_SECDBDIR@/$SecurityDatabase ]; then if [ -f @FB_SECDBDIR@/$SecurityDatabase ]; then
cp @FB_SECDBDIR@/$SecurityDatabase /tmp cp @FB_SECDBDIR@/$SecurityDatabase /tmp
echo "Saved a copy of SecurityDatabase ($SecurityDatabase) in /tmp" echo "Saved a copy of SecurityDatabase ($SecurityDatabase) in /tmp"
chown root:root /tmp/$SecurityDatabase chown root:root /tmp/$SecurityDatabase
chmod 0600 /tmp/$SecurityDatabase chmod 0600 /tmp/$SecurityDatabase
fi fi
for i in @FB_GUARDDIR@/fb_guard @FB_LOGDIR@/firebird.log @FB_CONFDIR@/SYSDBA.password; do for i in @FB_GUARDDIR@/fb_guard @FB_LOGDIR@/firebird.log @FB_CONFDIR@/SYSDBA.password; do
if [ -f $i ]; then if [ -f $i ]; then

View File

@ -29,29 +29,29 @@
# Created by: Mark O'Donohue <mark.odonohue@firebirdsql.org> # Created by: Mark O'Donohue <mark.odonohue@firebirdsql.org>
# #
# Contributor(s): # Contributor(s):
# # Alex Peshkoff
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# appendAliasEntry # appendDatabaseEntry
# check to see if an entry already exists in the databases.conf file # check to see if an entry already exists in the databases.conf file
# if it doesn't append it to the end of the file # if it doesn't append it to the end of the file
appendAliasEntry() { appendDatabaseEntry() {
aliasName=$1 aliasName=$1
newDB=$2 newDB=$2
# check if aliasName already exists # check if aliasName already exists
oldLine=`grep "^$aliasName" $AliasFile` oldLine=`grep "^$aliasName" $DatabaseFile`
if [ -z "$oldLine" ] if [ -z "$oldLine" ]
then then
# Create the alias file entry # Create the alias file entry
echo "$aliasName = $newDB" >> $AliasFile echo "$aliasName = $newDB" >> $DatabaseFile
else else
cat <<EOF cat <<EOF
The alias name $aliasName already exists in $AliasFile with value: The alias name $aliasName already exists in $DatabaseFile with value:
$oldLine $oldLine
A new entry will not be created and the existing one will be used. A new entry will not be created and the existing one will be used.
@ -114,27 +114,26 @@ checkAccessToFile() {
if [ $# -ne 2 ] if [ $# -ne 2 ]
then then
echo "Usage is createAliasDB.sh <name> <newDB>" echo "Usage is registerDatabase.sh <alias> <database>"
exit exit
fi fi
aliasName=$1 aliasName=$1
newDB=$2 newDB=$2
AliasFile=@FB_CONFDIR@/databases.conf DatabaseFile=@FB_CONFDIR@/databases.conf
checkNameStartsWithSlash $newDB checkNameStartsWithSlash $newDB
appendAliasEntry $aliasName $newDB appendDatabaseEntry $aliasName $newDB
# checkAccessToFile $newDB # checkAccessToFile $newDB
if [ ! -f $newDB ] if [ ! -f $newDB ]
then then
#source @FB_CONFDIR@/SYSDBA.password
@FB_BINDIR@/isql <<EOF @FB_BINDIR@/isql <<EOF
create database 'localhost:$aliasName'; create database '$aliasName';
quit; quit;
EOF EOF
fi fi
chown firebird:firebird $newDB

View File

@ -26,3 +26,8 @@
removeInstalledFiles # Remove installed files removeInstalledFiles # Remove installed files
removeUninstallFiles # Remove the 'uninstall' utility files removeUninstallFiles # Remove the 'uninstall' utility files
removeEmptyDirs # Remove empty directories removeEmptyDirs # Remove empty directories
if [ "$OS_Has_Specific_Classic_Startup" ]
then
osRemoveStartupFiles
fi

View File

@ -1126,21 +1126,18 @@ AC_CONFIG_FILES([gen/make.crossPlatform:builds/posix/make.$CROSS])
fi fi
AC_CONFIG_FILES([ AC_CONFIG_FILES([
gen/Release/firebird/bin/fb_config:builds/install/misc/fb_config.in gen/Release/firebird/bin/fb_config:builds/install/posix-common/fb_config.in
gen/Release/firebird/bin/posixLibrary.sh:builds/install/misc/posixLibrary.sh.in gen/Release/firebird/bin/posixLibrary.sh:builds/install/posix-common/posixLibrary.sh.in
gen/Release/firebird/bin/changeRunUser.sh:builds/install/misc/changeRunUser.sh.in gen/Release/firebird/bin/tarMainInstall.sh:builds/install/posix-common/tarMainInstall.sh.in
gen/Release/firebird/bin/restoreRootRunUser.sh:builds/install/misc/restoreRootRunUser.sh.in gen/Release/firebird/bin/tarinstall.sh:builds/install/posix-common/tarinstall.sh.in
gen/Release/firebird/bin/tarMainInstall.sh:builds/install/arch-specific/linux/misc/tarMainInstall.sh.in gen/Release/firebird/bin/preinstall.sh:builds/install/posix-common/preinstall.sh.in
gen/Release/firebird/bin/tarinstall.sh:builds/install/arch-specific/linux/misc/tarinstall.sh.in gen/Release/firebird/bin/postinstall.sh:builds/install/posix-common/postinstall.sh.in
gen/Release/firebird/bin/preinstall.sh:builds/install/arch-specific/linux/misc/preinstall.sh.in gen/Release/firebird/bin/preuninstall.sh:builds/install/posix-common/preuninstall.sh.in
gen/Release/firebird/bin/postinstall.sh:builds/install/arch-specific/linux/misc/postinstall.sh.in gen/Release/firebird/bin/postuninstall.sh:builds/install/posix-common/postuninstall.sh.in
gen/Release/firebird/bin/preuninstall.sh:builds/install/arch-specific/linux/misc/preuninstall.sh.in gen/Release/firebird/bin/taruninstall.sh:builds/install/posix-common/taruninstall.sh.in
gen/Release/firebird/bin/postuninstall.sh:builds/install/arch-specific/linux/misc/postuninstall.sh.in gen/Release/firebird/bin/tarMainUninstall.sh:builds/install/posix-common/tarMainUninstall.sh.in
gen/Release/firebird/bin/taruninstall.sh:builds/install/arch-specific/linux/misc/taruninstall.sh.in gen/Release/firebird/bin/changeServerMode.sh:builds/install/posix-common/changeServerMode.sh.in
gen/Release/firebird/bin/tarMainUninstall.sh:builds/install/arch-specific/linux/misc/tarMainUninstall.sh.in gen/Release/firebird/bin/registerDatabase.sh:builds/install/posix-common/registerDatabase.sh.in
gen/Release/firebird/bin/changeDBAPassword.sh:builds/install/misc/changeDBAPassword.sh.in
gen/Release/firebird/bin/changeServerMode.sh:builds/install/misc/changeServerMode.sh.in
gen/Release/firebird/bin/createAliasDB.sh:builds/install/misc/createAliasDB.sh.in
gen/vers.sh:builds/posix/vers.sh.in gen/vers.sh:builds/posix/vers.sh.in
]) ])
@ -1154,16 +1151,19 @@ case "$PLATFORM" in
INSTALL_SRC_DIR=builds/install/arch-specific/linux INSTALL_SRC_DIR=builds/install/arch-specific/linux
AC_CONFIG_FILES([ AC_CONFIG_FILES([
gen/install/makeInstallImage.sh:builds/install/arch-specific/linux/misc/makeInstallImage.sh.in gen/install/makeInstallImage.sh:builds/install/arch-specific/linux/makeInstallImage.sh.in
gen/install/misc/firebird.xinetd:builds/install/arch-specific/linux/misc/firebird.xinetd.in gen/install/misc/firebird.xinetd:builds/install/arch-specific/linux/firebird.xinetd.in
gen/install/misc/firebird.init.d.generic:builds/install/arch-specific/linux/misc/firebird.init.d.generic.in gen/install/misc/firebird.init.d.generic:builds/install/arch-specific/linux/firebird.init.d.generic.in
gen/install/misc/firebird.init.d.mandrake:builds/install/arch-specific/linux/misc/firebird.init.d.mandrake.in gen/install/misc/firebird.init.d.mandrake:builds/install/arch-specific/linux/firebird.init.d.mandrake.in
gen/install/misc/firebird.init.d.suse:builds/install/arch-specific/linux/misc/firebird.init.d.suse.in gen/install/misc/firebird.init.d.suse:builds/install/arch-specific/linux/firebird.init.d.suse.in
gen/install/misc/firebird.init.d.debian:builds/install/arch-specific/linux/misc/firebird.init.d.debian.in gen/install/misc/firebird.init.d.debian:builds/install/arch-specific/linux/firebird.init.d.debian.in
gen/install/misc/firebird.init.d.gentoo:builds/install/arch-specific/linux/misc/firebird.init.d.gentoo.in gen/install/misc/firebird.init.d.gentoo:builds/install/arch-specific/linux/firebird.init.d.gentoo.in
gen/install/misc/firebird.init.d.slackware:builds/install/arch-specific/linux/misc/firebird.init.d.slackware.in gen/install/misc/firebird.init.d.slackware:builds/install/arch-specific/linux/firebird.init.d.slackware.in
gen/install/misc/rc.config.firebird:builds/install/arch-specific/linux/misc/rc.config.firebird.in gen/install/misc/rc.config.firebird:builds/install/arch-specific/linux/rc.config.firebird.in
gen/Release/firebird/bin/linuxLibrary.sh:builds/install/arch-specific/linux/misc/linuxLibrary.sh.in gen/Release/firebird/bin/linuxLibrary.sh:builds/install/arch-specific/linux/linuxLibrary.sh.in
gen/install/misc/firebird-classic@.service:builds/install/arch-specific/linux/firebird-classic.service.in
gen/install/misc/firebird-classic.socket:builds/install/arch-specific/linux/firebird-classic.socket.in
gen/install/misc/firebird-superserver.service:builds/install/arch-specific/linux/firebird-superserver.service.in
], ],
[chmod a+x gen/install/scripts/*.sh gen/install/*sh 2>/dev/null]) [chmod a+x gen/install/scripts/*.sh gen/install/*sh 2>/dev/null])
;; ;;