From: <ale...@us...> - 2011-06-03 09:52:35
|
Revision: 53098 http://firebird.svn.sourceforge.net/firebird/?rev=53098&view=rev Author: alexpeshkoff Date: 2011-06-03 09:52:28 +0000 (Fri, 03 Jun 2011) Log Message: ----------- Fixed CORE-2921: 'make install' does not work on freebsd Modified Paths: -------------- firebird/branches/B2_5_Release/builds/install/arch-specific/freebsd/freebsdLibrary.sh.in firebird/branches/B2_5_Release/builds/install/arch-specific/freebsd/install.sh.in firebird/branches/B2_5_Release/builds/install/arch-specific/linux/misc/linuxLibrary.sh.in firebird/branches/B2_5_Release/builds/install/misc/changeMultiConnectMode.sh.in firebird/branches/B2_5_Release/builds/install/misc/posixLibrary.sh.in firebird/branches/B2_5_Release/configure.in Added Paths: ----------- firebird/branches/B2_5_Release/builds/install/arch-specific/freebsd/firebird_daemon_startup_script.in Added: firebird/branches/B2_5_Release/builds/install/arch-specific/freebsd/firebird_daemon_startup_script.in =================================================================== --- firebird/branches/B2_5_Release/builds/install/arch-specific/freebsd/firebird_daemon_startup_script.in (rev 0) +++ firebird/branches/B2_5_Release/builds/install/arch-specific/freebsd/firebird_daemon_startup_script.in 2011-06-03 09:52:28 UTC (rev 53098) @@ -0,0 +1,56 @@ +#!/bin/sh +# +# $FreeBSD: ports/databases/firebird25-server/files/firebird.in,v 1.1 2010/12/20 08:48:54 acm Exp $ +# +# PROVIDE: firebird +# REQUIRE: LOGIN +# KEYWORD: shutdown +# + +. /etc/rc.subr + +FIREBIRD=@FB_CONFDIR@ +export FIREBIRD + +name=firebird +rcvar=`set_rcvar` + +firebird_enable=YES # don't change - if script is installed, it's supposed to start +firebird_pidfile="/var/run/${name}.pid" +firebird_user=firebird + +command_args="-daemon -forever" +command=@FB_SBINDIR@/fbguard +pidfile=${firebird_pidfile} + +start_precmd="start_precmd" +start_postcmd="start_postcmd" +stop_postcmd=stop_postcmd +reload_postcmd=reload_postcmd + +start_precmd() +{ + touch ${firebird_pidfile} + chown "${firebird_user}:wheel" ${firebird_pidfile} || + err 1 "Cannot chown ${firebird_pidfile}" +} + +start_postcmd() +{ + sleep 1 # Give fbguard time to exec after fork + # This avoids getting 2 pids in firebird_pidfile + pgrep -u ${firebird_user} fbguard > ${firebird_pidfile} +} + +stop_postcmd() +{ + rm -f ${pidfile} +} + +reload_postcmd() +{ + rm -f ${pidfile} + run_rc_command start +} + +run_rc_command "$1" Property changes on: firebird/branches/B2_5_Release/builds/install/arch-specific/freebsd/firebird_daemon_startup_script.in ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: firebird/branches/B2_5_Release/builds/install/arch-specific/freebsd/freebsdLibrary.sh.in =================================================================== --- firebird/branches/B2_5_Release/builds/install/arch-specific/freebsd/freebsdLibrary.sh.in 2011-06-03 08:25:04 UTC (rev 53097) +++ firebird/branches/B2_5_Release/builds/install/arch-specific/freebsd/freebsdLibrary.sh.in 2011-06-03 09:52:28 UTC (rev 53098) @@ -32,7 +32,7 @@ #------------------------------------------------------------------------ # Get correct options & misc. -psOptions=aww +psOptions=-ajx export psOptions mktOptions=-q export mktOptions @@ -90,16 +90,7 @@ # 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/*firebird* ] - then - echo -n /etc/rc.d/*firebird* - elif [ -f /etc/init.d/*firebird* ] - then - echo -n /etc/init.d/*firebird* - fi + echo -n /etc/rc.d/firebird } @@ -107,7 +98,7 @@ # stop super server if it is running stopSuperServerIfRunning() { - checkString=`ps -af | egrep "\b(fbserver|fbguard|fb_smp_server)\b" |grep -v grep` + checkString=`ps $psOptions | egrep "\b(fbserver|fbguard|fb_smp_server)\b" |grep -v grep` if [ ! -z "$checkString" ] then @@ -120,7 +111,7 @@ do $init_d stop sleep 1 - checkString=`ps -eaf | egrep "\b(fbserver|fbguard|fb_smp_server)\b" |grep -v grep` + checkString=`ps $psOptions | egrep "\b(fbserver|fbguard|fb_smp_server)\b" |grep -v grep` if [ -z "$checkString" ] then return @@ -192,8 +183,9 @@ return 0 fi -# dummy for a while - return 1 + initScript=`getInitScriptLocation` + cp @FB_MISCDIR@/firebird_daemon_startup_script $initScript + chmod a=rx $initScript } @@ -210,17 +202,6 @@ if [ -f "$InitFile" ] then "$InitFile" start - - checkString=`ps -af | egrep "\b(fbserver|fb_smp_server)\b" |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 - pw usermod firebird -s /bin/sh - "$InitFile" start - fi fi } @@ -228,6 +209,8 @@ # If we have right systems remove the service autostart stuff. removeServiceAutostart() { - # dummy for a while - return 1 + InitFile=`getInitScriptLocation` + if [ -f "$InitFile" ]; then + rm -f "$InitFile" + fi } Modified: firebird/branches/B2_5_Release/builds/install/arch-specific/freebsd/install.sh.in =================================================================== --- firebird/branches/B2_5_Release/builds/install/arch-specific/freebsd/install.sh.in 2011-06-03 08:25:04 UTC (rev 53097) +++ firebird/branches/B2_5_Release/builds/install/arch-specific/freebsd/install.sh.in 2011-06-03 09:52:28 UTC (rev 53098) @@ -55,7 +55,7 @@ libTarget=$libTdir/$libScript rm -f $libTarget - touch $libTarget + echo '#!/bin/sh' >$libTarget for i in posixLibrary.sh @FIR...@Li... freebsdLibrary.sh do echo "# $i" >>$libTarget @@ -167,19 +167,21 @@ cp -f $BuiltFBDir/bin/fbguard ${TargetDir}@FB_SBINDIR@ copyIfExists $BuiltFBDir/bin/fb_lock_print ${TargetDir}@FB_SBINDIR@ copyIfExists $BuiltFBDir/bin/fbmgr.bin ${TargetDir}@FB_SBINDIR@ +# cp $BuiltFBDir/bin/fb_config ${TargetDir}@FB_SBINDIR@ - addLibs $BuildRootDir/gen/firebird/bin changeRunUser.sh ${TargetDir}@FB_SBINDIR@ - addLibs $BuildRootDir/gen/firebird/bin restoreRootRunUser.sh ${TargetDir}@FB_SBINDIR@ - addLibs $BuildRootDir/gen/firebird/bin changeDBAPassword.sh ${TargetDir}@FB_SBINDIR@ - addLibs $BuildRootDir/gen/firebird/bin changeMultiConnectMode.sh ${TargetDir}@FB_SBINDIR@ - addLibs $BuiltFBDir/bin changeGdsLibraryCompatibleLink.sh ${TargetDir}@FB_SBINDIR@ - cp $BuiltFBDir/bin/createAliasDB.sh ${TargetDir}@FB_SBINDIR@ - cp $BuiltFBDir/bin/fb_config ${TargetDir}@FB_SBINDIR@ - chown root:wheel ${TargetDir}@FB_SBINDIR@/* chmod 0755 ${TargetDir}@FB_SBINDIR@/* - chmod 0700 ${TargetDir}@FB_SBINDIR@/*.sh +# addLibs $BuildRootDir/gen/firebird/bin changeRunUser.sh ${TargetDir}@FB_SBINDIR@ +# addLibs $BuildRootDir/gen/firebird/bin restoreRootRunUser.sh ${TargetDir}@FB_SBINDIR@ +# addLibs $BuildRootDir/gen/firebird/bin changeDBAPassword.sh ${TargetDir}@FB_SBINDIR@ +# addLibs $BuiltFBDir/bin changeGdsLibraryCompatibleLink.sh ${TargetDir}@FB_SBINDIR@ +# cp $BuiltFBDir/bin/createAliasDB.sh ${TargetDir}@FB_SBINDIR@ + if [ "@FIREBIRD_ARCH_TYPE@" = "classic" ]; then + addLibs $BuildRootDir/gen/firebird/bin changeMultiConnectMode.sh ${TargetDir}@FB_SBINDIR@ + chmod 0700 ${TargetDir}@FB_SBINDIR@/*.sh + fi + #install scripts addLibs $BuildRootDir/gen/firebird/bin tarMainInstall.sh $BuildRootDir/gen/install/scripts addLibs $BuildRootDir/gen/firebird/bin tarinstall.sh $BuildRootDir/gen/install/scripts @@ -296,13 +298,15 @@ cp $BuildRootDir/src/misc/upgrade/v2/security_database* ${TargetDir}@FB_MISCDIR@/upgrade/security cp $BuildRootDir/src/misc/upgrade/v2.1/metadata_charset* ${TargetDir}@FB_MISCDIR@/upgrade/metadata + cp $BuildRootDir/gen/install/misc/firebird_daemon_startup_script ${TargetDir}@FB_MISCDIR@ + chown -R root:wheel ${TargetDir}@FB_MISCDIR@ chmod -R go-rwx ${TargetDir}@FB_MISCDIR@ #conf - cp $BuildRootDir/gen/install/misc/firebird.conf ${TargetDir}@FB_CONFDIR@ - cp $BuildRootDir/gen/install/misc/aliases.conf ${TargetDir}@FB_CONFDIR@ - cp $BuildRootDir/gen/install/misc/fbtrace.conf ${TargetDir}@FB_CONFDIR@ + cp $BuildRootDir/gen/install/misc/firebird.conf ${TargetDir}@FB_CONFDIR@ + cp $BuildRootDir/gen/install/misc/aliases.conf ${TargetDir}@FB_CONFDIR@ + cp $BuildRootDir/gen/install/misc/fbtrace.conf ${TargetDir}@FB_CONFDIR@ chown root:wheel ${TargetDir}@FB_CONFDIR@/*.conf chmod 0644 ${TargetDir}@FB_CONFDIR@/*.conf @@ -423,30 +427,56 @@ fixFilePermissions -# remove any existing gds service +# remove any existing gds services cp /etc/services /etc/services.old cp /etc/inetd.conf /etc/inetd.conf.old cat /etc/services |grep -v @FB_SERVICE_NAME@ >/etc/services.new cat /etc/inetd.conf |grep -v @FB_SERVICE_NAME@ >/etc/inetd.conf.new mv /etc/services.new /etc/services mv /etc/inetd.conf.new /etc/inetd.conf +rm -f /etc/rc.d/*firebird* -# add the gds service and restart inetd -cat >>/etc/services <<EOF +# shared lib and lock dir startup script +if [ -d /etc/rc.d ]; then + cat > /etc/rc.d/000.firebird.sh <<EOC +#!/bin/sh +[ -d @FB_LIBDIR@ ] && /sbin/ldconfig -m @FB_LIBDIR@ +[ -d /tmp/firebird ] || (rm -f /tmp/firebird; mkdir /tmp/firebird) +chown -R firebird:firebird /tmp/firebird +chmod -R 0660 /tmp/firebird +chmod 0770 /tmp/firebird +EOC + chmod a=rx /etc/rc.d/000.firebird.sh + . /etc/rc.d/000.firebird.sh +fi + +# add the gds service +if [ "@FIREBIRD_ARCH_TYPE@" = "classic" ]; then + cat >>/etc/services <<EOF @FB_SERVICE_NAME@ @FB_SERVICE_PORT@/tcp #Firebird Database Remote Protocol EOF -cat >>/etc/inetd.conf <<EOF + + cat >>/etc/inetd.conf <<EOF @FB_SERVICE_NAME@ stream tcp nowait firebird ${TargetDir}@FB_SBINDIR@/fb_inet_server fb_inet_server EOF + +fi + +# reset make env +FIREBIRD_LOCK= +export FIREBIRD_LOCK + +# restart inetd if [ -f /var/run/inetd.pid ]; then - kill -HUP `cat /var/run/inetd.pid` + kill -HUP `cat /var/run/inetd.pid` + sleep 1 # Give it time to reload fi -# shared lib startup script -if [ -d /etc/rc.d ]; then - ( - echo "#!/bin/sh"; echo "[ -d @FB_LIBDIR@ ] && /sbin/ldconfig -m @FB_LIBDIR@" - ) > /etc/rc.d/000.firebird.sh - chmod a=rx /etc/rc.d/000.firebird.sh +# add firebird startup script +if [ "@FIREBIRD_ARCH_TYPE@" = "super" ]; then + initScript=/etc/rc.d/firebird + rm -f $initScript + cp @FB_MISCDIR@/firebird_daemon_startup_script $initScript + chmod a=rx $initScript + $initScript start fi - Modified: firebird/branches/B2_5_Release/builds/install/arch-specific/linux/misc/linuxLibrary.sh.in =================================================================== --- firebird/branches/B2_5_Release/builds/install/arch-specific/linux/misc/linuxLibrary.sh.in 2011-06-03 08:25:04 UTC (rev 53097) +++ firebird/branches/B2_5_Release/builds/install/arch-specific/linux/misc/linuxLibrary.sh.in 2011-06-03 09:52:28 UTC (rev 53098) @@ -32,7 +32,7 @@ #------------------------------------------------------------------------ # Get correct options & misc. -psOptions=aww +psOptions=-efaww export psOptions mktOptions=-q export mktOptions Modified: firebird/branches/B2_5_Release/builds/install/misc/changeMultiConnectMode.sh.in =================================================================== --- firebird/branches/B2_5_Release/builds/install/misc/changeMultiConnectMode.sh.in 2011-06-03 08:25:04 UTC (rev 53097) +++ firebird/branches/B2_5_Release/builds/install/misc/changeMultiConnectMode.sh.in 2011-06-03 09:52:28 UTC (rev 53098) @@ -52,7 +52,7 @@ removeServiceAutostart echo "Starting firebird in multi$multiAnswer mode..." -if [ $multiAnswer == process ]; then +if [ $multiAnswer = process ]; then updateInetdServiceEntry resetInetdServer else Modified: firebird/branches/B2_5_Release/builds/install/misc/posixLibrary.sh.in =================================================================== --- firebird/branches/B2_5_Release/builds/install/misc/posixLibrary.sh.in 2011-06-03 08:25:04 UTC (rev 53097) +++ firebird/branches/B2_5_Release/builds/install/misc/posixLibrary.sh.in 2011-06-03 09:52:28 UTC (rev 53098) @@ -148,7 +148,7 @@ # Works for both inetd and xinetd resetInetdServer() { - pid=`ps -eaf$psOptions | grep inetd | grep -v grep | awk '{print $2}'` + pid=`ps $psOptions | grep inetd | grep -v grep | awk '{print $2}'` if [ "$pid" ] then kill -HUP $pid @@ -202,7 +202,7 @@ checkIfServerRunning() { - checkString=`ps -ef$psOptions | egrep "\b(fbserver|fbguard|fb_smp_server)\b" |grep -v grep` + checkString=`ps $psOptions | egrep "\b(fbserver|fbguard|fb_smp_server)\b" |grep -v grep` if [ ! -z "$checkString" ] then serverMode=super @@ -217,7 +217,7 @@ # Check is server is being actively used. - checkString=`ps -ef$psOptions | egrep "\b(fb_smp_server)\b" |grep -v grep` + checkString=`ps $psOptions | egrep "\b(fb_smp_server)\b" |grep -v grep` if [ ! -z "$checkString" ] then echo "An instance of the Firebird SuperClassic server seems to be running." @@ -225,7 +225,7 @@ exit 1 fi - checkString=`ps -ef$psOptions | egrep "\b(fbserver|fbguard)\b" |grep -v grep` + checkString=`ps $psOptions | egrep "\b(fbserver|fbguard)\b" |grep -v grep` if [ ! -z "$checkString" ] then echo "An instance of the Firebird Super server seems to be running." @@ -233,7 +233,7 @@ exit 1 fi - checkString=`ps -ef$psOptions | egrep "\b(fb_inet_server|fb_smp_server|gds_pipe)\b" |grep -v grep` + checkString=`ps $psOptions | egrep "\b(fb_inet_server|fb_smp_server|gds_pipe)\b" |grep -v grep` if [ ! -z "$checkString" ] then echo "An instance of the Firebird Classic server seems to be running." @@ -244,7 +244,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=`ps $psOptions | egrep "\b(ibserver|ibguard)\b" |grep -v grep` if [ ! -z "$checkString" ] then echo "An instance of the Firebird/InterBase Super server seems to be running." @@ -253,7 +253,7 @@ exit 1 fi - checkString=`ps -ef$psOptions | egrep "\b(gds_inet_server|gds_pipe)\b" |grep -v grep` + checkString=`ps $psOptions | egrep "\b(gds_inet_server|gds_pipe)\b" |grep -v grep` if [ ! -z "$checkString" ] then echo "An instance of the Firebird/InterBase Classic server seems to be running." Modified: firebird/branches/B2_5_Release/configure.in =================================================================== --- firebird/branches/B2_5_Release/configure.in 2011-06-03 08:25:04 UTC (rev 53097) +++ firebird/branches/B2_5_Release/configure.in 2011-06-03 09:52:28 UTC (rev 53098) @@ -1330,6 +1330,7 @@ ;; FREEBSD) AC_CONFIG_FILES([gen/install/install.sh:builds/install/arch-specific/freebsd/install.sh.in + gen/install/misc/firebird_daemon_startup_script:builds/install/arch-specific/freebsd/firebird_daemon_startup_script.in gen/firebird/bin/freebsdLibrary.sh:builds/install/arch-specific/freebsd/freebsdLibrary.sh.in] ,[chmod a+x gen/install/*.sh gen/firebird/bin/*sh 2>/dev/null]) ;; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |