diff options
author | Hubert Plociniczak <hubert@lshift.net> | 2008-08-19 15:26:11 +0100 |
---|---|---|
committer | Hubert Plociniczak <hubert@lshift.net> | 2008-08-19 15:26:11 +0100 |
commit | b96ea77fb2e2993ba53368021a5f6f1434cc16d3 (patch) | |
tree | 1b4d033391836ac0be0e6ae730b14688884ffb74 | |
parent | 88dd39bb9d1074d1c20946e00ae9cc3b032f7d61 (diff) | |
parent | 6641d07f5f867847c80521c22d2c080bebab759b (diff) | |
download | rabbitmq-server-b96ea77fb2e2993ba53368021a5f6f1434cc16d3.tar.gz |
Merge bug19200 into bug19193
-rw-r--r-- | packaging/RPMS/Fedora/Makefile | 1 | ||||
-rw-r--r-- | packaging/RPMS/Fedora/init.d | 73 | ||||
-rw-r--r-- | packaging/RPMS/Fedora/rabbitmq-server.logrotate | 13 | ||||
-rw-r--r-- | packaging/RPMS/Fedora/rabbitmq-server.spec | 126 | ||||
-rw-r--r-- | packaging/debs/Debian/debian/control | 2 | ||||
-rw-r--r-- | packaging/debs/Debian/debian/dirs | 1 | ||||
-rw-r--r-- | packaging/debs/Debian/debian/init.d | 10 | ||||
-rw-r--r-- | packaging/debs/Debian/debian/rabbitmq-server.logrotate | 13 | ||||
-rw-r--r-- | packaging/debs/Debian/debian/rules | 1 |
9 files changed, 145 insertions, 95 deletions
diff --git a/packaging/RPMS/Fedora/Makefile b/packaging/RPMS/Fedora/Makefile index c8e979a7..6cc3579b 100644 --- a/packaging/RPMS/Fedora/Makefile +++ b/packaging/RPMS/Fedora/Makefile @@ -21,6 +21,7 @@ prepare: cp $(TOP_DIR)/rabbitmq-server.spec $(TOP_DIR)/SPECS cp $(TOP_DIR)/init.d $(TOP_DIR)/BUILD cp $(TOP_DIR)/rabbitmqctl_wrapper $(TOP_DIR)/BUILD + cp $(TOP_DIR)/rabbitmq-server.logrotate $(TOP_DIR)/BUILD server: prepare rpmbuild -ba $(TOP_DIR)/SPECS/rabbitmq-server.spec $(DEFINES) --target noarch diff --git a/packaging/RPMS/Fedora/init.d b/packaging/RPMS/Fedora/init.d index 09ca02c9..a7e6b98c 100644 --- a/packaging/RPMS/Fedora/init.d +++ b/packaging/RPMS/Fedora/init.d @@ -1,57 +1,87 @@ #!/bin/sh +# +# rabbitmq-server RabbitMQ broker +# +#chkconfig: 2345 80 05 +#description: Enable AMQP service provided by RabbitMQ +# + ### BEGIN INIT INFO # Provides: rabbitmq # Required-Start: $remote_fs $network # Required-Stop: $remote_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 +# Description: RabbitMQ broker +# Short-Description: Enable AMQP service provided by RabbitMQ broker ### END INIT INFO -#chkconfig: 2345 80 05 -#description: RabbitMQ Server - PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -DAEMON=/usr/sbin/rabbitmq-multi +DAEMON_NAME=rabbitmq-multi +DAEMON=/usr/sbin/$DAEMON_NAME NAME=rabbitmq-server DESC=rabbitmq-server USER=rabbitmq NODE_COUNT=1 +LOCK_FILE=/var/lock/subsys/$NAME + test -x $DAEMON || exit 0 +# source function library +. /etc/rc.d/init.d/functions + # Include rabbitmq defaults if available if [ -f /etc/default/rabbitmq ] ; then . /etc/default/rabbitmq fi +RETVAL=0 set -e cd / start_rabbitmq () { set +e - su rabbitmq -s /bin/sh -c "$DAEMON start_all ${NODE_COUNT}" > /var/log/rabbitmq/startup.log 2> /var/log/rabbitmq/startup.err + su $USER -s /bin/sh -c "$DAEMON start_all ${NODE_COUNT}" > /var/log/rabbitmq/startup.log 2> /var/log/rabbitmq/startup.err case "$?" in 0) - echo SUCCESS;; + echo SUCCESS && touch $LOCK_FILE + ;; 1) - echo TIMEOUT - check /var/log/rabbitmq/startup.\{log,err\};; + echo TIMEOUT - check /var/log/rabbitmq/startup.\{log,err\} + ;; *) echo FAILED - check /var/log/rabbitmq/startup.log, .err - exit 1;; + RETVAL=1;; esac set -e } stop_rabbitmq () { set +e - su rabbitmq -s /bin/sh -c "$DAEMON stop_all" > /var/log/rabbitmq/shutdown.log 2> /var/log/rabbitmq/shutdown.err + su $USER -s /bin/sh -c "$DAEMON stop_all" > /var/log/rabbitmq/shutdown.log 2> /var/log/rabbitmq/shutdown.err + if [ $? != 0 ] ; then echo FAILED - check /var/log/rabbitmq/shutdown.log, .err - exit 0 + RETVAL=$? + else + rm -rf $LOCK_FILE + RETVAL=0 fi set -e } +status_rabbitmq () { + status $NAME +} + +restart_rabbitmq () { + echo -n "Restarting $DESC: " + stop_rabbitmq + start_rabbitmq + echo "$NAME." +} + case "$1" in start) echo -n "Starting $DESC: " @@ -63,17 +93,22 @@ case "$1" in stop_rabbitmq echo "$NAME." ;; - force-reload|restart) - echo -n "Restarting $DESC: " - stop_rabbitmq - start_rabbitmq - echo "$NAME." + force-reload|reload|restart) + restart_rabbitmq + ;; + status) + echo "Status of $DESC: " + status_rabbitmq + RETVAL=$? ;; + condrestart|try-restart) + status_rabbitmq >/dev/null 2>&1 || exit 0 + restart_rabbitmq + ;; *) - N=/etc/init.d/$NAME - echo "Usage: $N {start|stop|restart|force-reload}" >&2 - exit 1 + echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" >&2 + RETVAL=1 ;; esac -exit 0 +exit $RETVAL diff --git a/packaging/RPMS/Fedora/rabbitmq-server.logrotate b/packaging/RPMS/Fedora/rabbitmq-server.logrotate new file mode 100644 index 00000000..e366f36a --- /dev/null +++ b/packaging/RPMS/Fedora/rabbitmq-server.logrotate @@ -0,0 +1,13 @@ +/var/log/rabbitmq/*.log /var/log/rabbitmq/*.err { + weekly + missingok + rotate 10 + compress + delaycompress + notifempty + create 644 rabbitmq rabbitmq + sharedscripts + postrotate + /usr/sbin/rabbitmqctl reopen_logs + endscript +}
\ No newline at end of file diff --git a/packaging/RPMS/Fedora/rabbitmq-server.spec b/packaging/RPMS/Fedora/rabbitmq-server.spec index 25213816..4e39012c 100644 --- a/packaging/RPMS/Fedora/rabbitmq-server.spec +++ b/packaging/RPMS/Fedora/rabbitmq-server.spec @@ -1,75 +1,68 @@ -%define source_name rabbitmq-server - Name: rabbitmq-server Version: %{rpm_version} Release: 1 -License: Mozilla Public License +License: MPLv1.1 Group: Development/Libraries -Source: http://www.rabbitmq.com/releases/%{source_name}-%{main_version}.tar.gz +Source: http://www.rabbitmq.com/releases/rabbitmq-server/v%{main_version}/%{name}-%{main_version}.tar.gz URL: http://www.rabbitmq.com/ Vendor: LShift Ltd., Cohesive Financial Technologies LLC., Rabbit Technlogies Ltd. -Requires: erlang +Requires: erlang, logrotate Packager: Hubert Plociniczak <hubert@lshift.net> BuildRoot: %{_tmppath}/%{name}-%{main_version}-%{release}-root Summary: The RabbitMQ server +Requires(post): chkconfig +Requires(pre): chkconfig initscripts %description RabbitMQ is an implementation of AMQP, the emerging standard for high performance enterprise messaging. The RabbitMQ server is a robust and scalable implementation of an AMQP broker. -%define _libdir /usr/lib/erlang -%define _docdir /usr/share/doc + %define _mandir /usr/share/man -%define _maindir $RPM_BUILD_ROOT%{_libdir}/lib/rabbitmq_server-%{main_version} -%define package_name rabbitmq-server-dist +%define _sbindir /usr/sbin +%define _libdir %(erl -noshell -eval "io:format('~s~n', [code:lib_dir()]), halt().") +%define _maindir %{buildroot}%{_libdir}/rabbitmq_server-%{main_version} + %pre if [ $1 -gt 1 ]; then - #Upgrade - stop and remove previous instance of rabbitmq init.d script - /etc/init.d/rabbitmq-server stop + #Upgrade - stop and remove previous instance of rabbitmq-server init.d script + /sbin/service rabbitmq-server stop /sbin/chkconfig --del rabbitmq-server fi %prep -%setup -n %{source_name}-%{main_version} +%setup -n %{name}-%{main_version} %build -mkdir %{package_name} -mkdir %{package_name}/sbin -mkdir %{package_name}/man -make install TARGET_DIR=`pwd`/%{package_name} \ - SBIN_DIR=`pwd`/%{package_name}/sbin \ - MAN_DIR=`pwd`/%{package_name}/man - VERSION=%{main_version} +make %install -mkdir -p %{_maindir} -mkdir -p $RPM_BUILD_ROOT%{_docdir}/rabbitmq-server -mkdir -p $RPM_BUILD_ROOT/etc/init.d -mkdir -p $RPM_BUILD_ROOT/usr/sbin -mkdir -p $RPM_BUILD_ROOT%{_mandir} +rm -rf %{buildroot} -mkdir -p $RPM_BUILD_ROOT/var/lib/rabbitmq/mnesia -mkdir -p $RPM_BUILD_ROOT/var/log/rabbitmq +make install TARGET_DIR=%{_maindir} \ + SBIN_DIR=%{buildroot}%{_sbindir} \ + MAN_DIR=%{buildroot}%{_mandir} + VERSION=%{main_version} -#Copy all necessary lib files etc. -cp -r %{package_name}/ebin %{_maindir} -cp -r %{package_name}/src %{_maindir} -cp -r %{package_name}/include %{_maindir} -chmod 755 %{package_name}/sbin/* -cp %{package_name}/sbin/* $RPM_BUILD_ROOT/usr/sbin/ -cp -r %{package_name}/man/* $RPM_BUILD_ROOT%{_mandir}/ +mkdir -p %{buildroot}/var/lib/rabbitmq/mnesia +mkdir -p %{buildroot}/var/log/rabbitmq +mkdir -p %{buildroot}/etc/rc.d/init.d/ -cp ../init.d $RPM_BUILD_ROOT/etc/init.d/rabbitmq-server -chmod 775 $RPM_BUILD_ROOT/etc/init.d/rabbitmq-server +#Copy all necessary lib files etc. +cp ../init.d %{buildroot}/etc/rc.d/init.d/rabbitmq-server +chmod 0755 %{buildroot}/etc/rc.d/init.d/rabbitmq-server -mv $RPM_BUILD_ROOT/usr/sbin/rabbitmqctl $RPM_BUILD_ROOT/usr/sbin/rabbitmqctl_real -cp ../rabbitmqctl_wrapper $RPM_BUILD_ROOT/usr/sbin/rabbitmqctl -chmod 755 $RPM_BUILD_ROOT/usr/sbin/rabbitmqctl +mv %{buildroot}/usr/sbin/rabbitmqctl %{buildroot}/usr/sbin/rabbitmqctl_real +cp ../rabbitmqctl_wrapper %{buildroot}/usr/sbin/rabbitmqctl +chmod 0755 %{buildroot}/usr/sbin/rabbitmqctl cp %{buildroot}%{_mandir}/man1/rabbitmqctl.1.gz %{buildroot}%{_mandir}/man1/rabbitmqctl_real.1.gz +mkdir -p %{buildroot}/etc/logrotate.d +cp ../rabbitmq-server.logrotate %{buildroot}/etc/logrotate.d/rabbitmq-server + %post # create rabbitmq group if ! getent group rabbitmq >/dev/null; then @@ -82,65 +75,58 @@ if ! getent passwd rabbitmq >/dev/null; then usermod -c "Rabbit AMQP Messaging Server" rabbitmq fi -# On 64bit /usr/lib64 contains Erlang, not /usr/lib. Fix with a symlink -ERL_LIB_DIR=$(erl -noshell -eval "io:format(\"~s~n\", [code:lib_dir()]), halt().") -if [ ! ${ERL_LIB_DIR} = "/usr/lib/erlang/lib" ] ; then - ln -s /usr/lib/erlang/lib/rabbitmq_server-%{main_version} ${ERL_LIB_DIR} -fi - chown -R rabbitmq:rabbitmq /var/lib/rabbitmq chown -R rabbitmq:rabbitmq /var/log/rabbitmq -/sbin/chkconfig --add rabbitmq-server -/etc/init.d/rabbitmq-server start +/sbin/chkconfig --add %{name} %preun if [ $1 = 0 ]; then #Complete uninstall - /etc/init.d/rabbitmq-server stop + /sbin/service rabbitmq-server stop > /dev/null 2>&1 /sbin/chkconfig --del rabbitmq-server - - # Remove symlink we added above - ERL_LIB_DIR=$(erl -noshell -eval "io:format(\"~s~n\", [code:lib_dir()]), halt().") - if [ ! ${ERL_LIB_DIR} = "/usr/lib/erlang/lib" ] ; then - rm ${ERL_LIB_DIR}/rabbitmq_server-%{main_version} - fi - # We do not remove log and lib directories + # We do not remove /var/log and /var/lib directories # Leave rabbitmq user and group fi %files -%defattr(-,root,root) -%{_libdir}/lib/rabbitmq_server-%{main_version}/ -%{_docdir}/rabbitmq-server/ -%{_mandir} -/usr/sbin -/var/lib/rabbitmq -/var/log/rabbitmq -/etc/init.d/rabbitmq-server +%defattr(-,root,root,-) +%{_libdir}/rabbitmq_server-%{main_version}/ +%{_mandir}/man1/rabbitmq-multi.1.gz +%{_mandir}/man1/rabbitmq-server.1.gz +%{_mandir}/man1/rabbitmqctl.1.gz +%{_mandir}/man1/rabbitmqctl_real.1.gz +%{_sbindir}/rabbitmq-multi +%{_sbindir}/rabbitmq-server +%{_sbindir}/rabbitmqctl +%{_sbindir}/rabbitmqctl_real +/var/lib/rabbitmq/ +/var/log/rabbitmq/ +/etc/rc.d/init.d/rabbitmq-server +%config(noreplace) /etc/logrotate.d/rabbitmq-server %clean -rm -rf $RPM_BUILD_ROOT +rm -rf %{buildroot} %changelog -* Thu Jul 24 2008 Tony Garnock-Jones <tonyg@lshift.net> 1.4.0 +* Thu Jul 24 2008 Tony Garnock-Jones <tonyg@lshift.net> 1.4.0-1 - New upstream release -* Mon Mar 3 2008 Adrien Pierard <adrian@lshift.net> 1.3.0 +* Mon Mar 3 2008 Adrien Pierard <adrian@lshift.net> 1.3.0-1 - New upstream release -* Wed Sep 26 2007 Simon MacMullen <simon@lshift.net> 1.2.0 +* Wed Sep 26 2007 Simon MacMullen <simon@lshift.net> 1.2.0-1 - New upstream release -* Wed Aug 29 2007 Simon MacMullen <simon@lshift.net> 1.1.1 +* Wed Aug 29 2007 Simon MacMullen <simon@lshift.net> 1.1.1-1 - New upstream release -* Mon Jul 30 2007 Simon MacMullen <simon@lshift.net> 1.1.0-alpha +* Mon Jul 30 2007 Simon MacMullen <simon@lshift.net> 1.1.0-1.alpha - New upstream release -* Tue Jun 12 2007 Hubert Plociniczak <hubert@lshift.net> hubert-20070607 +* Tue Jun 12 2007 Hubert Plociniczak <hubert@lshift.net> 1.0.0-1.20070607 - Building from source tarball, added starting script, stopping -* Mon May 21 2007 Hubert Plociniczak <hubert@lshift.net> 1.0.0-alpha +* Mon May 21 2007 Hubert Plociniczak <hubert@lshift.net> 1.0.0-1.alpha - Initial build of server library of RabbitMQ package diff --git a/packaging/debs/Debian/debian/control b/packaging/debs/Debian/debian/control index df9a330b..bc691bc7 100644 --- a/packaging/debs/Debian/debian/control +++ b/packaging/debs/Debian/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.7.2 Package: rabbitmq-server Architecture: all -Depends: erlang-nox, adduser +Depends: erlang-nox, adduser, logrotate Description: An AMQP server written in Erlang RabbitMQ is an implementation of AMQP, the emerging standard for high performance enterprise messaging. The RabbitMQ server is a robust and diff --git a/packaging/debs/Debian/debian/dirs b/packaging/debs/Debian/debian/dirs index 0b3f55b9..74f86314 100644 --- a/packaging/debs/Debian/debian/dirs +++ b/packaging/debs/Debian/debian/dirs @@ -3,4 +3,5 @@ usr/sbin usr/share/man var/lib/rabbitmq/mnesia var/log/rabbitmq +etc/logrotate.d diff --git a/packaging/debs/Debian/debian/init.d b/packaging/debs/Debian/debian/init.d index f3999888..ae82dd5c 100644 --- a/packaging/debs/Debian/debian/init.d +++ b/packaging/debs/Debian/debian/init.d @@ -5,7 +5,8 @@ # Required-Stop: $remote_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 -# Short-Description: Enable AMQP service provided by RabbitMQ. +# Description: RabbitMQ broker +# Short-Description: Enable AMQP service provided by RabbitMQ broker ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin @@ -27,7 +28,7 @@ cd / start_rabbitmq () { set +e - su rabbitmq -s /bin/sh -c "$DAEMON start_all ${NODE_COUNT}" > /var/log/rabbitmq/startup.log 2> /var/log/rabbitmq/startup.err + su $USER -s /bin/sh -c "$DAEMON start_all ${NODE_COUNT}" > /var/log/rabbitmq/startup.log 2> /var/log/rabbitmq/startup.err case "$?" in 0) echo SUCCESS;; @@ -42,7 +43,7 @@ start_rabbitmq () { stop_rabbitmq () { set +e - su rabbitmq -s /bin/sh -c "$DAEMON stop_all" > /var/log/rabbitmq/shutdown.log 2> /var/log/rabbitmq/shutdown.err + su $USER -s /bin/sh -c "$DAEMON stop_all" > /var/log/rabbitmq/shutdown.log 2> /var/log/rabbitmq/shutdown.err if [ $? != 0 ] ; then echo FAILED - check /var/log/rabbitmq/shutdown.log, .err exit 0 @@ -68,8 +69,7 @@ case "$1" in echo "$NAME." ;; *) - N=/etc/init.d/$NAME - echo "Usage: $N {start|stop|restart|force-reload}" >&2 + echo "Usage: $0 {start|stop|restart|force-reload}" >&2 exit 1 ;; esac diff --git a/packaging/debs/Debian/debian/rabbitmq-server.logrotate b/packaging/debs/Debian/debian/rabbitmq-server.logrotate new file mode 100644 index 00000000..e366f36a --- /dev/null +++ b/packaging/debs/Debian/debian/rabbitmq-server.logrotate @@ -0,0 +1,13 @@ +/var/log/rabbitmq/*.log /var/log/rabbitmq/*.err { + weekly + missingok + rotate 10 + compress + delaycompress + notifempty + create 644 rabbitmq rabbitmq + sharedscripts + postrotate + /usr/sbin/rabbitmqctl reopen_logs + endscript +}
\ No newline at end of file diff --git a/packaging/debs/Debian/debian/rules b/packaging/debs/Debian/debian/rules index 6edf27c1..39af711c 100644 --- a/packaging/debs/Debian/debian/rules +++ b/packaging/debs/Debian/debian/rules @@ -14,5 +14,6 @@ install/rabbitmq-server:: rm $(RABBIT_LIB)/LICENSE* mv $(DEB_DESTDIR)usr/sbin/rabbitmqctl $(DEB_DESTDIR)usr/sbin/rabbitmqctl_real cp debian/rabbitmqctl_wrapper $(DEB_DESTDIR)usr/sbin/rabbitmqctl + cp debian/rabbitmq-server.logrotate $(DEB_DESTDIR)etc/logrotate.d/rabbitmq-server cp $(DEB_DESTDIR)usr/share/man/man1/rabbitmqctl.1.gz $(DEB_DESTDIR)usr/share/man/man1/rabbitmqctl_real.1.gz chmod a+x $(DEB_DESTDIR)usr/sbin/rabbitmqctl |