8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 20:43:04 +01:00
firebird-mirror/builds/install/arch-specific/linux/misc/linuxLibrary.sh.in

134 lines
2.6 KiB
Bash
Raw Normal View History

2005-04-29 20:24:44 +02:00
#!/bin/sh
2005-08-16 12:04:13 +02:00
RunUser=firebird
export RunUser
RunGroup=firebird
export RunGroup
PidDir=/var/run/firebird
export PidDir
2005-08-16 12:04:13 +02:00
2005-04-29 20:24:44 +02:00
#------------------------------------------------------------------------
# Add new user and group
TryAddGroup() {
AdditionalParameter=$1
testStr=`grep firebird /etc/group`
if [ -z "$testStr" ]
then
groupadd $AdditionalParameter firebird
fi
}
TryAddUser() {
AdditionalParameter=$1
2005-05-05 10:39:12 +02:00
testStr=`grep firebird /etc/passwd`
2005-04-29 20:24:44 +02:00
if [ -z "$testStr" ]
then
2006-06-19 15:04:59 +02:00
useradd $AdditionalParameter -d $FBRootDir -s /bin/false \
2005-04-29 20:24:44 +02:00
-c "Firebird Database Owner" -g firebird firebird
fi
}
addFirebirdUser() {
TryAddGroup "-g 84 -r" >/dev/null 2>&1
TryAddGroup "-g 84" >/dev/null 2>&1
TryAddGroup "-r" >/dev/null 2>&1
TryAddGroup " "
2006-06-19 15:04:59 +02:00
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"
2005-04-29 20:24:44 +02:00
TryAddUser "-u 84 -r" >/dev/null 2>&1
TryAddUser "-u 84" >/dev/null 2>&1
TryAddUser "-r" >/dev/null 2>&1
TryAddUser " "
}
2005-08-16 12:04:13 +02:00
#------------------------------------------------------------------------
# Detect Distribution.
# AP: very beautiful, but unused. Let's keep alive for a while. (2005)
detectDistro() {
# it's not provided...
if [ -z "$linuxDistro" ]
then
if [ -e /etc/SuSE-release ]
then
# SuSE
linuxDistro="SuSE"
elif [ -e /etc/mandrake-release ]
then
# Mandrake
linuxDistro="MDK"
elif [ -e /etc/debian_version ]
then
# Debian
linuxDistro="Debian"
elif [ -e /etc/gentoo-release ]
then
# Debian
linuxDistro="Gentoo"
elif [ -e /etc/rc.d/init.d/functions ]
then
# very likely Red Hat
linuxDistro="RH"
elif [ -d /etc/rc.d/init.d ]
then
# generic Red Hat
linuxDistro="G-RH"
elif [ -d /etc/init.d ]
then
# generic SuSE
linuxDistro="G-SuSE"
fi
fi
}
#------------------------------------------------------------------------
# print location of init script
getInitScriptLocation() {
if [ -f /etc/rc.d/init.d/firebird ]
then
echo -n /etc/rc.d/init.d/firebird
elif [ -f /etc/rc.d/rc.firebird ]
then
echo -n /etc/rc.d/rc.firebird
2005-08-16 12:04:13 +02:00
elif [ -f /etc/init.d/firebird ]
then
echo -n /etc/init.d/firebird
fi
}
#------------------------------------------------------------------------
# stop super server if it is running
stopSuperServerIfRunning() {
checkString=`ps -efww| egrep "\b(fbserver|fbguard)\b" |grep -v grep`
2005-08-16 12:04:13 +02:00
if [ ! -z "$checkString" ]
then
init_d=`getInitScriptLocation`
if [ -x "$init_d" ]
2005-08-16 12:04:13 +02:00
then
$init_d stop
fi
fi
}