[fedmsg] systemctl scripts.

Ralph Bean ralph at fedoraproject.org
Sun Jun 10 05:16:04 UTC 2012


commit 94b0ff377d999818978b98e9656e4fd0d8a93ca7
Author: Ralph Bean <rbean at redhat.com>
Date:   Sun Jun 10 01:15:37 2012 -0400

    systemctl scripts.

 .gitignore  |    1 +
 fedmsg.spec |  110 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
 sources     |    2 +-
 3 files changed, 100 insertions(+), 13 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index c3d4fb7..2d73ba9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@
 /fedmsg-0.1.6.tar.gz
 /fedmsg-0.1.7.tar.gz
 /fedmsg-0.1.8.tar.gz
+/fedmsg-0.2.0.tar.gz
diff --git a/fedmsg.spec b/fedmsg.spec
index ff91a13..08cbaf8 100644
--- a/fedmsg.spec
+++ b/fedmsg.spec
@@ -4,8 +4,8 @@
 %global modname fedmsg
 
 Name:           fedmsg
-Version:        0.1.8
-Release:        1%{?dist}
+Version:        0.2.0
+Release:        2%{?dist}
 Summary:        Tools for Fedora Infrastructure real-time messaging
 Group:          Applications/Internet
 License:        LGPLv2+
@@ -20,6 +20,7 @@ BuildRequires:  moksha >= 0.8.1
 BuildRequires:  python-bunch
 BuildRequires:  orbited
 BuildRequires:  python-nose
+BuildRequires:  python-daemon
 
 %if %{?rhel}%{!?rhel:0} >= 6
 
@@ -31,14 +32,37 @@ Requires:       moksha >= 0.8.1
 Requires:       python-fabulous
 Requires:       python-simplejson
 Requires:       python-zmq
-
+Requires:       python-daemon
 
 %description
-Utilities used around Fedora Infrastructure to send and receive messages with
-zeromq.  Includes:
+Python API used around Fedora Infrastructure to send and receive messages with
+zeromq.  Includes some CLI tools.
+
+
+%package hub
+Summary: The FedMsg Hub
+Group: Applications/Internet
+Requires: %{name} = %{version}-%{release}
+
+%description hub
+This package contains configuration and init scripts for the FedMsg hub.
+
+%package relay
+Summary: The FedMsg Relay
+Group: Applications/Internet
+Requires: %{name} = %{version}-%{release}
+
+%description relay
+This package contains configuration and init scripts for the FedMsg relay.
+
+%package irc
+Summary: The FedMsg IRC Bot
+Group: Applications/Internet
+Requires: %{name} = %{version}-%{release}
+
+%description irc
+This package contains configuration and init scripts for the FedMsg IRC bot.
 
- - A python API
- - A suite of CLI tools
 
 %prep
 %setup -q -n %{modname}-%{version}
@@ -51,23 +75,85 @@ zeromq.  Includes:
     --install-data=%{_datadir} --root %{buildroot}
 
 %{__mkdir_p} %{buildroot}%{_sysconfdir}/fedmsg.d/
-%{__cp} fedmsg.d/* %{buildroot}%{_sysconfdir}/fedmsg.d/.
+%{__cp} fedmsg.d/*.py %{buildroot}%{_sysconfdir}/fedmsg.d/.
+
+%{__install} -d -m 0755 %{buildroot}/var/run/%{modname}
+%{__install} -d -m 0755 %{buildroot}/var/log/%{modname}
+
+%{__mkdir_p} %{buildroot}%{_sysconfdir}/init.d
+%{__install} init.d/fedmsg-hub.init %{buildroot}%{_sysconfdir}/init.d/fedmsg-hub
+%{__install} init.d/fedmsg-relay.init %{buildroot}%{_sysconfdir}/init.d/fedmsg-relay
+%{__install} init.d/fedmsg-irc.init %{buildroot}%{_sysconfdir}/init.d/fedmsg-irc
+
+
+%pre
+%{_sbindir}/groupadd -r %{modname} &>/dev/null || :
+%{_sbindir}/useradd  -r -s /sbin/nologin -d %{_datadir}/%{modname} -M \
+                     -c 'FedMsg' -g %{modname} %{modname} &>/dev/null || :
+
+
+%post hub
+/sbin/chkconfig --add fedmsg-hub
+
+%post relay
+/sbin/chkconfig --add fedmsg-relay
+
+%post irc
+/sbin/chkconfig --add fedmsg-irc
+
+
+%preun hub
+if [ $1 -eq 0 ]; then
+    /sbin/service fedmsg-hub stop >/dev/null 2>&1
+    /sbin/chkconfig --del fedmsg-hub
+fi
+
+%preun relay
+if [ $1 -eq 0 ]; then
+    /sbin/service fedmsg-relay stop >/dev/null 2>&1
+    /sbin/chkconfig --del fedmsg-relay
+fi
+
+%preun irc
+if [ $1 -eq 0 ]; then
+    /sbin/service fedmsg-irc stop >/dev/null 2>&1
+    /sbin/chkconfig --del fedmsg-irc
+fi
+
 
 %files
 %doc doc/ README.rst LICENSE
 %{_bindir}/fedmsg-logger
 %{_bindir}/fedmsg-status
 %{_bindir}/fedmsg-tail
-%{_bindir}/fedmsg-hub
-%{_bindir}/fedmsg-relay
 %{_bindir}/fedmsg-config
-%{_bindir}/fedmsg-irc
+
+%ghost %attr(755, %{modname}, %{modname}) %dir %{_var}/log/%{modname}
+%ghost %attr(755, %{modname}, %{modname}) %dir %{_var}/run/%{modname}
 
 %{python_sitelib}/%{modname}/
 %{python_sitelib}/%{modname}-%{version}-py%{pyver}.egg-info/
-%config(noreplace) %{_sysconfdir}/fedmsg.d/*
+
+%config(noreplace) %{_sysconfdir}/fedmsg.d
+
+
+%files hub
+%{_bindir}/fedmsg-hub
+%{_sysconfdir}/init.d/fedmsg-hub
+
+%files relay
+%{_bindir}/fedmsg-relay
+%{_sysconfdir}/init.d/fedmsg-relay
+
+%files irc
+%{_bindir}/fedmsg-irc
+%{_sysconfdir}/init.d/fedmsg-irc
+
 
 %changelog
+* Sat Jun 09 2012 Ralph Bean <rbean at redhat.com> - 0.2.0-2
+- Split package into different daemonizable components.
+
 * Thu Jun 07 2012 Ralph Bean <rbean at redhat.com> - 0.1.8-1
 - Split config up into /etc/fedmsg.d/
 - Removed tests.
diff --git a/sources b/sources
index 5986fa2..7edcec8 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-1561018297fdc6624a0d0f1d8961dc20  fedmsg-0.1.8.tar.gz
+7c2ad1838f054287b92c17c3aa5328f5  fedmsg-0.2.0.tar.gz


More information about the scm-commits mailing list