[quagga] fixes #719610 - add unit files, SysV initscripts moved to subpackage

Jiri Skala jskala at fedoraproject.org
Tue Jul 19 09:58:29 UTC 2011


commit bbfb695cf4dbaaa8cce937203444ee92f99e63d3
Author: Jiri Skala <jskala at redhat.com>
Date:   Tue Jul 19 11:58:15 2011 +0200

    fixes #719610 - add unit files, SysV initscripts moved to subpackage

 quagga-0.99.18-sysd.patch |  152 +++++++++++++++++++++++++++++++++++++++++++++
 quagga.spec               |  110 +++++++++++++++++++++++----------
 2 files changed, 230 insertions(+), 32 deletions(-)
---
diff --git a/quagga-0.99.18-sysd.patch b/quagga-0.99.18-sysd.patch
new file mode 100644
index 0000000..d4348dd
--- /dev/null
+++ b/quagga-0.99.18-sysd.patch
@@ -0,0 +1,152 @@
+diff -up quagga-0.99.18/redhat/bgpd.service.sysd quagga-0.99.18/redhat/bgpd.service
+--- quagga-0.99.18/redhat/bgpd.service.sysd	2011-07-19 11:16:11.810667234 +0200
++++ quagga-0.99.18/redhat/bgpd.service	2011-07-19 11:16:11.810667234 +0200
+@@ -0,0 +1,11 @@
++[Unit]
++Description=BGP routing daemon
++After=syslog.target network.target
++
++[Service]
++Type=forking
++EnvironmentFile=/etc/sysconfig/quagga
++ExecStart=/usr/sbin/bgpd -d $BGPD_OPTS
++
++[Install]
++WantedBy=multi-user.target
+diff -up quagga-0.99.18/redhat/isisd.service.sysd quagga-0.99.18/redhat/isisd.service
+--- quagga-0.99.18/redhat/isisd.service.sysd	2011-07-19 11:16:11.811667244 +0200
++++ quagga-0.99.18/redhat/isisd.service	2011-07-19 11:16:11.811667244 +0200
+@@ -0,0 +1,12 @@
++[Unit]
++Description=ISIS routing daemon
++After=syslog.target network.target
++
++[Service]
++Type=forking
++EnvironmentFile=/etc/sysconfig/quagga
++ExecStart=/usr/sbin/isisd -d
++
++[Install]
++WantedBy=multi-user.target
++
+diff -up quagga-0.99.18/redhat/ospf6d.service.sysd quagga-0.99.18/redhat/ospf6d.service
+--- quagga-0.99.18/redhat/ospf6d.service.sysd	2011-07-19 11:16:11.812667254 +0200
++++ quagga-0.99.18/redhat/ospf6d.service	2011-07-19 11:16:11.812667254 +0200
+@@ -0,0 +1,12 @@
++[Unit]
++Description=OSPF routing daemon for IPv6
++After=syslog.target network.target
++
++[Service]
++Type=forking
++EnvironmentFile=/etc/sysconfig/quagga
++ExecStart=/usr/sbin/ospf6d -d $OSPF6D_OPTS
++
++[Install]
++WantedBy=multi-user.target
++
+diff -up quagga-0.99.18/redhat/ospfd.service.sysd quagga-0.99.18/redhat/ospfd.service
+--- quagga-0.99.18/redhat/ospfd.service.sysd	2011-07-19 11:16:11.813667264 +0200
++++ quagga-0.99.18/redhat/ospfd.service	2011-07-19 11:16:11.813667264 +0200
+@@ -0,0 +1,12 @@
++[Unit]
++Description=OSPF routing daemon
++After=syslog.target network.target
++
++[Service]
++Type=forking
++EnvironmentFile=/etc/sysconfig/quagga
++ExecStart=/usr/sbin/ospfd -d $OSPFD_OPTS
++
++[Install]
++WantedBy=multi-user.target
++
+diff -up quagga-0.99.18/redhat/quagga.sysconfig.sysd quagga-0.99.18/redhat/quagga.sysconfig
+--- quagga-0.99.18/redhat/quagga.sysconfig.sysd	2011-03-21 10:43:52.000000000 +0100
++++ quagga-0.99.18/redhat/quagga.sysconfig	2011-07-19 11:46:07.141576149 +0200
+@@ -1,14 +1,13 @@
+ #
+ # Default: Bind all daemon vtys to the loopback(s) only
+ #
+-QCONFDIR="/etc/quagga"
+-BGPD_OPTS="-A 127.0.0.1 -f ${QCONFDIR}/bgpd.conf"
+-OSPF6D_OPTS="-A ::1 -f ${QCONFDIR}/ospf6d.conf"
+-OSPFD_OPTS="-A 127.0.0.1 -f ${QCONFDIR}/ospfd.conf"
+-RIPD_OPTS="-A 127.0.0.1 -f ${QCONFDIR}/ripd.conf"
+-RIPNGD_OPTS="-A ::1 -f ${QCONFDIR}/ripngd.conf"
+-ZEBRA_OPTS="-A 127.0.0.1 -f ${QCONFDIR}/zebra.conf"
+-ISISD_OPTS="-A ::1 -f ${QCONFDIR}/isisd.conf"
++BGPD_OPTS="-A 127.0.0.1 -f /etc/quagga/bgpd.conf"
++OSPF6D_OPTS="-A ::1 -f /etc/quagga/ospf6d.conf"
++OSPFD_OPTS="-A 127.0.0.1 -f /etc/quagga/ospfd.conf"
++RIPD_OPTS="-A 127.0.0.1 -f /etc/quagga/ripd.conf"
++RIPNGD_OPTS="-A ::1 -f /etc/quagga/ripngd.conf"
++ZEBRA_OPTS="-A 127.0.0.1 -f /etc/quagga/zebra.conf"
++ISISD_OPTS="-A ::1 -f /etc/quagga/isisd.conf"
+ 
+ # Watchquagga configuration (please check timer values before using):
+ WATCH_OPTS=""
+diff -up quagga-0.99.18/redhat/ripd.service.sysd quagga-0.99.18/redhat/ripd.service
+--- quagga-0.99.18/redhat/ripd.service.sysd	2011-07-19 11:16:11.815667284 +0200
++++ quagga-0.99.18/redhat/ripd.service	2011-07-19 11:16:11.815667284 +0200
+@@ -0,0 +1,12 @@
++[Unit]
++Description=RIP routing daemon
++After=syslog.target network.target
++
++[Service]
++Type=forking
++EnvironmentFile=/etc/sysconfig/quagga
++ExecStart=/usr/sbin/ripd -d $RIPD_OPTS
++
++[Install]
++WantedBy=multi-user.target
++
+diff -up quagga-0.99.18/redhat/ripngd.service.sysd quagga-0.99.18/redhat/ripngd.service
+--- quagga-0.99.18/redhat/ripngd.service.sysd	2011-07-19 11:16:11.816667293 +0200
++++ quagga-0.99.18/redhat/ripngd.service	2011-07-19 11:16:11.816667293 +0200
+@@ -0,0 +1,12 @@
++[Unit]
++Description=RIP routing daemon for IPv6
++After=syslog.target network.target
++
++[Service]
++Type=forking
++EnvironmentFile=/etc/sysconfig/quagga
++ExecStart=/usr/sbin/ripngd -d $RIPNGD_OPTS
++
++[Install]
++WantedBy=multi-user.target
++
+diff -up quagga-0.99.18/redhat/watchquagga.service.sysd quagga-0.99.18/redhat/watchquagga.service
+--- quagga-0.99.18/redhat/watchquagga.service.sysd	2011-07-19 11:16:11.817667302 +0200
++++ quagga-0.99.18/redhat/watchquagga.service	2011-07-19 11:16:11.817667302 +0200
+@@ -0,0 +1,12 @@
++[Unit]
++Description=Quagga watchdog for use with Zebra
++After=syslog.target network.target
++
++[Service]
++Type=forking
++EnvironmentFile=/etc/sysconfig/quagga
++ExecStart=/usr/sbin/watchquagga -d $WATCH_OPTS $WATCH_DAEMONS
++
++[Install]
++WantedBy=multi-user.target
++
+diff -up quagga-0.99.18/redhat/zebra.service.sysd quagga-0.99.18/redhat/zebra.service
+--- quagga-0.99.18/redhat/zebra.service.sysd	2011-07-19 11:16:11.818667311 +0200
++++ quagga-0.99.18/redhat/zebra.service	2011-07-19 11:16:11.818667311 +0200
+@@ -0,0 +1,12 @@
++[Unit]
++Description=GNU Zebra routing manager
++After=syslog.target network.target
++
++[Service]
++Type=forking
++EnvironmentFile=-/etc/sysconfig/quagga
++ExecStartPre=/sbin/ip route flush proto zebra
++ExecStart=/usr/sbin/zebra -d $ZEBRA_OPTS
++
++[Install]
++WantedBy=multi-user.target
diff --git a/quagga.spec b/quagga.spec
index 919f1f4..05bf847 100644
--- a/quagga.spec
+++ b/quagga.spec
@@ -32,7 +32,7 @@
 Summary:    Routing daemon
 Name:		quagga
 Version:	0.99.18
-Release:    5%{?dist}
+Release:    6%{?dist}
 License:	GPLv2+
 Group:      System Environment/Daemons
 Source0:    http://www.quagga.net/download/%{name}-%{version}.tar.gz
@@ -47,6 +47,7 @@ Patch2:     quagga-0.99.18-opaque-refresh-fixes.patch
 Patch101:     quagga-0.99.15-perl_pth.patch
 Patch102:     quagga-0.99.16-posix.patch
 Patch103:     quagga-0.99.16-man.patch
+Patch104:     quagga-0.99.18-sysd.patch
 
 URL:		http://www.quagga.net
 %if %with_snmp
@@ -73,6 +74,9 @@ Requires(post): /sbin/chkconfig
 Requires(preun): /sbin/chkconfig
 Requires(post): /sbin/install-info
 Requires(postun): /sbin/install-info
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
 Provides:	routingdaemon = %{version}-%{release}
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -89,6 +93,16 @@ Quagga by design has a process for each protocol.
 
 Quagga is a fork of GNU Zebra.
 
+%package sysvinit
+Group: System Environment/Daemons
+Summary: SysV initscript for quagga routing daemons
+Requires: %{name} = %{version}-%{release}
+Requires(preun): /sbin/service
+Requires(postun): /sbin/service
+
+%description sysvinit
+The quagga-sysvinit contains SysV initscritps support.
+
 %package contrib
 Summary: Contrib tools for quagga
 Group: System Environment/Daemons
@@ -114,6 +128,7 @@ developing OSPF-API and quagga applications.
 %patch101 -p1 -b .perl_pth
 %patch102 -p1 -b .posix
 %patch103 -p1 -b .man
+%patch104 -p1 -b .sysd
 
 %build
 # FC5+ automatic -fstack-protector-all switch
@@ -185,6 +200,8 @@ rm -rf $RPM_BUILD_ROOT
 
 install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig,logrotate.d} \
 	$RPM_BUILD_ROOT/var/log/quagga $RPM_BUILD_ROOT%{_infodir}
+mkdir -p $RPM_BUILD_ROOT/lib/systemd/system
+
 %if %with_pam
 install -d $RPM_BUILD_ROOT/etc/pam.d
 %endif
@@ -195,6 +212,16 @@ make install \
 # Remove this file, as it is uninstalled and causes errors when building on RH9
 rm -rf $RPM_BUILD_ROOT/usr/share/info/dir
 
+install -m 644 %{zeb_rh_src}/zebra.service $RPM_BUILD_ROOT/lib/systemd/system
+install -m 644 %{zeb_rh_src}/ripd.service $RPM_BUILD_ROOT/lib/systemd/system
+install -m 644 %{zeb_rh_src}/ospfd.service $RPM_BUILD_ROOT/lib/systemd/system
+install -m 644 %{zeb_rh_src}/bgpd.service $RPM_BUILD_ROOT/lib/systemd/system
+install -m 644 %{zeb_rh_src}/watchquagga.service $RPM_BUILD_ROOT/lib/systemd/system
+%if %with_ipv6
+install -m 644 %{zeb_rh_src}/ospf6d.service $RPM_BUILD_ROOT/lib/systemd/system
+install -m 644 %{zeb_rh_src}/ripngd.service $RPM_BUILD_ROOT/lib/systemd/system
+%endif
+
 install %{zeb_rh_src}/zebra.init $RPM_BUILD_ROOT/etc/rc.d/init.d/zebra
 install %{zeb_rh_src}/bgpd.init $RPM_BUILD_ROOT/etc/rc.d/init.d/bgpd
 %if %with_ipv6
@@ -236,16 +263,7 @@ if getent passwd %quagga_user >/dev/null 2>&1 ; then : ; else \
 %endif
 
 %post
-/sbin/chkconfig --add zebra 
-/sbin/chkconfig --add ripd
-%if %with_ipv6
-/sbin/chkconfig --add ripngd
-/sbin/chkconfig --add ospf6d
-%endif
-/sbin/chkconfig --add ospfd
-/sbin/chkconfig --add bgpd
-
-/sbin/chkconfig --add watchquagga
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
 
 if [ -f %{_infodir}/%{name}.inf* ]; then
 	/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || :
@@ -266,18 +284,7 @@ if [ ! -e %{_sysconfdir}/vtysh.conf ]; then
 fi
 
 %postun
-if [ "$1" -ge  "1" ]; then
-	/etc/rc.d/init.d/zebra  condrestart >/dev/null 2>&1
-	/etc/rc.d/init.d/ripd   condrestart >/dev/null 2>&1
-%if %with_ipv6
-	/etc/rc.d/init.d/ripngd condrestart >/dev/null 2>&1
-%endif
-	/etc/rc.d/init.d/ospfd  condrestart >/dev/null 2>&1
-%if %with_ipv6
-	/etc/rc.d/init.d/ospf6d condrestart >/dev/null 2>&1
-%endif
-	/etc/rc.d/init.d/bgpd   condrestart >/dev/null 2>&1
-fi
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
 if [ -f %{_infodir}/%{name}.inf* ]; then
 	/sbin/install-info --delete %{_infodir}/quagga.info %{_infodir}/dir || :
 fi
@@ -285,18 +292,52 @@ fi
 
 %preun
 if [ "$1" = "0" ]; then
-    /sbin/chkconfig --del zebra
-	/sbin/chkconfig --del ripd
+	/bin/systemctl disable ripd.service > /dev/null 2>&1 || :
+	/bin/systemctl stop ripd.service > /dev/null 2>&1 || :
+	/bin/systemctl disable bgpd.service > /dev/null 2>&1 || :
+	/bin/systemctl stop bgpd.service > /dev/null 2>&1 || :
+	/bin/systemctl disable zebra.service > /dev/null 2>&1 || :
+	/bin/systemctl stop zebra.service > /dev/null 2>&1 || :
+	/bin/systemctl disable ospfd.service > /dev/null 2>&1 || :
+	/bin/systemctl stop ospfd.service > /dev/null 2>&1 || :
+	/bin/systemctl disable watchquagga.service > /dev/null 2>&1 || :
+	/bin/systemctl stop watchquagga.service > /dev/null 2>&1 || :
 %if %with_ipv6
-	/sbin/chkconfig --del ripngd
+	/bin/systemctl disable ospf6d.service > /dev/null 2>&1 || :
+	/bin/systemctl stop ospf6d.service > /dev/null 2>&1 || :
+	/bin/systemctl disable ripngd.service > /dev/null 2>&1 || :
+	/bin/systemctl stop ripngd.service > /dev/null 2>&1 || :
 %endif
-	/sbin/chkconfig --del ospfd
+fi
+
+%triggerun --  %{name} < 0.99.18-6
+	/sbin/chkconfig --del zebra >/dev/null 2>&1 || :
+	/sbin/chkconfig --del ripd >/dev/null 2>&1 || :
+	/sbin/chkconfig --del bgpd >/dev/null 2>&1 || :
+	/sbin/chkconfig --del ospfd >/dev/null 2>&1 || :
+	/sbin/chkconfig --del watchquagga >/dev/null 2>&1 || :
+	/bin/systemctl try-restart zebra.service >/dev/null 2>&1 || :
+	/bin/systemctl try-restart ripd.service >/dev/null 2>&1 || :
+	/bin/systemctl try-restart bgpd.service >/dev/null 2>&1 || :
+	/bin/systemctl try-restart ospfd.service >/dev/null 2>&1 || :
+	/bin/systemctl try-restart watchquagga.service >/dev/null 2>&1 || :
 %if %with_ipv6
-	/sbin/chkconfig --del ospf6d
+	/sbin/chkconfig --del ospf6d >/dev/null 2>&1 || :
+	/sbin/chkconfig --del ripngd >/dev/null 2>&1 || :
+	/bin/systemctl try-restart ospf6d.service >/dev/null 2>&1 || :
+	/bin/systemctl try-restart ripngd.service >/dev/null 2>&1 || :
+%endif
+
+%triggerpostun -n %{name}-sysvinit -- %{name} < 0.99.18-6
+	/sbin/chkconfig --add zebra >/dev/null 2>&1 || :
+	/sbin/chkconfig --add ripd >/dev/null 2>&1 || :
+	/sbin/chkconfig --add bgpd >/dev/null 2>&1 || :
+	/sbin/chkconfig --add ospfd >/dev/null 2>&1 || :
+	/sbin/chkconfig --add watchquagga >/dev/null 2>&1 || :
+%if %with_ipv6
+	/sbin/chkconfig --add ospf6d >/dev/null 2>&1 || :
+	/sbin/chkconfig --add ripngd >/dev/null 2>&1 || :
 %endif
-	/sbin/chkconfig --del bgpd
-	/sbin/chkconfig --del watchquagga
-fi
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -331,14 +372,16 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/*.so.*
 # noreplace not used due to smaple conf files
 %config /etc/quagga/[!v]*
-%attr(755,root,root) /etc/rc.d/init.d/*
 %if %with_pam
 %config(noreplace) /etc/pam.d/quagga
 %endif
 %config(noreplace) %attr(640,root,root) /etc/logrotate.d/quagga
 %config(noreplace) /etc/sysconfig/quagga                  
 %config(noreplace) /etc/tmpfiles.d/quagga.conf
+/lib/systemd/system/*.service
 
+%files sysvinit
+%attr(755,root,root) /etc/rc.d/init.d/*
 
 %files contrib
 %defattr(-,root,root)
@@ -359,6 +402,9 @@ rm -rf $RPM_BUILD_ROOT
 %endif
 
 %changelog
+* Tue Jul 19 2011 Jiri Skala <jskala at redhat.com> - 0.99.18-6
+- fixes #719610 - add unit files, SysV initscripts moved to subpackage
+
 * Mon Jul 11 2011 Jiri Skala <jskala at redhat.com> - 0.99.18-5
 - rebuild with new snmp
 


More information about the scm-commits mailing list