[nut] rebuilt for net-snmp update

Michal Hlavinka mhlavink at fedoraproject.org
Fri Jul 22 12:47:40 UTC 2011


commit 1cd3506ee87e6a25f3cfdaa002402f37d6ff185e
Author: Michal Hlavinka <mhlavink at redhat.com>
Date:   Fri Jul 22 14:47:21 2011 +0200

    rebuilt for net-snmp update

 nut-2.6.1-systemd.patch |  143 +++++++++++++++++++++++++++++++++++++++++++++++
 nut.spec                |   19 +++---
 2 files changed, 153 insertions(+), 9 deletions(-)
---
diff --git a/nut-2.6.1-systemd.patch b/nut-2.6.1-systemd.patch
new file mode 100644
index 0000000..8837195
--- /dev/null
+++ b/nut-2.6.1-systemd.patch
@@ -0,0 +1,143 @@
+diff -up trunk/configure.in.systemd trunk/configure.in
+--- trunk/configure.in.systemd	2011-05-17 17:29:41.324531001 +0200
++++ trunk/configure.in	2011-05-17 17:29:59.179678460 +0200
+@@ -26,6 +26,8 @@ dnl Use "./configure --enable-maintainer
+ dnl in sync after SVN updates.
+ AM_MAINTAINER_MODE
+ 
++dnl PKG_PROG_PKG_CONFIG
++
+ dnl # the following is commented out, because the UPS_VERSION macro now
+ dnl # resides in include/nut_version.h, which is generated by Makefile.am,
+ dnl # rather than in include/config.h, which is generated by configure.  The
+@@ -784,6 +786,31 @@ else
+ fi
+ AM_CONDITIONAL(WITH_PKG_CONFIG, test -n "${pkgconfigdir}")
+ 
++PKG_PROG_PKG_CONFIG
++systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
++AC_MSG_CHECKING(whether to install systemd files)
++AC_ARG_WITH([systemdsystemunitdir],
++	AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files (auto)]),
++[
++	case "${withval}" in
++	yes|auto)
++		;;
++	no)
++		systemdsystemunitdir=""
++		;;
++	*)
++		systemdsystemunitdir="${withval}"
++		;;
++	esac
++], [])
++if test -n "${systemdsystemunitdir}"; then
++	systemdsystemshutdowndir="/lib/systemd/system-shutdown"
++	AC_MSG_RESULT(using ${systemdsystemunitdir})
++else
++	AC_MSG_RESULT(no)
++fi
++AM_CONDITIONAL(HAVE_SYSTEMD, test "$systemdsystemunitdir" != "")
++
+ AC_MSG_CHECKING(whether to install hotplug rules)
+ AC_ARG_WITH(hotplug-dir,
+ 	AS_HELP_STRING([--with-hotplug-dir=PATH], [where to install hotplug rules (/etc/hotplug)]),
+@@ -903,6 +930,8 @@ AC_SUBST(cgiexecdir)
+ AC_SUBST(driverexecdir)
+ AC_SUBST(htmldir)
+ AC_SUBST(pkgconfigdir)
++AC_SUBST(systemdsystemunitdir)
++AC_SUBST(systemdsystemshutdowndir)
+ AC_SUBST(hotplugdir)
+ AC_SUBST(udevdir)
+ 
+diff -up trunk/m4/nut_check_os.m4.systemd trunk/m4/nut_check_os.m4
+--- trunk/m4/nut_check_os.m4.systemd	2011-05-17 17:28:58.555176955 +0200
++++ trunk/m4/nut_check_os.m4	2011-05-17 17:29:59.180678469 +0200
+@@ -44,6 +44,7 @@ AC_DEFUN_ONCE([NUT_OS_FUNCTIONS],
+ 
+ AC_DEFUN([NUT_CHECK_OS],
+ [
++    m4_pattern_allow([^PKG_TARGET$])
+     # Look for all possible source of OS name resolution
+     # 1) we look for a LSB release info file
+ 	eval "dist_search_path=\"
+diff -up trunk/Makefile.am.systemd trunk/Makefile.am
+--- trunk/Makefile.am.systemd	2011-05-17 17:29:41.340531132 +0200
++++ trunk/Makefile.am	2011-07-22 10:30:46.614970524 +0200
+@@ -52,6 +52,24 @@ website:
+ 	@echo "Not building website since 'asciidoc' was not found."
+ endif !HAVE_ASCIIDOC
+ 
++if HAVE_SYSTEMD
++%.service: %.service.in
++	sed -e 's, at sbindir\@,$(sbindir),g' $< > $@
++
++nutshutdown: nutshutdown.in
++	sed -e 's, at sbindir\@,$(sbindir),g' $< > $@
++
++systemdsystemunit_DATA = \
++        nut-driver.service \
++        nut-monitor.service \
++        nut-server.service
++
++systemdsystemshutdown_PROGRAMS = nutshutdown
++
++else
++EXTRA_DIST += nut-driver.service.in nut-monitor.service.in nut-server.service.in nutshutdown
++endif
++
+ # ----------------------------------------------------------------------
+ # targets from old build system (pre-automake).
+ # supported for a period of time for backward "compatibility".
+diff -up trunk/nut-driver.service.in.systemd trunk/nut-driver.service.in
+--- trunk/nut-driver.service.in.systemd	2011-05-17 17:29:59.181678477 +0200
++++ trunk/nut-driver.service.in	2011-07-22 10:28:44.783107095 +0200
+@@ -0,0 +1,10 @@
++[Unit]
++Description=Network UPS Tools - power device driver controller
++After=local-fs.target network.target
++StopWhenUnneeded=yes
++
++[Service]
++ExecStart=/sbin/upsdrvctl start
++ExecStop=/sbin/upsdrvctl stop
++Type=forking
++
+diff -up trunk/nut-monitor.service.in.systemd trunk/nut-monitor.service.in
+--- trunk/nut-monitor.service.in.systemd	2011-05-17 17:29:59.181678477 +0200
++++ trunk/nut-monitor.service.in	2011-07-22 10:28:14.757894331 +0200
+@@ -0,0 +1,11 @@
++[Unit]
++Description=Network UPS Tools - power device monitor and shutdown controller
++After=local-fs.target network.target nut-server.service
++
++[Service]
++ExecStart=/usr/sbin/upsmon
++PIDFile=/var/run/nut/upsmon.pid
++Type=forking
++
++[Install]
++WantedBy=multi-user.target
+diff -up trunk/nut-server.service.in.systemd trunk/nut-server.service.in
+--- trunk/nut-server.service.in.systemd	2011-05-17 17:29:59.180678469 +0200
++++ trunk/nut-server.service.in	2011-07-22 10:27:54.475750633 +0200
+@@ -0,0 +1,12 @@
++[Unit]
++Description=Network UPS Tools - power devices information server
++After=local-fs.target network.target nut-driver.service
++Requires=nut-driver.service
++Before=nut-monitor.service
++
++[Service]
++ExecStart=/usr/sbin/upsd 
++Type=forking
++
++[Install]
++WantedBy=multi-user.target
+diff -up trunk/nutshutdown.in.systemd trunk/nutshutdown.in
+--- trunk/nutshutdown.in.systemd	2011-05-17 17:29:59.182678485 +0200
++++ trunk/nutshutdown.in	2011-05-17 17:29:59.182678485 +0200
+@@ -0,0 +1,2 @@
++#!/bin/sh
++upsmon -K >/dev/null 2>&1 && upsdrvctl shutdown
diff --git a/nut.spec b/nut.spec
index e8fd5a7..3e92410 100644
--- a/nut.spec
+++ b/nut.spec
@@ -20,10 +20,11 @@ License: GPLv2+
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Url: http://www.networkupstools.org/
 Source: http://www.networkupstools.org/source/2.6/%{name}-%{version}.tar.gz
-Source1: ups.init
-Source2: ups.sysconfig
 Source3: nut-client.tmpfiles
 
+# add systemd support
+Patch1:  nut-2.6.1-systemd.patch
+
 Requires(pre): udev
 Requires(post): fileutils chkconfig initscripts
 Requires(postun): fileutils chkconfig initscripts
@@ -107,6 +108,7 @@ necessary to develop NUT client applications.
 
 %prep
 %setup -q
+%patch1 -p1 -b .systemd
 sed -i 's|=NUT-Monitor|=nut-monitor|'  scripts/python/app/nut-monitor.desktop
 sed -i "s|sys.argv\[0\]|'%{_datadir}/%{name}/nut-monitor/nut-monitor'|" scripts/python/app/NUT-Monitor
 sed -i 's|LIBSSL_LDFLAGS|LIBSSL_LIBS|' lib/libupsclient-config.in
@@ -127,6 +129,7 @@ autoreconf -i
     --sysconfdir=%{_sysconfdir}/ups \
     --with-cgipath=%{cgidir} \
     --with-drvpath=%{modeldir} \
+    --with-systemdsystemunitdir=/lib/systemd/systemd-unit \
     --with-pkgconfig-dir=%{_libdir}/pkgconfig \
     --disable-static \
     --with-udev-dir=/lib/udev \
@@ -143,18 +146,14 @@ make %{?_smp_mflags}
 rm -rf %{buildroot}
 
 mkdir -p %{buildroot}%{modeldir} \
-         %{buildroot}%{_sysconfdir}/sysconfig \
          %{buildroot}%{_sysconfdir}/udev/rules.d \
+         %{buildroot}%{_sysconfdir}/ups \
          %{buildroot}%{piddir} \
          %{buildroot}%{_localstatedir}/lib/ups \
-         %{buildroot}%{initdir} \
          %{buildroot}%{_libexecdir}
 
 make install DESTDIR=%{buildroot}
 
-install -m 755 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/ups
-install -m 755 %{SOURCE1} %{buildroot}%{initdir}/ups
-
 %if %{?fedora}0 > 140 || %{?rhel}0 > 60
   install -p -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/tmpfiles.d/nut-client.conf
 %endif
@@ -241,10 +240,11 @@ rm -rf %{buildroot}
 %config(noreplace) %attr(640,root,nut) %{_sysconfdir}/ups/ups.conf
 %config(noreplace) %attr(640,root,nut) %{_sysconfdir}/ups/upsd.conf
 %config(noreplace) %attr(640,root,nut) %{_sysconfdir}/ups/upsd.users
-%config(noreplace) %attr(644,root,root) %{_sysconfdir}/sysconfig/ups
 %attr(644,root,root) /lib/udev/rules.d/62-nut-usbups.rules
 %{modeldir}/*
 %exclude %{modeldir}/netxml-ups
+/lib/systemd/systemd-unit/nut-driver.service
+/lib/systemd/systemd-unit/nut-server.service
 %{_sbindir}/upsd
 %{_bindir}/upslog
 %{_datadir}/%{name}/cmdvartab
@@ -301,7 +301,6 @@ rm -rf %{buildroot}
 %files client
 %doc COPYING
 %defattr(-,root,root)
-%attr(755,root,root) %{initdir}/ups
 %dir %{_sysconfdir}/ups
 %config(noreplace) %attr(640,root,nut) %{_sysconfdir}/ups/upsmon.conf
 %config(noreplace) %attr(640,root,nut) %{_sysconfdir}/ups/upssched.conf
@@ -316,6 +315,8 @@ rm -rf %{buildroot}
 %{_sbindir}/upsmon
 %{_sbindir}/upssched
 %{_bindir}/upssched-cmd
+/lib/systemd/systemd-unit/nut-monitor.service
+/lib/systemd/system-shutdown/nutshutdown
 %{_libdir}/libupsclient.so.*
 %{_mandir}/man5/upsmon.conf.5.gz
 %{_mandir}/man5/upssched.conf.5.gz


More information about the scm-commits mailing list