packages: nut/nut.spec - enable systemd services taking into account name c...

baggins baggins at pld-linux.org
Sun Jun 24 00:14:32 CEST 2012


Author: baggins                      Date: Sat Jun 23 22:14:32 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
- enable systemd services taking into account name changes

---- Files affected:
packages/nut:
   nut.spec (1.176 -> 1.177) 

---- Diffs:

================================================================
Index: packages/nut/nut.spec
diff -u packages/nut/nut.spec:1.176 packages/nut/nut.spec:1.177
--- packages/nut/nut.spec:1.176	Sat Jun 23 23:22:12 2012
+++ packages/nut/nut.spec	Sun Jun 24 00:14:26 2012
@@ -234,10 +234,6 @@
 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/upsmon
 install %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/upsmon
 
-# mask sysv services for systemd because of different naming
-ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/ups.service
-ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/upsmon.service
-
 for i in $RPM_BUILD_ROOT%{_sysconfdir}/*.sample; do
 	mv -f $i ${i%.sample}
 done
@@ -258,15 +254,26 @@
 /sbin/ldconfig
 /sbin/chkconfig --add ups
 %service ups restart "NUT ups daemon"
-
-%postun
-/sbin/ldconfig
+%systemd_post nut-driver.service nut-server.service
 
 %preun
 if [ "$1" = "0" ]; then
 	%service ups stop
 	/sbin/chkconfig --del ups
 fi
+%systemd_preun nut-driver.service nut-server.service
+
+%postun
+/sbin/ldconfig
+%systemd_reload
+
+%triggerpostun -- nut < 2.6.4-2
+[ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
+[ ${RPM_ENABLE_SYSTEMD_SERVICE:-yes} = no ] && exit 0
+/sbin/chkconfig --list ups 2>/dev/null | grep -qsv "[0-6]:on" || exit 0
+export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog
+%systemd_service_enable nut-driver.service nut-server.service
+%systemd_service mask ups.service
 
 %pre common
 # move to trigger?
@@ -290,12 +297,25 @@
 %post client
 /sbin/chkconfig --add upsmon
 %service upsmon restart "NUT upsmon daemon"
+%systemd_post nut-monitor.service
 
 %preun client
 if [ "$1" = "0" ]; then
 	%service upsmon stop
 	/sbin/chkconfig --del upsmon
 fi
+%systemd_preun nut-monitor.service
+
+%postun client
+%systemd_reload
+
+%triggerpostun client -- nut-client < 2.6.4-2
+[ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
+[ ${RPM_ENABLE_SYSTEMD_SERVICE:-yes} = no ] && exit 0
+/sbin/chkconfig --list upsmon 2>/dev/null | grep -qsv "[0-6]:on" || exit 0
+export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog
+%systemd_service_enable nut-monitor.service
+%systemd_service mask upsmon.service
 
 %files
 %defattr(644,root,root,755)
@@ -315,7 +335,6 @@
 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upsd.users
 %{systemdunitdir}/nut-driver.service
 %{systemdunitdir}/nut-server.service
-%{systemdunitdir}/ups.service
 %{_mandir}/man5/ups.conf.5*
 %{_mandir}/man5/upsd.conf.5*
 %{_mandir}/man5/upsd.users.5*
@@ -441,7 +460,6 @@
 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/upsmon
 /lib/systemd/system-shutdown/nutshutdown
 %{systemdunitdir}/nut-monitor.service
-%{systemdunitdir}/upsmon.service
 %{_mandir}/man5/upsmon.conf.5*
 %{_mandir}/man5/upssched.conf.5*
 %{_mandir}/man8/upsc.8*
@@ -489,6 +507,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.177  2012/06/23 22:14:26  baggins
+- enable systemd services taking into account name changes
+
 Revision 1.176  2012/06/23 21:22:12  baggins
 - package systemd units
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/packages/nut/nut.spec?r1=1.176&r2=1.177



More information about the pld-cvs-commit mailing list