diff --git a/builds/install/arch-specific/linux/misc/README b/builds/install/arch-specific/linux/README similarity index 100% rename from builds/install/arch-specific/linux/misc/README rename to builds/install/arch-specific/linux/README diff --git a/builds/install/arch-specific/linux/firebird-classic.service.in b/builds/install/arch-specific/linux/firebird-classic.service.in new file mode 100644 index 0000000000..aad7ae103a --- /dev/null +++ b/builds/install/arch-specific/linux/firebird-classic.service.in @@ -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 diff --git a/builds/install/arch-specific/linux/firebird-classic.socket.in b/builds/install/arch-specific/linux/firebird-classic.socket.in new file mode 100644 index 0000000000..d44c0bea5c --- /dev/null +++ b/builds/install/arch-specific/linux/firebird-classic.socket.in @@ -0,0 +1,10 @@ +[Unit] +Description=Firebird Classic Activation Socket +Conflicts=firebird-superserver.service + +[Socket] +ListenStream=3050 +Accept=true + +[Install] +WantedBy=sockets.target diff --git a/builds/install/arch-specific/linux/firebird-superserver.service.in b/builds/install/arch-specific/linux/firebird-superserver.service.in new file mode 100644 index 0000000000..a13b092c41 --- /dev/null +++ b/builds/install/arch-specific/linux/firebird-superserver.service.in @@ -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 diff --git a/builds/install/arch-specific/linux/misc/firebird.init.d.debian.in b/builds/install/arch-specific/linux/firebird.init.d.debian.in similarity index 100% rename from builds/install/arch-specific/linux/misc/firebird.init.d.debian.in rename to builds/install/arch-specific/linux/firebird.init.d.debian.in diff --git a/builds/install/arch-specific/linux/misc/firebird.init.d.generic.in b/builds/install/arch-specific/linux/firebird.init.d.generic.in similarity index 97% rename from builds/install/arch-specific/linux/misc/firebird.init.d.generic.in rename to builds/install/arch-specific/linux/firebird.init.d.generic.in index e23204ca4f..73e1be00ba 100644 --- a/builds/install/arch-specific/linux/misc/firebird.init.d.generic.in +++ b/builds/install/arch-specific/linux/firebird.init.d.generic.in @@ -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 diff --git a/builds/install/arch-specific/linux/misc/firebird.init.d.gentoo.in b/builds/install/arch-specific/linux/firebird.init.d.gentoo.in similarity index 96% rename from builds/install/arch-specific/linux/misc/firebird.init.d.gentoo.in rename to builds/install/arch-specific/linux/firebird.init.d.gentoo.in index 0e02b2de21..95efe3f9ca 100644 --- a/builds/install/arch-specific/linux/misc/firebird.init.d.gentoo.in +++ b/builds/install/arch-specific/linux/firebird.init.d.gentoo.in @@ -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 diff --git a/builds/install/arch-specific/linux/misc/firebird.init.d.mandrake.in b/builds/install/arch-specific/linux/firebird.init.d.mandrake.in similarity index 98% rename from builds/install/arch-specific/linux/misc/firebird.init.d.mandrake.in rename to builds/install/arch-specific/linux/firebird.init.d.mandrake.in index cd8f563208..d5775ee329 100644 --- a/builds/install/arch-specific/linux/misc/firebird.init.d.mandrake.in +++ b/builds/install/arch-specific/linux/firebird.init.d.mandrake.in @@ -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 diff --git a/builds/install/arch-specific/linux/misc/firebird.init.d.slackware.in b/builds/install/arch-specific/linux/firebird.init.d.slackware.in similarity index 96% rename from builds/install/arch-specific/linux/misc/firebird.init.d.slackware.in rename to builds/install/arch-specific/linux/firebird.init.d.slackware.in index 10d69e55e5..b7c0725c73 100644 --- a/builds/install/arch-specific/linux/misc/firebird.init.d.slackware.in +++ b/builds/install/arch-specific/linux/firebird.init.d.slackware.in @@ -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 diff --git a/builds/install/arch-specific/linux/misc/firebird.init.d.suse.in b/builds/install/arch-specific/linux/firebird.init.d.suse.in similarity index 100% rename from builds/install/arch-specific/linux/misc/firebird.init.d.suse.in rename to builds/install/arch-specific/linux/firebird.init.d.suse.in diff --git a/builds/install/arch-specific/linux/misc/firebird.xinetd.in b/builds/install/arch-specific/linux/firebird.xinetd.in similarity index 100% rename from builds/install/arch-specific/linux/misc/firebird.xinetd.in rename to builds/install/arch-specific/linux/firebird.xinetd.in diff --git a/builds/install/arch-specific/linux/misc/linuxLibrary.sh.in b/builds/install/arch-specific/linux/linuxLibrary.sh.in similarity index 75% rename from builds/install/arch-specific/linux/misc/linuxLibrary.sh.in rename to builds/install/arch-specific/linux/linuxLibrary.sh.in index a3607e93d3..3503ea1314 100644 --- a/builds/install/arch-specific/linux/misc/linuxLibrary.sh.in +++ b/builds/install/arch-specific/linux/linuxLibrary.sh.in @@ -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 2&>/dev/null + openssl /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 diff --git a/builds/install/arch-specific/linux/misc/makeInstallImage.sh.in b/builds/install/arch-specific/linux/makeInstallImage.sh.in similarity index 97% rename from builds/install/arch-specific/linux/misc/makeInstallImage.sh.in rename to builds/install/arch-specific/linux/makeInstallImage.sh.in index 89573bd751..8d7538fb5d 100644 --- a/builds/install/arch-specific/linux/misc/makeInstallImage.sh.in +++ b/builds/install/arch-specific/linux/makeInstallImage.sh.in @@ -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@ diff --git a/builds/install/arch-specific/linux/misc/rc.config.firebird.in b/builds/install/arch-specific/linux/rc.config.firebird.in similarity index 100% rename from builds/install/arch-specific/linux/misc/rc.config.firebird.in rename to builds/install/arch-specific/linux/rc.config.firebird.in diff --git a/builds/install/misc/changeDBAPassword.sh.in b/builds/install/misc/changeDBAPassword.sh.in deleted file mode 100644 index db43b4edd8..0000000000 --- a/builds/install/misc/changeDBAPassword.sh.in +++ /dev/null @@ -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 diff --git a/builds/install/misc/changeRunUser.sh.in b/builds/install/misc/changeRunUser.sh.in deleted file mode 100644 index b404250304..0000000000 --- a/builds/install/misc/changeRunUser.sh.in +++ /dev/null @@ -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 -# 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." diff --git a/builds/install/misc/restoreRootRunUser.sh.in b/builds/install/misc/restoreRootRunUser.sh.in deleted file mode 100644 index 5680325f5f..0000000000 --- a/builds/install/misc/restoreRootRunUser.sh.in +++ /dev/null @@ -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 -# 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." diff --git a/builds/install/misc/changeServerMode.sh.in b/builds/install/posix-common/changeServerMode.sh.in similarity index 97% rename from builds/install/misc/changeServerMode.sh.in rename to builds/install/posix-common/changeServerMode.sh.in index dfc59b5a8c..7bf7d55fe0 100644 --- a/builds/install/misc/changeServerMode.sh.in +++ b/builds/install/posix-common/changeServerMode.sh.in @@ -27,8 +27,6 @@ cat <$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 <$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 <>$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 diff --git a/builds/install/arch-specific/linux/misc/postinstall.sh.in b/builds/install/posix-common/postinstall.sh.in similarity index 92% rename from builds/install/arch-specific/linux/misc/postinstall.sh.in rename to builds/install/posix-common/postinstall.sh.in index 15bdbf5335..cc918c5745 100644 --- a/builds/install/arch-specific/linux/misc/postinstall.sh.in +++ b/builds/install/posix-common/postinstall.sh.in @@ -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 diff --git a/builds/install/arch-specific/linux/misc/postuninstall.sh.in b/builds/install/posix-common/postuninstall.sh.in similarity index 96% rename from builds/install/arch-specific/linux/misc/postuninstall.sh.in rename to builds/install/posix-common/postuninstall.sh.in index 3d701fb1b5..e46e8a2004 100644 --- a/builds/install/arch-specific/linux/misc/postuninstall.sh.in +++ b/builds/install/posix-common/postuninstall.sh.in @@ -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 diff --git a/builds/install/arch-specific/linux/misc/preinstall.sh.in b/builds/install/posix-common/preinstall.sh.in similarity index 100% rename from builds/install/arch-specific/linux/misc/preinstall.sh.in rename to builds/install/posix-common/preinstall.sh.in diff --git a/builds/install/arch-specific/linux/misc/preuninstall.sh.in b/builds/install/posix-common/preuninstall.sh.in similarity index 92% rename from builds/install/arch-specific/linux/misc/preuninstall.sh.in rename to builds/install/posix-common/preuninstall.sh.in index e5ddd2338f..5b550e60b8 100644 --- a/builds/install/arch-specific/linux/misc/preuninstall.sh.in +++ b/builds/install/posix-common/preuninstall.sh.in @@ -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 diff --git a/builds/install/misc/createAliasDB.sh.in b/builds/install/posix-common/registerDatabase.sh.in similarity index 87% rename from builds/install/misc/createAliasDB.sh.in rename to builds/install/posix-common/registerDatabase.sh.in index b221356f5d..68478e21be 100644 --- a/builds/install/misc/createAliasDB.sh.in +++ b/builds/install/posix-common/registerDatabase.sh.in @@ -29,29 +29,29 @@ # Created by: Mark O'Donohue # # 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 < " + echo "Usage is registerDatabase.sh " 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 </dev/null]) ;;