[honeyd] Migrate to systemd.
Jon Ciesla
limb at fedoraproject.org
Wed Apr 18 17:47:09 UTC 2012
commit c25d0dec56787c3bff5d8b78cb172d29b174b585
Author: Jon Ciesla <limburgher at gmail.com>
Date: Wed Apr 18 12:47:00 2012 -0500
Migrate to systemd.
farpd.service | 11 +++++++++++
honeyd.service | 10 ++++++++++
honeyd.spec | 56 ++++++++++++++++++++++++++++++++++++++++++++++----------
3 files changed, 67 insertions(+), 10 deletions(-)
---
diff --git a/farpd.service b/farpd.service
new file mode 100644
index 0000000..79ab3ab
--- /dev/null
+++ b/farpd.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Farpd ARP Reply Daemon
+After=network.target
+
+[Service]
+Type=forking
+ExecStart=/usr/sbin/farpd -i eth0 10.0.0.0/8
+KillSignal=SIGHUP
+
+[Install]
+WantedBy=multi-user.target
diff --git a/honeyd.service b/honeyd.service
new file mode 100644
index 0000000..104e7f0
--- /dev/null
+++ b/honeyd.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Honeyd Daemon
+After=network.target
+
+[Service]
+Type=forking
+ExecStart=/usr/bin/honeyd -f /etc/honeyd.conf -i eth0 -l /var/log/honeyd.log
+
+[Install]
+WantedBy=multi-user.target
diff --git a/honeyd.spec b/honeyd.spec
index 8aeb5c6..5483e8e 100644
--- a/honeyd.spec
+++ b/honeyd.spec
@@ -1,17 +1,18 @@
Summary: Honeypot daemon
Name: honeyd
Version: 1.5c
-Release: 16%{?dist}
+Release: 17%{?dist}
License: GPLv2+ and BSD
Group: Applications/Internet
URL: http://www.honeyd.org/
Source0: http://www.citi.umich.edu/u/provos/honeyd/honeyd-%{version}.tar.gz
Source1: http://www.citi.umich.edu/u/provos/honeyd/arpd-0.2.tar.gz
-Source2: honeyd.initscript
+Source2: honeyd.service
Source3: honeyd.conf
Source4: honeyd.sysconfig
Source5: farpd.sysconfig
Source6: README.fedora
+Source7: farpd.service
Patch1: honeyd-1.5c-gcc.patch
Patch2: honeyd-1.5c-pidFile.patch
Patch3: honeyd-1.5c-flags.patch
@@ -21,6 +22,9 @@ Patch6: honeyd-1.5c-extint.patch
Patch7: honeyd-1.5c-libevent2.patch
Patch8: honeyd-1.5c-automake13.patch
Requires: perl-SNMP_Session
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
BuildRequires: readline-devel, zlib-devel
BuildRequires: python-devel, pcre-devel
BuildRequires: libpcap-devel, libdnet-devel, libevent-devel
@@ -63,9 +67,9 @@ rm -rf %{buildroot}
install -d %{buildroot}%{_datadir}/honeyd
make install DESTDIR=%{buildroot}
cp -aRf scripts %{buildroot}/%{_datadir}/%{name}/
-install -d -m 755 %{buildroot}%{_initrddir}
install -d -m 755 %{buildroot}%{_sysconfdir}/sysconfig
-install -p -m 755 %{SOURCE2} %{buildroot}%{_initrddir}/honeyd
+install -D -p -m 644 %{SOURCE2} %{buildroot}%{_unitdir}/honeyd.service
+install -D -p -m 644 %{SOURCE7} %{buildroot}%{_unitdir}/farpd.service
install -p -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/honeyd.conf
install -p -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/honeyd
install -p -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/sysconfig/farpd
@@ -90,21 +94,50 @@ rm -rf %{buildroot}/%{_datadir}/honeyd/scripts/test.sh
rm -rf %{buildroot}
%post
-/sbin/chkconfig --add honeyd
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
%preun
-if [ $1 = 0 ]; then
- service honeyd stop >/dev/null 2>&1 ||:
- /sbin/chkconfig --del honeyd
+if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ /bin/systemctl --no-reload disable honeyd.service > /dev/null 2>&1 || :
+ /bin/systemctl stop honeyd.service > /dev/null 2>&1 || :
+ /bin/systemctl --no-reload disable farpd.service > /dev/null 2>&1 || :
+ /bin/systemctl stop farpd.service > /dev/null 2>&1 || :
+fi
+
+%postun
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ /bin/systemctl try-restart honeyd.service >/dev/null 2>&1 || :
+ /bin/systemctl try-restart farpd.service >/dev/null 2>&1 || :
fi
+%triggerun -- honeyd < 1.5c-17
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply honeyd
+# and systemd-sysv-convert --apply farpd
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save honeyd >/dev/null 2>&1 ||:
+/usr/bin/systemd-sysv-convert --save farpd >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del honeyd >/dev/null 2>&1 || :
+/sbin/chkconfig --del farpd >/dev/null 2>&1 || :
+/bin/systemctl try-restart honeyd.service >/dev/null 2>&1 || :
+/bin/systemctl try-restart farpd.service >/dev/null 2>&1 || :
+
%files
%defattr(-, root, root, 0755)
%doc LICENSE README config.sample nmap.prints README.fedora
%config(noreplace) %{_sysconfdir}/honeyd.conf
%config(noreplace) %{_sysconfdir}/sysconfig/honeyd
%config(noreplace) %{_sysconfdir}/sysconfig/farpd
-%{_initrddir}/honeyd
+%{_unitdir}/honeyd.service
+%{_unitdir}/farpd.service
%{_bindir}/hsniff
%{_bindir}/honeydstats
%{_bindir}/honeyd
@@ -116,7 +149,10 @@ fi
%{_mandir}/man8/farpd.8*
%changelog
-* Fri Feb 17 2012 Karsten Hopp <karsten at redhat.com> 1.5c-16
+* Wed Apr 18 2012 Jon Ciesla <limburgher at gmail.com> - 1.5c-17
+- Migrate to systemd, BZ 770309.
+
+* Fri Feb 17 2012 Karsten Hopp <karsten at redhat.com> - 1.5c-16
- automake-1.11.3 fix
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.5c-15
More information about the scm-commits
mailing list