mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 01:23:03 +01:00
128 lines
3.0 KiB
Bash
128 lines
3.0 KiB
Bash
#!/bin/sh
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
# 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
|
|
# running around to actually get it for each packager.
|
|
# Update rcX.d with Firebird initd entries
|
|
# initd script for SuSE >= 7.2 is a part of RPM package
|
|
|
|
installInitdScript() {
|
|
|
|
# This is for RH and MDK specific
|
|
|
|
if [ -e /etc/rc.d/init.d/functions ]
|
|
then
|
|
srcScript=firebird.init.d.mandrake
|
|
initScript=/etc/rc.d/init.d/firebird
|
|
|
|
# SuSE specific
|
|
|
|
elif [ -r /etc/SuSE-release ]
|
|
then
|
|
srcScript=firebird.init.d.suse
|
|
initScript=/etc/init.d/firebird
|
|
rm -f /usr/sbin/rcfirebird
|
|
ln -s ../../etc/init.d/firebird /usr/sbin/rcfirebird
|
|
|
|
# Debian specific
|
|
|
|
elif [ -r /etc/debian_version ]
|
|
then
|
|
srcScript=firebird.init.d.debian
|
|
initScript=/etc/init.d/firebird
|
|
rm -f /usr/sbin/rcfirebird
|
|
ln -s ../../etc/init.d/firebird /usr/sbin/rcfirebird
|
|
|
|
# Gentoo specific
|
|
|
|
elif [ -r /etc/gentoo-release ]
|
|
then
|
|
srcScript=firebird.init.d.gentoo
|
|
initScript=/etc/init.d/firebird
|
|
|
|
# Generic...
|
|
|
|
elif [ -d /etc/rc.d/init.d ]
|
|
then
|
|
srcScript=firebird.init.d.generic
|
|
initScript=/etc/rc.d/init.d/firebird
|
|
fi
|
|
|
|
|
|
|
|
# Install the firebird init.d script
|
|
cp $FBRootDir/misc/$srcScript $initScript
|
|
chown root:root $initScript
|
|
chmod ug=rx,o= $initScript # contains password hence no world read.
|
|
|
|
|
|
# RedHat and Mandrake specific
|
|
if [ -x /sbin/chkconfig ]
|
|
then
|
|
/sbin/chkconfig --add firebird
|
|
|
|
# Suse (& Debian ?) specific
|
|
elif [ -x /sbin/insserv ]
|
|
then
|
|
/sbin/insserv /etc/init.d/firebird
|
|
|
|
# One more way to register service - used in Knoppix (& Debian ?)
|
|
elif [ -x /usr/sbin/update-rc.d ]
|
|
then
|
|
/usr/sbin/update-rc.d firebird start 14 2 3 5 . stop 20 0 1 6 .
|
|
fi
|
|
|
|
# More SuSE - rc.config fillup
|
|
if [ -f /etc/rc.config ]
|
|
then
|
|
if [ -x /bin/fillup ]
|
|
then
|
|
/bin/fillup -q -d = /etc/rc.config $FBRootDir/misc/rc.config.firebird
|
|
fi
|
|
elif [ -d /etc/sysconfig ]
|
|
then
|
|
cp $FBRootDir/misc/rc.config.firebird /etc/sysconfig/firebird
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
# start init.d service
|
|
|
|
startService() {
|
|
InitFile=`getInitScriptLocation`
|
|
if [ -f $InitFile ]
|
|
then
|
|
$InitFile start
|
|
|
|
checkString=`ps -efww| grep fbserver |grep -v grep`
|
|
if [ -z "$checkString" ]
|
|
then
|
|
# server didn't start - possible reason bad shell /bin/false for user "firebird"
|
|
echo
|
|
echo Fixing firebird\'s shell to /bin/sh
|
|
echo
|
|
usermod -s /bin/sh firebird
|
|
$InitFile start
|
|
fi
|
|
fi
|
|
}
|