[pdns/el5] Spec improvements
Morten Stevens
mstevens at fedoraproject.org
Thu Nov 1 12:59:32 UTC 2012
commit 0205fd9154d87b7407d4b4a8530c4401cc6a61d1
Author: Morten Stevens <mstevens at imt-systems.com>
Date: Thu Nov 1 14:59:01 2012 +0100
Spec improvements
pdns-fixinit.patch | 34 +++++++++++++++++++++++++++++-----
pdns.spec | 34 ++++++++++++++++++++++------------
2 files changed, 51 insertions(+), 17 deletions(-)
---
diff --git a/pdns-fixinit.patch b/pdns-fixinit.patch
index e4c563a..d177c33 100644
--- a/pdns-fixinit.patch
+++ b/pdns-fixinit.patch
@@ -1,6 +1,6 @@
---- pdns-2.9.20/pdns/pdns.in.fixinit 2006-12-17 18:14:14.000000000 +0100
-+++ pdns-2.9.20/pdns/pdns.in 2006-12-17 18:15:42.000000000 +0100
-@@ -47,6 +47,7 @@
+--- pdns-2.9.22/pdns/pdns.in.orig 2008-02-03 13:14:00.000000000 +0100
++++ pdns-2.9.22/pdns/pdns.in 2012-11-01 14:31:23.251058524 +0100
+@@ -47,6 +47,7 @@ case "$1" in
if test "$NOTRUNNING" = "0"
then
doPC quit
@@ -8,7 +8,7 @@
echo $ret
else
echo "not running"
-@@ -57,6 +58,7 @@
+@@ -57,6 +58,7 @@ case "$1" in
force-stop)
echo -n "Stopping PowerDNS authoritative nameserver: "
killall -v -9 pdns_server
@@ -16,7 +16,7 @@
echo "killed"
;;
-@@ -69,6 +71,7 @@
+@@ -69,10 +71,21 @@ case "$1" in
$pdns_server --daemon --guardian=yes
if test "$?" = "0"
then
@@ -24,3 +24,27 @@
echo "started"
fi
fi
+- ;;
++ ;;
++
++ condrestart)
++ if [ -f /var/lock/subsys/pdns ];
++ then
++ echo "running, restarting"
++ $0 restart
++ else
++ echo "not running"
++ fi
++ ;;
+
+ force-reload | restart)
+ echo -n "Restarting PowerDNS authoritative nameserver: "
+@@ -170,7 +183,7 @@ case "$1" in
+
+
+ *)
+- echo pdns [start\|stop\|force-reload\|restart\|status\|dump\|show\|mrtg\|cricket\|monitor]
++ echo pdns [start\|stop\|condrestart\|force-reload\|restart\|status\|dump\|show\|mrtg\|cricket\|monitor]
+
+ ;;
+ esac
diff --git a/pdns.spec b/pdns.spec
index 6587992..7ca18d1 100644
--- a/pdns.spec
+++ b/pdns.spec
@@ -1,20 +1,19 @@
Summary: A modern, advanced and high performance authoritative-only nameserver
Name: pdns
Version: 2.9.22
-Release: 5%{?dist}
+Release: 6%{?dist}
License: GPLv2
Group: System Environment/Daemons
URL: http://powerdns.com
Source0: http://downloads.powerdns.com/releases/%{name}-%{version}.tar.gz
-
-# Patches
-
Patch0: pdns-default-config.patch
Patch1: pdns-fixinit.patch
Patch2: pdns-cve-2012-0206.patch
-Requires(post): %{_sbindir}/useradd, /sbin/chkconfig
+Requires(pre): shadow-utils
+Requires(post): /sbin/chkconfig
Requires(preun): /sbin/service, /sbin/chkconfig
+Requires(postun): /sbin/service
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: boost-devel
@@ -120,20 +119,27 @@ chrpath --delete %{buildroot}%{_bindir}/zone2sql
chrpath --delete %{buildroot}%{_sbindir}/pdns_server
chrpath --delete %{buildroot}%{_libdir}/%{name}/*.so
+%pre
+getent group pdns >/dev/null || groupadd -r pdns
+getent passwd pdns >/dev/null || \
+ useradd -r -g pdns -d / -s /sbin/nologin \
+ -c "PowerDNS user" pdns
+exit 0
+
%post
-if [ $1 -eq 1 ]; then
- /sbin/chkconfig --add pdns
- userid=`id -u pdns 2>/dev/null`
- if [ x"$userid" = x ]; then
- %{_sbindir}/useradd -c "PowerDNS user" -s /sbin/nologin -r -d / pdns > /dev/null || :
- fi
-fi
+/sbin/chkconfig --add pdns
+
%preun
if [ $1 -eq 0 ]; then
/sbin/service pdns stop >/dev/null 2>&1 || :
/sbin/chkconfig --del pdns
fi
+%postun
+if [ $1 -ge 1 ]; then
+ /sbin/service pdns condrestart >/dev/null 2>&1 || :
+fi
+
%clean
%{__rm} -rf %{buildroot}
@@ -184,6 +190,10 @@ fi
%changelog
+* Thu Nov 01 2012 Morten Stevens <mstevens at imt-systems.com> - 2.9.22-6
+- Added condrestart option
+- Spec improvements
+
* Sat Oct 20 2012 Morten Stevens <mstevens at imt-systems.com> - 2.9.22-5
- Fixed permissions of pdns.conf file (rhbz#646510)
- Set bind as default backend
More information about the scm-commits
mailing list