[maradns/f16] convert to systemd

Tom Callaway spot at fedoraproject.org
Thu Sep 8 15:01:55 UTC 2011


commit d830ff1cd1605d27287a9328b577097d741dee69
Author: Tom "spot" Callaway <tcallawa at redhat.com>
Date:   Thu Sep 8 11:01:43 2011 -0400

    convert to systemd

 maradns.spec |   58 ++++++++++++++++++++++++++--------------------------------
 1 files changed, 26 insertions(+), 32 deletions(-)
---
diff --git a/maradns.spec b/maradns.spec
index 37c9a3f..e914e7d 100644
--- a/maradns.spec
+++ b/maradns.spec
@@ -1,24 +1,20 @@
 Name:		maradns
 Version:	1.3.07.09
-Release:	5%{?dist}
+Release:	6%{?dist}
 Summary:	Authoritative and recursive DNS server made with security in mind
 
 Source0:	http://www.maradns.org/download/1.3/%{version}/%{name}-%{version}.tar.lzma
-Source1:	maradns.init
-Source2:	zoneserver.init
+Source1:	maradns.service
+Source2:	maradns-zoneserver.service
 Group:		System Environment/Daemons
 License:	BSD
 URL:		http://www.maradns.org/
 
-BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
 # lzma for decompressing in EL-5
 BuildRequires:		lzma
+BuildRequires:		systemd-units
 Requires(pre):		shadow-utils
-Requires(post):		/sbin/chkconfig
-Requires(preun):	/sbin/chkconfig
-Requires(preun):	/sbin/service
-Requires:		initscripts
+Requires(post):		systemd-sysv
 
 %description
 MaraDNS is a package that implements the Domain Name Service (DNS), an
@@ -63,8 +59,6 @@ popd
 
 
 %install
-%{__rm} -rf %{buildroot}
-
 # create /etc/maradns and /etc/mararc first
 %{__install} -d -m 0755 %{buildroot}%{_sysconfdir}/maradns/logger/
 %{__install} -D -m 0644 build/rpm.mararc %{buildroot}%{_sysconfdir}/mararc
@@ -96,8 +90,9 @@ popd
 	doc/en/man/duende.8
 
 # init files
-%{__install} -D -m 0755 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/maradns
-%{__install} -D -m 0755 %{SOURCE2} %{buildroot}%{_sysconfdir}/init.d/maradns-zoneserver
+mkdir -p %{buildroot}%{_unitdir}
+%{__install} -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/
+%{__install} -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/
 
 %{__rm} CHANGELOG CREDITS FAQ
 ln -fs en/changelog.txt CHANGELOG
@@ -105,18 +100,16 @@ ln -fs en/credits.txt CREDITS
 ln -fs en/faq.txt FAQ
 
 
-%clean
-%{__rm} -rf %{buildroot}
+
 
 %files
-%defattr(-,root,root,-)
 %doc CHANGELOG COPYING CREDITS FAQ doc/*
 %doc maradns.gpg.key
 
 %config(noreplace) %{_sysconfdir}/mararc
 %attr(-,maradns,maradns) %{_sysconfdir}/maradns/
-%{_sysconfdir}/init.d/maradns
-%{_sysconfdir}/init.d/maradns-zoneserver
+%{_unitdir}/%{name}.service
+%{_unitdir}/%{name}-zoneserver.service
 
 %{_bindir}/askmara
 %{_bindir}/duende
@@ -151,27 +144,28 @@ fi
 if [ $1 -eq 1 ]; then
 	echo maradns_uid=$(id -u maradns) >> %{_sysconfdir}/mararc
 	echo maradns_gid=$(id -g maradns) >> %{_sysconfdir}/mararc
-	/sbin/chkconfig --add maradns
-	/sbin/chkconfig --add maradns-zoneserver
 fi
 
 
-%preun
-if [ $1 -eq 0 ]; then
-	/sbin/service maradns stop &>/dev/null || :
-	/sbin/chkconfig --del maradns
-	/sbin/service maradns-zoneserver stop &>/dev/null || :
-	/sbin/chkconfig --del maradns-zoneserver
-fi
+%triggerun -- maradns < 1.3.07.09-6
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply maradns
+#                        systemd-sysv-convert --apply maradns-zoneserver
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save maradns >/dev/null 2>&1 ||:
+/usr/bin/systemd-sysv-convert --save maradns-zoneserver >/dev/null 2>&1 ||:
 
-%postun
-if [ $1 -eq 1 ]; then
-	/sbin/service maradns condrestart &>/dev/null || :
-	/sbin/service maradns-zoneserver condrestart &>/dev/null || :
-fi
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del maradns >/dev/null 2>&1 || :
+/bin/systemctl try-restart maradns.service >/dev/null 2>&1 || :
+/sbin/chkconfig --del maradns-zoneserver >/dev/null 2>&1 || :
+/bin/systemctl try-restart maradns-zoneserver.service >/dev/null 2>&1 || :
 
 
 %changelog
+* Thu Sep 08 2011 Tom Callaway <spot at fedoraproject.org> - 1.3.07.09-6
+- convert to systemd
+
 * Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.3.07.09-5
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list