From: <ale...@us...> - 2013-07-17 12:02:48
|
Revision: 58374 http://sourceforge.net/p/firebird/code/58374 Author: alexpeshkoff Date: 2013-07-17 12:02:44 +0000 (Wed, 17 Jul 2013) Log Message: ----------- Fixed posix install and management scripts Modified Paths: -------------- firebird/trunk/builds/install/arch-specific/linux/misc/linuxLibrary.sh.in firebird/trunk/builds/install/arch-specific/linux/misc/makeInstallImage.sh.in firebird/trunk/builds/install/arch-specific/linux/misc/postinstall.sh.in firebird/trunk/builds/install/arch-specific/linux/misc/preuninstall.sh.in firebird/trunk/builds/install/arch-specific/linux/misc/tarMainUninstall.sh.in firebird/trunk/builds/install/misc/changeRunUser.sh.in firebird/trunk/builds/install/misc/posixLibrary.sh.in firebird/trunk/builds/install/misc/restoreRootRunUser.sh.in firebird/trunk/builds/posix/postfix.darwin firebird/trunk/configure.ac Added Paths: ----------- firebird/trunk/builds/install/misc/changeServerMode.sh.in Removed Paths: ------------- firebird/trunk/builds/install/misc/changeMultiConnectMode.sh.in Modified: firebird/trunk/builds/install/arch-specific/linux/misc/linuxLibrary.sh.in =================================================================== --- firebird/trunk/builds/install/arch-specific/linux/misc/linuxLibrary.sh.in 2013-07-17 11:55:04 UTC (rev 58373) +++ firebird/trunk/builds/install/arch-specific/linux/misc/linuxLibrary.sh.in 2013-07-17 12:02:44 UTC (rev 58374) @@ -32,7 +32,7 @@ #------------------------------------------------------------------------ # Get correct options & misc. -psOptions=aww +psOptions=-efaww export psOptions mktOptions=-q export mktOptions @@ -153,7 +153,7 @@ # stop super server if it is running stopSuperServerIfRunning() { - checkString=`ps -eaf | egrep "\b(fbserver|fbguard|fb_smp_server|firebird)\b" |grep -v grep` + checkString=`grepProcess "fbserver|fbguard|fb_smp_server|firebird"` if [ ! -z "$checkString" ] then @@ -166,7 +166,7 @@ do $init_d stop sleep 1 - checkString=`ps -eaf | egrep "\b(fbserver|fbguard|fb_smp_server|firebird)\b" |grep -v grep` + checkString=`grepProcess "fbserver|fbguard|fb_smp_server|firebird"` if [ -z "$checkString" ] then return @@ -238,11 +238,6 @@ # initd script for SuSE >= 7.2 is a part of RPM package installInitdScript() { - Arch=$1 - if [ "$Arch" != super ]; then - return 0 - fi - srcScript="" initScript= @@ -364,24 +359,18 @@ # start init.d service startService() { - Arch=$1 - if [ "$Arch" != super ]; then - return 0 - fi - InitFile=`getInitScriptLocation` - if [ -f "$InitFile" ] - then + if [ -f "$InitFile" ]; then "$InitFile" start - checkString=`ps -eaf | egrep "\b(firebird)\b" |grep -v grep` + checkString=`grepProcess "firebird"` if [ -z "$checkString" ] then # server didn't start - wait a bit and recheck sleep 2 "$InitFile" start - checkString=`ps -eaf | egrep "\b(firebird)\b" |grep -v grep` + checkString=`grepProcess "firebird"` if [ -z "$checkString" ] then echo "Looks like standalone server failed to start" @@ -391,12 +380,12 @@ fi } + #------------------------------------------------------------------------ # If we have right systems remove the service autostart stuff. removeServiceAutostart() { - InitFile=`getInitScriptLocation` - if [ -f "$InitFile" ]; then + if standaloneServerInstalled; then # Unregister using OS command if [ -x /sbin/insserv ]; then @@ -422,10 +411,11 @@ fi } + #------------------------------------------------------------------------ # Returns TRUE if SA server is installed -isStandaloneServerInstalled() { +standaloneServerInstalled() { InitFile=`getInitScriptLocation` if [ -f "$InitFile" ]; then return 0 @@ -433,6 +423,7 @@ return 1 } + #------------------------------------------------------------------------ # Corrects build-time "libdir" value Modified: firebird/trunk/builds/install/arch-specific/linux/misc/makeInstallImage.sh.in =================================================================== --- firebird/trunk/builds/install/arch-specific/linux/misc/makeInstallImage.sh.in 2013-07-17 11:55:04 UTC (rev 58373) +++ firebird/trunk/builds/install/arch-specific/linux/misc/makeInstallImage.sh.in 2013-07-17 12:02:44 UTC (rev 58374) @@ -169,7 +169,7 @@ 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 changeMultiConnectMode.sh ${TargetDir}@FB_SBINDIR@ + addLibs $BuiltFBDir/bin changeServerMode.sh ${TargetDir}@FB_SBINDIR@ cp $BuiltFBDir/bin/createAliasDB.sh ${TargetDir}@FB_SBINDIR@ cp $BuiltFBDir/bin/fb_config ${TargetDir}@FB_SBINDIR@ Modified: firebird/trunk/builds/install/arch-specific/linux/misc/postinstall.sh.in =================================================================== --- firebird/trunk/builds/install/arch-specific/linux/misc/postinstall.sh.in 2013-07-17 11:55:04 UTC (rev 58373) +++ firebird/trunk/builds/install/arch-specific/linux/misc/postinstall.sh.in 2013-07-17 12:02:44 UTC (rev 58374) @@ -40,7 +40,7 @@ addFirebirdUser fi -# Update ownership and SUID bits for files. +# Update ownership for files. fixFilePermissions # Install script in /etc/init.d (exact location is distro dependent) @@ -55,14 +55,14 @@ # Create libgds.so links createLinksForBackCompatibility -# Update the /etc/inetd.conf or xinetd entry -updateInetdServiceEntry +#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 +#resetInetdServer # start the RDBMS server startService Modified: firebird/trunk/builds/install/arch-specific/linux/misc/preuninstall.sh.in =================================================================== --- firebird/trunk/builds/install/arch-specific/linux/misc/preuninstall.sh.in 2013-07-17 11:55:04 UTC (rev 58373) +++ firebird/trunk/builds/install/arch-specific/linux/misc/preuninstall.sh.in 2013-07-17 12:02:44 UTC (rev 58374) @@ -38,5 +38,3 @@ rm -f $i fi done - -rm -f @FB_SBINDIR@/fbmgr Modified: firebird/trunk/builds/install/arch-specific/linux/misc/tarMainUninstall.sh.in =================================================================== --- firebird/trunk/builds/install/arch-specific/linux/misc/tarMainUninstall.sh.in 2013-07-17 11:55:04 UTC (rev 58373) +++ firebird/trunk/builds/install/arch-specific/linux/misc/tarMainUninstall.sh.in 2013-07-17 12:02:44 UTC (rev 58374) @@ -55,7 +55,7 @@ if [ -e $scriptsDir ] then - displayMessage "Extracting install data" + displayMessage "Extracting uninstall data" runAndCheckExit "$scriptsDir/preuninstall.sh" runAndCheckExit "$scriptsDir/postuninstall.sh" Deleted: firebird/trunk/builds/install/misc/changeMultiConnectMode.sh.in =================================================================== --- firebird/trunk/builds/install/misc/changeMultiConnectMode.sh.in 2013-07-17 11:55:04 UTC (rev 58373) +++ firebird/trunk/builds/install/misc/changeMultiConnectMode.sh.in 2013-07-17 12:02:44 UTC (rev 58374) @@ -1,63 +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 Alex Peshkoff -# for the Firebird Open Source RDBMS project. -# -# Copyright (c) 2008 Alex Peshkoff <pes...@ma...> -# and all contributors signed below. -# -# All Rights Reserved. -# Contributor(s): ______________________________________. -# - -#= Main ==================================================================== - -cat <<EOF -For classic server there are two ways to support multiple connections: -multiprocess (traditional for FB classic server) and multithread (new for FB 2.5). - -multiprocess mode is specially reliable cause error in one process does not affect others. -multithread minimizes OS load and should provide better scalability under high loads. - -EOF - -AskQuestion "Which option would you like to choose: multi-(process|thread) [process] " "process" -multiAnswer=$Answer - -case $multiAnswer in -process) - ;; -thread) - ;; -*) - echo "Unknown option $multiAnswer chosen" - exit 1 - ;; -esac - -echo "Stopping currently running engine..." -checkIfServerRunning -removeInetdServiceEntry -removeServiceAutostart - -echo "Starting firebird in multi$multiAnswer mode..." -if [ $multiAnswer == process ]; then - updateInetdServiceEntry - resetInetdServer -else - installInitdScript super - startService super -fi - -echo "Done." Modified: firebird/trunk/builds/install/misc/changeRunUser.sh.in =================================================================== --- firebird/trunk/builds/install/misc/changeRunUser.sh.in 2013-07-17 11:55:04 UTC (rev 58373) +++ firebird/trunk/builds/install/misc/changeRunUser.sh.in 2013-07-17 12:02:44 UTC (rev 58374) @@ -26,7 +26,6 @@ RunUser=firebird RunGroup=firebird -serverMode=classic checkInstallUser checkIfServerRunning @@ -51,12 +50,11 @@ updateInetdServiceEntry changeInitRunUser $RunUser -# Update ownership and SUID bits for programs. +# Update ownership and SUID bits for programs echo "Updating permissions" fixFilePermissions -# Get inetd to reread new init files, start service. -resetInetdServer -startService $serverMode +# Start server again +startFirebird echo "Completed." Copied: firebird/trunk/builds/install/misc/changeServerMode.sh.in (from rev 58348, firebird/trunk/builds/install/misc/changeMultiConnectMode.sh.in) =================================================================== --- firebird/trunk/builds/install/misc/changeServerMode.sh.in (rev 0) +++ firebird/trunk/builds/install/misc/changeServerMode.sh.in 2013-07-17 12:02:44 UTC (rev 58374) @@ -0,0 +1,69 @@ +#!/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 Alex Peshkoff +# for the Firebird Open Source RDBMS project. +# +# Copyright (c) 2008 Alex Peshkoff <pes...@ma...> +# and all contributors signed below. +# +# All Rights Reserved. +# Contributor(s): ______________________________________. +# + +#= Main ==================================================================== + +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" +multiAnswer=$Answer + +case "$multiAnswer" in +super) + ;; +classic) + ;; +*) + echo "Unknown option $multiAnswer chosen" + exit 1 + ;; +esac + +echo "Stopping currently running engine..." +checkIfServerRunning +removeInetdServiceEntry +removeServiceAutostart + +echo "Starting firebird in $multiAnswer server mode..." +fbconf="@FB_CONFDIR@/firebird.conf" +if [ $multiAnswer == classic ]; then + replaceLineInFile $fbconf "SharedCache = false" "^SharedCache" + replaceLineInFile $fbconf "SharedDatabase = true" "^SharedDatabase" + + updateInetdServiceEntry + resetInetdServer +else + replaceLineInFile $fbconf "SharedCache = true" "^SharedCache" + replaceLineInFile $fbconf "SharedDatabase = false" "^SharedDatabase" + + installInitdScript + startService +fi + +echo "Done." Property changes on: firebird/trunk/builds/install/misc/changeServerMode.sh.in ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: firebird/trunk/builds/install/misc/posixLibrary.sh.in =================================================================== --- firebird/trunk/builds/install/misc/posixLibrary.sh.in 2013-07-17 11:55:04 UTC (rev 58373) +++ firebird/trunk/builds/install/misc/posixLibrary.sh.in 2013-07-17 12:02:44 UTC (rev 58374) @@ -150,7 +150,7 @@ # Works for both inetd and xinetd resetInetdServer() { - pid=`ps -eaf$psOptions | grep inetd | grep -v grep | awk '{print $2}'` + pid=`grepProcess "inetd|xinetd" | awk '{print $2}'` if [ "$pid" ] then kill -HUP $pid @@ -200,17 +200,20 @@ #------------------------------------------------------------------------ +# grep process by name + +grepProcess() { + processList=$1 + eol=\$ + ps $psOptions | egrep "\<($processList)($eol|[[:space:]])" | grep -v grep +} + + +#------------------------------------------------------------------------ # check if it is running checkIfServerRunning() { - checkString=`ps -ef$psOptions | egrep "[[:space:]]\b(fbserver|fbguard|fb_smp_server|firebird)\b[[:space:]]" |grep -v grep` - if [ ! -z "$checkString" ] - then - serverMode=super - fi - -# have to be root to stop the server if [ "$1" != "install-embedded" ] then stopSuperServerIfRunning @@ -219,7 +222,7 @@ # Check is server is being actively used. - checkString=`ps -ef$psOptions | egrep "[[:space:]]\b(firebird)\b[[:space:]]" |grep -v grep` + checkString=`grepProcess "firebird"` if [ ! -z "$checkString" ] then echo "An instance of the Firebird server seems to be running." @@ -227,7 +230,7 @@ exit 1 fi - checkString=`ps -ef$psOptions | egrep "[[:space:]]\b(fb_smp_server)\b[[:space:]]" |grep -v grep` + checkString=`grepProcess "fb_smp_server"` if [ ! -z "$checkString" ] then echo "An instance of the Firebird SuperClassic server seems to be running." @@ -235,7 +238,7 @@ exit 1 fi - checkString=`ps -ef$psOptions | egrep "[[:space:]]\b(fbserver|fbguard)\b[[:space:]]" |grep -v grep` + checkString=`grepProcess "fbserver|fbguard"` if [ ! -z "$checkString" ] then echo "An instance of the Firebird Super server seems to be running." @@ -243,7 +246,7 @@ exit 1 fi - checkString=`ps -ef$psOptions | egrep "[[:space:]]\b(fb_inet_server|gds_pipe)\b[[:space:]]" |grep -v grep` + checkString=`grepProcess "fb_inet_server|gds_pipe"` if [ ! -z "$checkString" ] then echo "An instance of the Firebird Classic server seems to be running." @@ -254,7 +257,7 @@ # The following check for running interbase or firebird 1.0 servers. - checkString=`ps -ef$psOptions | egrep "\b(ibserver|ibguard)\b" |grep -v grep` + checkString=`grepProcess "ibserver|ibguard"` if [ ! -z "$checkString" ] then echo "An instance of the Firebird/InterBase Super server seems to be running." @@ -263,7 +266,7 @@ exit 1 fi - checkString=`ps -ef$psOptions | egrep "\b(gds_inet_server|gds_pipe)\b" |grep -v grep` + checkString=`grepProcess "gds_inet_server|gds_pipe"` if [ ! -z "$checkString" ] then echo "An instance of the Firebird/InterBase Classic server seems to be running." @@ -342,7 +345,7 @@ # Here there are three cases, not found => add # found & different => replace # found & same => do nothing -# +# replaceLineInFile() { FileName="$1" @@ -416,7 +419,7 @@ else echo "# generated on `hostname` at time `date`" >> $DBAPasswordFile fi - + cat <<EOT >>$DBAPasswordFile # Your password can be changed to a more suitable one using the @@ -435,19 +438,7 @@ fi } -#------------------------------------------------------------------------ -# Change sysdba password. -changeDBAPassword() { - if [ -z "$InteractiveInstall" ] - then - generateNewDBAPassword - else - askUserForNewDBAPassword masterkey - fi -} - - #------------------------------------------------------------------------ # Set sysdba password. @@ -461,7 +452,7 @@ passwd=$NewPasswd fi - if [ ! -z "$passwd" ] + if [ -z "$passwd" ] then passwd=masterkey fi @@ -885,7 +876,7 @@ # Install differs for each of them. updateInetdServiceEntry() { - if ! isStandaloneServerInstalled + if ! standaloneServerInstalled then if [ -d /etc/xinetd.d ] then @@ -923,3 +914,15 @@ export InteractiveInstall fi } + + +#--------------------------------------------------------------------------- +# depending upon presence of startup script starts super or classic server + +startFirebird() { + if standaloneServerInstalled; then + startService + else + resetInetdServer + fi +} Modified: firebird/trunk/builds/install/misc/restoreRootRunUser.sh.in =================================================================== --- firebird/trunk/builds/install/misc/restoreRootRunUser.sh.in 2013-07-17 11:55:04 UTC (rev 58373) +++ firebird/trunk/builds/install/misc/restoreRootRunUser.sh.in 2013-07-17 12:02:44 UTC (rev 58374) @@ -26,7 +26,6 @@ RunUser=root RunGroup=root -serverMode=classic checkInstallUser checkIfServerRunning @@ -51,12 +50,11 @@ updateInetdServiceEntry changeInitRunUser $RunUser -# Update ownership and SUID bits for programs. +# Update ownership and SUID bits for programs echo "Updating permissions" fixFilePermissions -# Get inetd to reread new init files, start service. -resetInetdServer -startService $serverMode +# Start server again +startFirebird echo "Completed." Modified: firebird/trunk/builds/posix/postfix.darwin =================================================================== --- firebird/trunk/builds/posix/postfix.darwin 2013-07-17 11:55:04 UTC (rev 58373) +++ firebird/trunk/builds/posix/postfix.darwin 2013-07-17 12:02:44 UTC (rev 58374) @@ -93,9 +93,9 @@ cp ../gen/firebird/bin/fbtracemgr $(FB_FW)/Resources/bin cp ../gen/firebird/bin/fbguard $(FB_FW)/Resources/bin cp ../gen/firebird/bin/fb_smp_server $(FB_FW)/Resources/bin - chmod +x ../builds/install/arch-specific/darwin/changeMultiConnectMode - cp ../builds/install/arch-specific/darwin/changeMultiConnectMode \ - $(FB_FW)/Resources/bin/changeMultiConnectMode.sh + chmod +x ../builds/install/arch-specific/darwin/changeServerMode + cp ../builds/install/arch-specific/darwin/changeServerMode \ + $(FB_FW)/Resources/bin/changeServerMode.sh cp ../src/extlib/ib_udf.sql $(FB_FW)/Resources/English.lproj/var/UDF cp ../src/extlib/fbudf/fbudf.sql $(FB_FW)/Resources/English.lproj/var/UDF cp ../builds/install/arch-specific/darwin/FrameworkInfo.plist \ Modified: firebird/trunk/configure.ac =================================================================== --- firebird/trunk/configure.ac 2013-07-17 11:55:04 UTC (rev 58373) +++ firebird/trunk/configure.ac 2013-07-17 12:02:44 UTC (rev 58374) @@ -1139,7 +1139,7 @@ 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/changeMultiConnectMode.sh:builds/install/misc/changeMultiConnectMode.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/vers.sh:builds/posix/vers.sh.in ]) @@ -1202,7 +1202,7 @@ gen/install/misc/firebird.init.d.aix:builds/install/arch-specific/aix/misc/firebird.init.d.aix.in gen/install/misc/rc.config.firebird.aix:builds/install/arch-specific/aix/misc/rc.config.firebird.aix.in gen/firebird/bin/changedbapassword.aix.sh:builds/install/misc/changeDBAPassword.sh.in - gen/firebird/bin/changemulticonnectmode.aix.sh:builds/install/misc/changeMultiConnectMode.sh.in + gen/firebird/bin/changemulticonnectmode.aix.sh:builds/install/misc/changeServerMode.sh.in gen/firebird/bin/changegdslibrarycompatiblelink.aix.sh:builds/install/misc/changeGdsLibraryCompatibleLink.sh.in gen/firebird/bin/createaliasdb.aix.sh:builds/install/misc/createAliasDB.sh.in gen/firebird/bin/aixLibrary.sh:builds/install/arch-specific/aix/misc/aixLibrary.sh.in], This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |