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

Implemented CORE-5238: Replace xinetd support with the native listener

This commit is contained in:
Alex Peshkoff 2017-08-04 18:07:10 +03:00
parent ca24b62555
commit e131cb3eda
12 changed files with 20 additions and 232 deletions

View File

@ -1,10 +0,0 @@
[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

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

View File

@ -2,7 +2,7 @@
#
# /etc/rc.d/rc.firebirdss
#
# Start/stop/restart the firebird super server.
# Start/stop/restart the firebird server.
#
fb_install_prefix=@prefix@

View File

@ -9,7 +9,7 @@
#
# /usr/sbin/rcfirebird
#
# System startup script for the Firebird SuperServer
# System startup script for the Firebird Server
#
### BEGIN INIT INFO
# Provides: firebird

View File

@ -1,7 +1,6 @@
[Unit]
Description=Firebird Database Server ( SuperServer )
Description=Firebird Database Server
After=syslog.target network.target
Conflicts=firebird-classic.socket
[Service]
User=firebird

View File

@ -1,17 +0,0 @@
# default: on
# description: FirebirdSQL server
#
service @FB_SERVICE_NAME@
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
# These lines cause problems with Windows XP SP2 clients
# using default firewall configuration (SF#1065511)
# log_on_success += USERID
# log_on_failure += USERID
server = @FB_SBINDIR@/firebird
}

View File

@ -111,8 +111,7 @@ getInitScriptLocation() {
# register/start/stop server using systemd
SYSTEMCTL=systemctl
CLASSIC_CTRL=${fb_startup_name}-classic.socket
SUPER_CTRL=${fb_startup_name}-superserver.service
CTRL=${fb_startup_name}.service
SYSTEMD_DIR=/usr/lib/systemd/system
[ -d $SYSTEMD_DIR ] || SYSTEMD_DIR=/lib/systemd/system
TMPFILE_CONF=/usr/lib/tmpfiles.d/firebird.conf
@ -140,13 +139,9 @@ installSystemdCtrlFiles() {
exit 1
fi
editFile "@FB_MISCDIR@/firebird-superserver.service" ExecStart "ExecStart=${fb_install_prefix}/bin/fbguard -pidfile $PidDir/${fb_startup_name}.pid -daemon -forever"
editFile "@FB_MISCDIR@/firebird-superserver.service" PIDFile "PIDFile=$PidDir/${fb_startup_name}.pid"
editFile "@FB_MISCDIR@/firebird-classic@.service" ExecStart "ExecStart=${fb_install_prefix}/bin/firebird"
cp @FB_MISCDIR@/firebird-superserver.service "${SYSTEMD_DIR}/${fb_startup_name}-superserver.service"
cp @FB_MISCDIR@/firebird-classic@.service "${SYSTEMD_DIR}/${fb_startup_name}-classic@.service"
cp @FB_MISCDIR@/firebird-classic.socket "${SYSTEMD_DIR}/${fb_startup_name}-classic.socket"
editFile "@FB_MISCDIR@/firebird.service" ExecStart "ExecStart=${fb_install_prefix}/bin/fbguard -pidfile $PidDir/${fb_startup_name}.pid -daemon -forever"
editFile "@FB_MISCDIR@/firebird.service" PIDFile "PIDFile=$PidDir/${fb_startup_name}.pid"
cp @FB_MISCDIR@/firebird.service "${SYSTEMD_DIR}/${fb_startup_name}.service"
mkdir -p ${PidDir}
chown $RunUser:$RunGroup ${PidDir}
@ -156,7 +151,7 @@ installSystemdCtrlFiles() {
}
osRemoveStartupFiles() {
rm -f ${SYSTEMD_DIR}/${fb_startup_name}-*
rm -f ${SYSTEMD_DIR}/${fb_startup_name}.*
rm -f ${TMPFILE_CONF}
}
@ -180,33 +175,10 @@ systemdSrv() {
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
systemdSrv ${op} ${CTRL}
}
registerSuperServer() {
@ -236,9 +208,6 @@ stopSuperServer() {
}
# Additional OS settings
systemdPresent && OS_Has_Specific_Classic_Startup=yes
#------------------------------------------------------------------------
# stop super server if it is running
@ -493,7 +462,7 @@ removeServiceAutostart() {
standaloneServerInstalled() {
if systemdPresent; then
${SYSTEMCTL} --quiet is-enabled ${SUPER_CTRL} && return 0
${SYSTEMCTL} --quiet is-enabled ${CTRL} && return 0
return 1
fi

View File

@ -285,10 +285,9 @@ copyFiles() {
#misc
cp $BuildRootDir/src/misc/intl.sql ${TargetDir}@FB_MISCDIR@
cp $BuildRootDir/src/misc/upgrade/v3.0/security_database* ${TargetDir}@FB_MISCDIR@/upgrade/security
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/rc.config.firebird ${TargetDir}@FB_MISCDIR@
cp $BuildRootDir/gen/install/misc/firebird-* ${TargetDir}@FB_MISCDIR@
cp $BuildRootDir/gen/install/misc/firebird.service ${TargetDir}@FB_MISCDIR@
chmod -R go-rwx ${TargetDir}@FB_MISCDIR@

View File

@ -69,7 +69,6 @@ done
removeLinksForBackCompatibility
removeServiceAutostart
removeInetdServiceEntry
if [ -d $PidDir ]
then
@ -82,9 +81,4 @@ removeInstalledFiles # Remove installed files
removeUninstallFiles # Remove the 'uninstall' utility files
removeEmptyDirs # Remove empty directories
if [ "$OS_Has_Specific_Classic_Startup" ]
then
osRemoveStartupFiles
fi
displayMessage "Uninstall completed"

View File

@ -27,6 +27,11 @@ cat <<EOF
Firebird server may run in 2 different modes - super and classic.
Super server provides better performance, classic - better availability.
*******************************************************
* This script is deprecated and will be removed soon: *
* edit firebird.conf directly instead. *
*******************************************************
EOF
AskQuestion "Which option would you like to choose: (super|classic) [super] " "super"
@ -51,8 +56,6 @@ esac
echo "Stopping currently running engine..."
checkIfServerRunning
removeInetdServiceEntry
removeServiceAutostart
sc=Starting
[ ${fb_install_prefix} = ${default_prefix} ] || sc=Configure
@ -60,13 +63,10 @@ echo "$sc firebird in $multiAnswer server mode..."
fbconf="@FB_CONFDIR@/firebird.conf"
if [ $multiAnswer = classic ]; then
replaceLineInFile $fbconf "ServerMode = Classic" "^ServerMode"
updateInetdServiceEntry
else
replaceLineInFile $fbconf "ServerMode = Super" "^ServerMode"
installInitdScript
fi
startFirebird
echo "Done."

View File

@ -226,64 +226,6 @@ checkLibraries() {
}
#------------------------------------------------------------------------
# resetInetdServer
# Works for both inetd and xinetd
resetInetdServer() {
pid=`grepProcess "inetd|xinetd" | awk '{print $2}'`
if [ "$pid" ]
then
kill -HUP $pid
fi
}
#------------------------------------------------------------------------
# remove the xinetd config file(s)
removeXinetdEntry() {
file="${XINETD}${fb_startup_name}"
[ -f $file ] && rm -f $file
}
#------------------------------------------------------------------------
# remove the line from inetd file
removeInetdEntry() {
FileName=/etc/inetd.conf
oldLine=`grep "^@FB_SERVICE_NAME@" $FileName`
removeLineFromFile "$FileName" "$oldLine"
}
#------------------------------------------------------------------------
# Remove (x)inetd service entry and restart the service.
# Check to see if we have xinetd installed or plain inetd.
# Install differs for each of them.
removeInetdServiceEntry() {
if [ "$OS_Has_Specific_Classic_Startup" ]
then
osStopClassicServer
osUnregisterClassicServer
return
fi
if [ -d /etc/xinetd.d ]
then
removeXinetdEntry
elif [ -f /etc/inetd.conf ]
then
removeInetdEntry
fi
# make [x]inetd reload configuration
resetInetdServer
}
#------------------------------------------------------------------------
# grep process by name
@ -359,12 +301,6 @@ checkIfServerRunning() {
echo "Please quit all Firebird applications and then proceed."
exit 1
fi
# have to be root to modify (x)inetd
if [ "$1" != "install-embedded" ]
then
removeInetdServiceEntry
fi
}
@ -1006,64 +942,6 @@ fixFilePermissions() {
}
#------------------------------------------------------------------------
# Update inetd service entry
# This just adds/replaces the service entry line
updateInetdEntry() {
newLine="@FB_SERVICE_NAME@ stream tcp nowait.30000 $RunUser @FB_SBINDIR@/firebird firebird # Firebird Database Remote Server"
replaceLineInFile /etc/inetd.conf "$newLine" "^@FB_SERVICE_NAME@"
}
#------------------------------------------------------------------------
# Update xinetd service entry
updateXinetdEntry() {
InitFile="${XINETD}${fb_startup_name}"
cp @FB_MISCDIR@/firebird.xinetd $InitFile
if [ -f $InitFile ]
then
editFile $InitFile user "\tuser\t\t\t= $RunUser"
editFile $InitFile server "\tserver\t\t= ${fb_install_prefix}/bin/firebird"
yesno=yes
[ ${fb_install_prefix} = ${default_prefix} ] && yesno=no
editFile $InitFile disable "\tdisable\t\t= ${yesno}"
fi
}
#------------------------------------------------------------------------
# Update inetd service entry
# Check to see if we have xinetd installed or plain inetd.
# Install differs for each of them.
updateInetdServiceEntry() {
if ! standaloneServerInstalled
then
if [ "$OS_Has_Specific_Classic_Startup" ]
then
osRegisterClassicServer
return
fi
if [ -d /etc/xinetd.d ]
then
updateXinetdEntry
else
if [ ${fb_install_prefix} = ${default_prefix} ]
then
updateInetdEntry
else
echo "Install of classic server in non-default path is not supported with inetd - xinetd needed"
exit 1
fi
fi
fi
}
fbUsage() {
pf=""
if [ "@CHANGE_PATH_SUPPORT@" = "yes" ]
@ -1172,21 +1050,11 @@ extractBuildroot() {
#---------------------------------------------------------------------------
# depending upon presence of startup script starts super or classic server
# starts firebird server
startFirebird() {
if [ "${fb_install_prefix}" = "${default_prefix}" ]
then
if standaloneServerInstalled; then
startService
else
if [ "$OS_Has_Specific_Classic_Startup" ]
then
osStartClassicServer
return
fi
resetInetdServer
fi
startService
fi
}

View File

@ -1264,7 +1264,6 @@ case "$PLATFORM" in
INSTALL_SRC_DIR=builds/install/arch-specific/linux
AC_CONFIG_FILES([
gen/install/makeInstallImage.sh:builds/install/arch-specific/linux/makeInstallImage.sh.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/firebird.init.d.generic.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/firebird.init.d.suse.in
@ -1273,9 +1272,7 @@ case "$PLATFORM" 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/rc.config.firebird.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
gen/install/misc/firebird.service:builds/install/arch-specific/linux/firebird.service.in
],
[chmod a+x gen/install/*sh 2>/dev/null])
;;