diff --git a/nut-client.tmpfiles b/nut-client.tmpfiles index 56f12eb..8db0516 100644 --- a/nut-client.tmpfiles +++ b/nut-client.tmpfiles @@ -1 +1 @@ -D /var/run/nut 0750 nut nut - +D /var/run/nut 0770 root nut - diff --git a/nut.spec b/nut.spec index e44131b..85935c5 100644 --- a/nut.spec +++ b/nut.spec @@ -1,5 +1,4 @@ -# Does not build with hardened build enabled due to PIC -%global _hardened_build 0 +%global _hardened_build 1 #TODO: split nut-client so it does not require python %global nut_uid 57 @@ -11,15 +10,10 @@ # powerman is retired on Fedora, therefore disable it by default %bcond_with powerman -%if ! (0%{?fedora} > 12 || 0%{?rhel} > 6) -%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")} -%endif - Summary: Network UPS Tools Name: nut Version: 2.7.4 -Release: 19%{?dist} -Group: Applications/System +Release: 21%{?dist} License: GPLv2+ and GPLv3+ Url: http://www.networkupstools.org/ Source: http://www.networkupstools.org/source/2.7/%{name}-%{version}.tar.gz @@ -34,21 +28,24 @@ Patch7: nut-2.6.5-foreground.patch Patch8: nut-2.6.5-unreachable.patch Patch9: nut-2.6.5-rmpidf.patch -Requires(pre): shadow-utils udev -Requires(post): coreutils chkconfig systemd-units -Requires(preun): systemd-units -Requires(postun): coreutils chkconfig systemd-units +Requires(pre): shadow-utils systemd-udev +Requires(post): coreutils systemd +Requires(preun): systemd +Requires(postun): coreutils systemd Obsoletes: nut-hal < 2.6.0-7 -BuildRequires: gcc-c++ BuildRequires: autoconf BuildRequires: automake BuildRequires: avahi-devel +BuildRequires: cppunit-devel BuildRequires: dbus-glib-devel +BuildRequires: desktop-file-utils BuildRequires: elfutils-devel BuildRequires: fontconfig-devel +BuildRequires: freeipmi-devel BuildRequires: freetype-devel BuildRequires: gcc +BuildRequires: gcc-c++ BuildRequires: gd-devel BuildRequires: libjpeg-devel BuildRequires: libpng-devel @@ -59,16 +56,15 @@ BuildRequires: libXpm-devel BuildRequires: neon-devel BuildRequires: net-snmp-devel BuildRequires: netpbm-devel +BuildRequires: nss-devel BuildRequires: openssl-devel BuildRequires: pkgconfig %if %{with powerman} BuildRequires: powerman-devel %endif BuildRequires: python2-devel -BuildRequires: desktop-file-utils -BuildRequires: freeipmi-devel -BuildRequires: nss-devel -BuildRequires: cppunit-devel +BuildRequires: python2-setuptools +BuildRequires: /usr/bin/pathfix.py %ifnarch s390 s390x BuildRequires: libusb-devel @@ -86,11 +82,10 @@ capability has been harnessed where possible to allow for safe shutdowns, live status tracking on web pages, and more. %package client -Group: Applications/System Summary: Network UPS Tools client monitoring utilities -Requires(post): chkconfig -Requires(preun): chkconfig -Requires(pre): shadow-utils udev +Requires(post): systemd +Requires(preun): systemd +Requires(pre): shadow-utils systemd-udev #only for python and gui part #Requires: @@ -100,7 +95,6 @@ ups that the client host has access to, but where the UPS is physically attached to a different computer on the network. %package cgi -Group: Applications/System Summary: CGI utilities for the Network UPS Tools Requires: %{name}-client = %{version}-%{release} webserver Requires(pre): shadow-utils udev @@ -110,7 +104,6 @@ This package includes CGI programs for accessing UPS status via a web browser. %package xml -Group: Applications/System Summary: XML UPS driver for the Network UPS Tools Requires: %{name}-client = %{version}-%{release} @@ -119,7 +112,6 @@ This package adds the netxml-ups driver, that allows NUT to monitor a XML capable UPS. %package devel -Group: Development/Libraries Summary: Development files for NUT Client Requires: %{name}-client = %{version}-%{release} webserver openssl-devel @@ -136,12 +128,15 @@ necessary to develop NUT client applications. %patch8 -p1 -b .unreachable %patch9 -p1 -b .rmpidf - sed -i 's|=NUT-Monitor|=nut-monitor|' scripts/python/app/nut-monitor.desktop +sed -i 's|env python|env python2|' scripts/python/app/NUT-Monitor 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 sed -i 's|LIBSSL_LDFLAGS|LIBSSL_LIBS|' lib/libupsclient.pc.in +# Fix python shbangs +pathfix.py -pni "%{__python2} %{py2_shbang_opts}" scripts/python scripts/python/app/NUT-Monitor + # workaround for multilib conflicts - caused by patch changing modification time of scripts find . -mtime -1 -print0 | xargs -0 touch --reference %{SOURCE0} @@ -179,12 +174,9 @@ sh %{SOURCE4} >>include/config.h #remove rpath sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool -%global _hardened_build 1 -make %{?_smp_mflags} CFLAGS="%{__global_cflags}" LDFLAGS="-Wl,-z,now -Wl,-z,relro %{__global_ldflags}" +%make_build LDFLAGS="%{__global_ldflags}" %install -rm -rf %{buildroot} - mkdir -p %{buildroot}%{modeldir} \ %{buildroot}%{_sysconfdir}/udev/rules.d \ %{buildroot}%{_sysconfdir}/ups \ @@ -192,9 +184,9 @@ mkdir -p %{buildroot}%{modeldir} \ %{buildroot}%{_localstatedir}/lib/ups \ %{buildroot}%{_libexecdir} -make install DESTDIR=%{buildroot} +%make_install -%if %{?fedora}0 > 140 || %{?rhel}0 > 60 +%if 0%{?fedora} || 0%{?rhel} > 6 install -p -D -m 644 %{SOURCE3} %{buildroot}%{_tmpfilesdir}/nut-client.conf %endif @@ -204,7 +196,7 @@ rm -rf docs/man find docs/ -name 'Makefile*' -delete pushd conf; -make install DESTDIR=%{buildroot} +%make_install for file in %{buildroot}%{_sysconfdir}/ups/*.sample do mv $file %{buildroot}%{_sysconfdir}/ups/`basename $file .sample` @@ -224,7 +216,7 @@ do done # install PyNUT -install -p -D -m 644 scripts/python/module/PyNUT.py %{buildroot}%{python_sitelib}/PyNUT.py +install -p -D -m 644 scripts/python/module/PyNUT.py %{buildroot}%{python2_sitelib}/PyNUT.py # install nut-monitor mkdir -p %{buildroot}%{_datadir}/nut/nut-monitor/pixmaps install -p -m 755 scripts/python/app/NUT-Monitor %{buildroot}%{_datadir}/nut/nut-monitor/nut-monitor @@ -292,7 +284,8 @@ else fi %files -%doc COPYING LICENSE-GPL2 LICENSE-GPL3 ChangeLog AUTHORS MAINTAINERS README docs UPGRADING INSTALL NEWS +%license COPYING LICENSE-GPL2 LICENSE-GPL3 +%doc ChangeLog AUTHORS MAINTAINERS README docs UPGRADING INSTALL NEWS %config(noreplace) %attr(640,root,nut) %{_sysconfdir}/ups/nut.conf %config(noreplace) %attr(640,root,nut) %{_sysconfdir}/ups/ups.conf %config(noreplace) %attr(640,root,nut) %{_sysconfdir}/ups/upsd.conf @@ -373,16 +366,16 @@ fi %{_mandir}/man8/usbhid-ups.8.gz %files client -%doc COPYING LICENSE-GPL2 LICENSE-GPL3 -%defattr(-,root,root) +%license COPYING LICENSE-GPL2 LICENSE-GPL3 %dir %{_sysconfdir}/ups %config(noreplace) %attr(640,root,nut) %{_sysconfdir}/ups/upsmon.conf %config(noreplace) %attr(640,root,nut) %{_sysconfdir}/ups/upssched.conf -%if %{?fedora}0 > 140 || %{?rhel}0 > 60 - %config(noreplace) %{_tmpfilesdir}/nut-client.conf +%if 0%{?fedora} || 0%{?rhel} > 6 + %{_tmpfilesdir}/nut-client.conf %endif %dir %attr(750,nut,nut) %{_localstatedir}/lib/ups -%ghost %{piddir} +# upsmon.pid is written as root, so root needs access for now +%ghost %attr(770,root,nut) %{piddir} %{_bindir}/upsc %{_bindir}/upscmd %{_bindir}/upsrw @@ -437,6 +430,15 @@ fi %{_libdir}/pkgconfig/libnutscan.pc %changelog +* Tue Oct 16 2018 Orion Poplawski - 2.7.4-21 +- Cleanup and modernize spec +- Fix ownership/permissions of /var/run/nut (bug #1584330, #1580082) +- Fix python shbangs + +* Sun Oct 14 2018 Peter Robinson 2.7.4-20 +- Updates dependencies, modernise spec, use %%license +- Python build fixes + * Tue Jul 24 2018 Adam Williamson - 2.7.4-19 - Rebuild for new net-snmp