mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 16:03:03 +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:
parent
7c243418a9
commit
957b696b5c
@ -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
|
@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Firebird Classic Activation Socket
|
||||
Conflicts=firebird-superserver.service
|
||||
|
||||
[Socket]
|
||||
ListenStream=3050
|
||||
Accept=true
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
@ -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
|
@ -32,7 +32,7 @@ makeFbDir $lockDir 0770
|
||||
|
||||
pidfile="$runDir/$INSTANCE.pid"
|
||||
FULLNAME="Firebird server [$INSTANCE]"
|
||||
LD_LIBRARY_PATH=$FIREBIRD/lib
|
||||
LD_LIBRARY_PATH=$FIREBIRD/lib:$LD_LIBRARY_PATH
|
||||
|
||||
export FIREBIRD LD_LIBRARY_PATH
|
||||
|
@ -36,7 +36,7 @@ makeFbDir $lockDir 0770
|
||||
|
||||
pidfile="$runDir/$INSTANCE.pid"
|
||||
FULLNAME="firebird server [$INSTANCE]"
|
||||
LD_LIBRARY_PATH=$FIREBIRD/lib
|
||||
LD_LIBRARY_PATH=$FIREBIRD/lib:$LD_LIBRARY_PATH
|
||||
FB_OPTS="-pidfile $pidfile -daemon -forever"
|
||||
|
||||
export FIREBIRD LD_LIBRARY_PATH
|
@ -52,7 +52,7 @@ makeFbDir $lockDir 0770
|
||||
|
||||
pidfile="$runDir/$INSTANCE.pid"
|
||||
FULLNAME="Firebird server [$INSTANCE]"
|
||||
LD_LIBRARY_PATH=$FIREBIRD/lib
|
||||
LD_LIBRARY_PATH=$FIREBIRD/lib:$LD_LIBRARY_PATH
|
||||
|
||||
export FIREBIRD LD_LIBRARY_PATH
|
||||
|
@ -36,7 +36,7 @@ makeFbDir $lockDir 0770
|
||||
|
||||
pidfile="$runDir/$INSTANCE.pid"
|
||||
FULLNAME="Firebird server [$INSTANCE]"
|
||||
LD_LIBRARY_PATH=$FIREBIRD/lib
|
||||
LD_LIBRARY_PATH=$FIREBIRD/lib:$LD_LIBRARY_PATH
|
||||
|
||||
export FIREBIRD LD_LIBRARY_PATH
|
||||
|
@ -29,6 +29,9 @@ export RunGroup
|
||||
PidDir=/var/run/firebird
|
||||
export PidDir
|
||||
|
||||
# Additional OS settings
|
||||
OS_Has_Specific_Classic_Startup=yes
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Get correct options & misc.
|
||||
|
||||
@ -73,18 +76,18 @@ TryAddUser() {
|
||||
|
||||
addFirebirdUser() {
|
||||
|
||||
TryAddGroup "-g 84 -r" >/dev/null 2>&1
|
||||
TryAddGroup "-g 84" >/dev/null 2>&1
|
||||
TryAddGroup "-r" >/dev/null 2>&1
|
||||
TryAddGroup "-g 84 -r" >/dev/null 2>/dev/null
|
||||
TryAddGroup "-g 84" >/dev/null 2>/dev/null
|
||||
TryAddGroup "-r" >/dev/null 2>/dev/null
|
||||
TryAddGroup " "
|
||||
|
||||
TryAddUser "-u 84 -r -M" >/dev/null 2>&1
|
||||
TryAddUser "-u 84 -M" >/dev/null 2>&1
|
||||
TryAddUser "-r -M" >/dev/null 2>&1
|
||||
TryAddUser "-M" >/dev/null 2>&1
|
||||
TryAddUser "-u 84 -r" >/dev/null 2>&1
|
||||
TryAddUser "-u 84" >/dev/null 2>&1
|
||||
TryAddUser "-r" >/dev/null 2>&1
|
||||
|
||||
TryAddUser "-u 84 -r -M" >/dev/null 2>/dev/null
|
||||
TryAddUser "-u 84 -M" >/dev/null 2>/dev/null
|
||||
TryAddUser "-r -M" >/dev/null 2>/dev/null
|
||||
TryAddUser "-M" >/dev/null 2>/dev/null
|
||||
TryAddUser "-u 84 -r" >/dev/null 2>/dev/null
|
||||
TryAddUser "-u 84" >/dev/null 2>/dev/null
|
||||
TryAddUser "-r" >/dev/null 2>/dev/null
|
||||
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
|
||||
|
||||
@ -157,23 +274,18 @@ stopSuperServerIfRunning() {
|
||||
|
||||
if [ ! -z "$checkString" ]
|
||||
then
|
||||
init_d=`getInitScriptLocation`
|
||||
|
||||
if [ -x "$init_d" ]
|
||||
then
|
||||
i=1
|
||||
while [ $i -le 20 ]
|
||||
do
|
||||
$init_d stop
|
||||
sleep 1
|
||||
checkString=`grepProcess "fbserver|fbguard|fb_smp_server|firebird"`
|
||||
if [ -z "$checkString" ]
|
||||
then
|
||||
return
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
fi
|
||||
i=1
|
||||
while [ $i -le 20 ]
|
||||
do
|
||||
stopSuperServer || return # silently giveup
|
||||
sleep 1
|
||||
checkString=`grepProcess "fbserver|fbguard|fb_smp_server|firebird"`
|
||||
if [ -z "$checkString" ]
|
||||
then
|
||||
return
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
@ -183,7 +295,7 @@ stopSuperServerIfRunning() {
|
||||
|
||||
createNewPassword() {
|
||||
# openssl generates random data.
|
||||
openssl </dev/null >/dev/null 2&>/dev/null
|
||||
openssl </dev/null >/dev/null 2>/dev/null
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
# We generate 40 random chars, strip any '/''s and get the first 20
|
||||
@ -206,30 +318,6 @@ createNewPassword() {
|
||||
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
|
||||
# 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
|
||||
|
||||
installInitdScript() {
|
||||
# systemd case
|
||||
registerSuperServer && return 0 # systemd's service file takes care about PidDir
|
||||
|
||||
srcScript=""
|
||||
initScript=
|
||||
|
||||
@ -359,6 +450,9 @@ EOF
|
||||
# start init.d service
|
||||
|
||||
startService() {
|
||||
# systemd case
|
||||
startSuperServer && return 0
|
||||
|
||||
InitFile=`getInitScriptLocation`
|
||||
if [ -f "$InitFile" ]; then
|
||||
"$InitFile" start
|
||||
@ -385,7 +479,10 @@ startService() {
|
||||
# If we have right systems remove the service autostart stuff.
|
||||
|
||||
removeServiceAutostart() {
|
||||
if standaloneServerInstalled; then
|
||||
if standaloneServerInstalled
|
||||
then
|
||||
# systemd case
|
||||
unregisterSuperServer && return 0
|
||||
|
||||
# Unregister using OS command
|
||||
if [ -x /sbin/insserv ]; then
|
||||
@ -416,6 +513,11 @@ removeServiceAutostart() {
|
||||
# Returns TRUE if SA server is installed
|
||||
|
||||
standaloneServerInstalled() {
|
||||
if systemdPresent; then
|
||||
${SYSTEMCTL} --quiet is-enabled ${SUPER_CTRL} && return 0
|
||||
return 1
|
||||
fi
|
||||
|
||||
InitFile=`getInitScriptLocation`
|
||||
if [ -f "$InitFile" ]; then
|
||||
return 0
|
@ -167,11 +167,8 @@ copyFiles() {
|
||||
cp -f $BuiltFBDir/bin/fbguard ${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@
|
||||
cp $BuiltFBDir/bin/createAliasDB.sh ${TargetDir}@FB_SBINDIR@
|
||||
cp $BuiltFBDir/bin/registerDatabase.sh ${TargetDir}@FB_SBINDIR@
|
||||
cp $BuiltFBDir/bin/fb_config ${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.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@
|
||||
|
||||
chown -R root:root ${TargetDir}@FB_MISCDIR@
|
||||
chmod -R go-rwx ${TargetDir}@FB_MISCDIR@
|
@ -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
|
@ -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."
|
@ -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."
|
@ -27,8 +27,6 @@ cat <<EOF
|
||||
Firebird server may run in 2 different modes - super and classic.
|
||||
Super server provides better performance, classic - better availability.
|
||||
|
||||
*** Warning: runuser will be reset to firebird.
|
||||
|
||||
EOF
|
||||
|
||||
AskQuestion "Which option would you like to choose: (super|classic) [super] " "super"
|
@ -110,7 +110,8 @@ AskYNQuestion() {
|
||||
|
||||
runSilent() {
|
||||
MakeTemp
|
||||
$1 >$TmpFile 2>&1
|
||||
rm -f $TmpFile
|
||||
$1 >>$TmpFile 2>>$TmpFile
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
cat $TmpFile
|
||||
@ -150,6 +151,11 @@ checkInstallUser() {
|
||||
# Works for both inetd and xinetd
|
||||
|
||||
resetInetdServer() {
|
||||
if [ "$OS_Has_Specific_Classic_Startup" ]
|
||||
then
|
||||
return
|
||||
fi
|
||||
|
||||
pid=`grepProcess "inetd|xinetd" | awk '{print $2}'`
|
||||
if [ "$pid" ]
|
||||
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)
|
||||
# take into account possible pre-firebird xinetd services
|
||||
|
||||
removeXinetdEntry() {
|
||||
for i in `grep -l "service @FB_SERVICE_NAME@" /etc/xinetd.d/*`
|
||||
do
|
||||
rm -f $i
|
||||
done
|
||||
if hasFiles /etc/xinetd.d
|
||||
then
|
||||
for i in `grep -l "service @FB_SERVICE_NAME@" /etc/xinetd.d/*`
|
||||
do
|
||||
rm -f $i
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@ -186,7 +211,14 @@ removeInetdEntry() {
|
||||
# Install differs for each of them.
|
||||
|
||||
removeInetdServiceEntry() {
|
||||
if [ -d /etc/xinetd.d ]
|
||||
if [ "$OS_Has_Specific_Classic_Startup" ]
|
||||
then
|
||||
osStopClassicServer
|
||||
osUnregisterClassicServer
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -d /etc/xinetd.d ]
|
||||
then
|
||||
removeXinetdEntry
|
||||
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
|
||||
# Here there are three cases, not found => add
|
||||
@ -403,39 +406,24 @@ removeLineFromFile() {
|
||||
writeNewPassword() {
|
||||
NewPasswd=$1
|
||||
DBAPasswordFile=@FB_CONFDIR@/SYSDBA.password
|
||||
FB_HOST=`hostname`
|
||||
FB_TIME=`date`
|
||||
|
||||
cat <<EOT >$DBAPasswordFile
|
||||
#
|
||||
# Firebird generated password for user SYSDBA is:
|
||||
|
||||
#
|
||||
ISC_USER=sysdba
|
||||
ISC_PASSWD=$NewPasswd
|
||||
|
||||
EOT
|
||||
|
||||
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
|
||||
|
||||
#
|
||||
# generated on $FB_HOST at time $FB_TIME
|
||||
#
|
||||
# Your password can be changed to a more suitable one using the
|
||||
# @FB_BINDIR@/gsec utility.
|
||||
#
|
||||
EOT
|
||||
|
||||
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.
|
||||
|
||||
setDBAPassword() {
|
||||
if [ -z "$InteractiveInstall" ]
|
||||
then
|
||||
passwd=`createNewPassword`
|
||||
else
|
||||
NewPasswd=""
|
||||
getNewDBAPasswordFromUser
|
||||
passwd=$NewPasswd
|
||||
fi
|
||||
writePassword=
|
||||
|
||||
if [ -z "$passwd" ]
|
||||
then
|
||||
passwd=masterkey
|
||||
fi
|
||||
if [ -z "$InteractiveInstall" ]
|
||||
then
|
||||
passwd=`createNewPassword`
|
||||
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"
|
||||
|
||||
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_CONFDIR@; do
|
||||
|
||||
if [ -d $rootDir ]; then
|
||||
if [ -d $rootDir ]; then
|
||||
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
|
||||
rmdir $i && dirContentChanged=$i
|
||||
fi
|
||||
@ -878,6 +890,13 @@ updateXinetdEntry() {
|
||||
updateInetdServiceEntry() {
|
||||
if ! standaloneServerInstalled
|
||||
then
|
||||
if [ "$OS_Has_Specific_Classic_Startup" ]
|
||||
then
|
||||
osRegisterClassicServer
|
||||
osStartClassicServer
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -d /etc/xinetd.d ]
|
||||
then
|
||||
updateXinetdEntry
|
@ -55,14 +55,8 @@ createLinksInSystemLib
|
||||
# Create libgds.so links
|
||||
createLinksForBackCompatibility
|
||||
|
||||
#Update the /etc/inetd.conf or xinetd entry
|
||||
#updateInetdServiceEntry
|
||||
|
||||
# Add sysdba and set password (use embedded access)
|
||||
setDBAPassword
|
||||
|
||||
# Get inetd to reread new init files.
|
||||
#resetInetdServer
|
||||
|
||||
# start the RDBMS server
|
||||
startService
|
@ -25,12 +25,12 @@
|
||||
# The post uninstall routine for Firebird Server.
|
||||
|
||||
|
||||
if [ "$1"=0 ]
|
||||
then
|
||||
if [ "$1"=0 ]
|
||||
then
|
||||
removeLinksForBackCompatibility
|
||||
removeServiceAutostart
|
||||
removeInetdServiceEntry
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d $PidDir ]
|
||||
then
|
@ -26,12 +26,12 @@
|
||||
|
||||
checkIfServerRunning
|
||||
|
||||
if [ -f @FB_SECDBDIR@/$SecurityDatabase ]; then
|
||||
cp @FB_SECDBDIR@/$SecurityDatabase /tmp
|
||||
echo "Saved a copy of SecurityDatabase ($SecurityDatabase) in /tmp"
|
||||
if [ -f @FB_SECDBDIR@/$SecurityDatabase ]; then
|
||||
cp @FB_SECDBDIR@/$SecurityDatabase /tmp
|
||||
echo "Saved a copy of SecurityDatabase ($SecurityDatabase) in /tmp"
|
||||
chown root:root /tmp/$SecurityDatabase
|
||||
chmod 0600 /tmp/$SecurityDatabase
|
||||
fi
|
||||
fi
|
||||
|
||||
for i in @FB_GUARDDIR@/fb_guard @FB_LOGDIR@/firebird.log @FB_CONFDIR@/SYSDBA.password; do
|
||||
if [ -f $i ]; then
|
@ -29,29 +29,29 @@
|
||||
# Created by: Mark O'Donohue <mark.odonohue@firebirdsql.org>
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alex Peshkoff
|
||||
#
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# appendAliasEntry
|
||||
# appendDatabaseEntry
|
||||
# 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
|
||||
|
||||
appendAliasEntry() {
|
||||
appendDatabaseEntry() {
|
||||
aliasName=$1
|
||||
newDB=$2
|
||||
|
||||
# check if aliasName already exists
|
||||
oldLine=`grep "^$aliasName" $AliasFile`
|
||||
oldLine=`grep "^$aliasName" $DatabaseFile`
|
||||
if [ -z "$oldLine" ]
|
||||
then
|
||||
# Create the alias file entry
|
||||
echo "$aliasName = $newDB" >> $AliasFile
|
||||
echo "$aliasName = $newDB" >> $DatabaseFile
|
||||
else
|
||||
cat <<EOF
|
||||
The alias name $aliasName already exists in $AliasFile with value:
|
||||
The alias name $aliasName already exists in $DatabaseFile with value:
|
||||
$oldLine
|
||||
|
||||
A new entry will not be created and the existing one will be used.
|
||||
@ -114,27 +114,26 @@ checkAccessToFile() {
|
||||
|
||||
if [ $# -ne 2 ]
|
||||
then
|
||||
echo "Usage is createAliasDB.sh <name> <newDB>"
|
||||
echo "Usage is registerDatabase.sh <alias> <database>"
|
||||
exit
|
||||
fi
|
||||
|
||||
aliasName=$1
|
||||
newDB=$2
|
||||
|
||||
AliasFile=@FB_CONFDIR@/databases.conf
|
||||
DatabaseFile=@FB_CONFDIR@/databases.conf
|
||||
|
||||
checkNameStartsWithSlash $newDB
|
||||
appendAliasEntry $aliasName $newDB
|
||||
appendDatabaseEntry $aliasName $newDB
|
||||
|
||||
# checkAccessToFile $newDB
|
||||
|
||||
if [ ! -f $newDB ]
|
||||
then
|
||||
#source @FB_CONFDIR@/SYSDBA.password
|
||||
@FB_BINDIR@/isql <<EOF
|
||||
create database 'localhost:$aliasName';
|
||||
create database '$aliasName';
|
||||
quit;
|
||||
EOF
|
||||
fi
|
||||
|
||||
|
||||
chown firebird:firebird $newDB
|
@ -26,3 +26,8 @@
|
||||
removeInstalledFiles # Remove installed files
|
||||
removeUninstallFiles # Remove the 'uninstall' utility files
|
||||
removeEmptyDirs # Remove empty directories
|
||||
|
||||
if [ "$OS_Has_Specific_Classic_Startup" ]
|
||||
then
|
||||
osRemoveStartupFiles
|
||||
fi
|
50
configure.ac
50
configure.ac
@ -1126,21 +1126,18 @@ AC_CONFIG_FILES([gen/make.crossPlatform:builds/posix/make.$CROSS])
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
gen/Release/firebird/bin/fb_config:builds/install/misc/fb_config.in
|
||||
gen/Release/firebird/bin/posixLibrary.sh:builds/install/misc/posixLibrary.sh.in
|
||||
gen/Release/firebird/bin/changeRunUser.sh:builds/install/misc/changeRunUser.sh.in
|
||||
gen/Release/firebird/bin/restoreRootRunUser.sh:builds/install/misc/restoreRootRunUser.sh.in
|
||||
gen/Release/firebird/bin/tarMainInstall.sh:builds/install/arch-specific/linux/misc/tarMainInstall.sh.in
|
||||
gen/Release/firebird/bin/tarinstall.sh:builds/install/arch-specific/linux/misc/tarinstall.sh.in
|
||||
gen/Release/firebird/bin/preinstall.sh:builds/install/arch-specific/linux/misc/preinstall.sh.in
|
||||
gen/Release/firebird/bin/postinstall.sh:builds/install/arch-specific/linux/misc/postinstall.sh.in
|
||||
gen/Release/firebird/bin/preuninstall.sh:builds/install/arch-specific/linux/misc/preuninstall.sh.in
|
||||
gen/Release/firebird/bin/postuninstall.sh:builds/install/arch-specific/linux/misc/postuninstall.sh.in
|
||||
gen/Release/firebird/bin/taruninstall.sh:builds/install/arch-specific/linux/misc/taruninstall.sh.in
|
||||
gen/Release/firebird/bin/tarMainUninstall.sh:builds/install/arch-specific/linux/misc/tarMainUninstall.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/Release/firebird/bin/fb_config:builds/install/posix-common/fb_config.in
|
||||
gen/Release/firebird/bin/posixLibrary.sh:builds/install/posix-common/posixLibrary.sh.in
|
||||
gen/Release/firebird/bin/tarMainInstall.sh:builds/install/posix-common/tarMainInstall.sh.in
|
||||
gen/Release/firebird/bin/tarinstall.sh:builds/install/posix-common/tarinstall.sh.in
|
||||
gen/Release/firebird/bin/preinstall.sh:builds/install/posix-common/preinstall.sh.in
|
||||
gen/Release/firebird/bin/postinstall.sh:builds/install/posix-common/postinstall.sh.in
|
||||
gen/Release/firebird/bin/preuninstall.sh:builds/install/posix-common/preuninstall.sh.in
|
||||
gen/Release/firebird/bin/postuninstall.sh:builds/install/posix-common/postuninstall.sh.in
|
||||
gen/Release/firebird/bin/taruninstall.sh:builds/install/posix-common/taruninstall.sh.in
|
||||
gen/Release/firebird/bin/tarMainUninstall.sh:builds/install/posix-common/tarMainUninstall.sh.in
|
||||
gen/Release/firebird/bin/changeServerMode.sh:builds/install/posix-common/changeServerMode.sh.in
|
||||
gen/Release/firebird/bin/registerDatabase.sh:builds/install/posix-common/registerDatabase.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
|
||||
AC_CONFIG_FILES([
|
||||
gen/install/makeInstallImage.sh:builds/install/arch-specific/linux/misc/makeInstallImage.sh.in
|
||||
gen/install/misc/firebird.xinetd:builds/install/arch-specific/linux/misc/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.mandrake:builds/install/arch-specific/linux/misc/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.debian:builds/install/arch-specific/linux/misc/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.slackware:builds/install/arch-specific/linux/misc/firebird.init.d.slackware.in
|
||||
gen/install/misc/rc.config.firebird:builds/install/arch-specific/linux/misc/rc.config.firebird.in
|
||||
gen/Release/firebird/bin/linuxLibrary.sh:builds/install/arch-specific/linux/misc/linuxLibrary.sh.in
|
||||
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
|
||||
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/firebird.init.d.gentoo.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
|
||||
],
|
||||
[chmod a+x gen/install/scripts/*.sh gen/install/*sh 2>/dev/null])
|
||||
;;
|
||||
|
Loading…
Reference in New Issue
Block a user