Accepting request 567996 from home:adkorte:branches:hardware

- Fix clash between Group and %define GROUP by renaming the latter
  to NUT_GROUP (and USER to NUT_USER)
- Replace duplicate man files by soft links

OBS-URL: https://build.opensuse.org/request/show/567996
OBS-URL: https://build.opensuse.org/package/show/hardware/nut?expand=0&rev=76
This commit is contained in:
Ismail Dönmez 2018-01-30 14:36:51 +00:00 committed by Git OBS Bridge
parent 39ef41b7d0
commit f56c6df38c
2 changed files with 23 additions and 12 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Sun Jan 21 20:17:50 UTC 2018 - suse+build@de-korte.org
- Fix clash between Group and %define GROUP by renaming the latter
to NUT_GROUP (and USER to NUT_USER)
- Replace duplicate man files by soft links
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Dec 1 14:59:25 UTC 2017 - suse+build@de-korte.org Fri Dec 1 14:59:25 UTC 2017 - suse+build@de-korte.org

View File

@ -1,7 +1,7 @@
# #
# spec file for package nut # spec file for package nut
# #
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -22,8 +22,8 @@
%define MODELPATH %{_libexecdir}/ups/driver %define MODELPATH %{_libexecdir}/ups/driver
%define STATEPATH %{_localstatedir}/lib/ups %define STATEPATH %{_localstatedir}/lib/ups
%define CONFPATH %{_sysconfdir}/ups %define CONFPATH %{_sysconfdir}/ups
%define USER upsd %define NUT_USER upsd
%define GROUP daemon %define NUT_GROUP daemon
%define LBRACE ( %define LBRACE (
%define RBRACE ) %define RBRACE )
%define QUOTE " %define QUOTE "
@ -63,6 +63,7 @@ BuildRequires: apache2-devel
BuildRequires: asciidoc BuildRequires: asciidoc
BuildRequires: avahi-devel BuildRequires: avahi-devel
BuildRequires: dblatex BuildRequires: dblatex
BuildRequires: fdupes
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: libcppunit-devel BuildRequires: libcppunit-devel
BuildRequires: libtool BuildRequires: libtool
@ -277,8 +278,8 @@ autoreconf -fvi
--with-cgipath=%{CGIPATH} \ --with-cgipath=%{CGIPATH} \
--with-statepath=%{STATEPATH} \ --with-statepath=%{STATEPATH} \
--with-drvpath=%{MODELPATH} \ --with-drvpath=%{MODELPATH} \
--with-user=%{USER} \ --with-user=%{NUT_USER} \
--with-group=%{GROUP} \ --with-group=%{NUT_GROUP} \
--with-udev-dir=%{_libexecdir}/udev \ --with-udev-dir=%{_libexecdir}/udev \
--enable-option-checking=fatal --enable-option-checking=fatal
@ -330,15 +331,18 @@ cp -a docs/*.css docs/*.html docs/*.pdf %{buildroot}%{_docdir}/%{name}/
# Not needed for packaged contents: # Not needed for packaged contents:
rm %{buildroot}%{_docdir}/%{name}/packager-guide.* rm %{buildroot}%{_docdir}/%{name}/packager-guide.*
# Create symlinks for man pages
%fdupes -s %{buildroot}%{_mandir}
%pre %pre
%if 0%{?suse_version} < 1330 %if 0%{?suse_version} < 1330
getent passwd %{USER} >/dev/null || useradd -r -g %{GROUP} -s /bin/false -c "UPS daemon" -d /sbin %{USER} 2>/dev/null getent passwd %{NUT_USER} >/dev/null || useradd -r -g %{NUT_GROUP} -s /bin/false -c "UPS daemon" -d /sbin %{NUT_USER} 2>/dev/null
%endif %endif
%service_add_pre nut-driver.service nut-server.service nut-monitor.service %service_add_pre nut-driver.service nut-server.service nut-monitor.service
%post %post
# Be sure that all files are owned by a dedicated user. # Be sure that all files are owned by a dedicated user.
chown -R %{USER}:%{GROUP} %{STATEPATH} chown -R %{NUT_USER}:%{NUT_GROUP} %{STATEPATH}
# Generate initial passwords. # Generate initial passwords.
if grep -q "password = @UPSD_INITIAL_MASTER_PASSWORD@" %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users; then if grep -q "password = @UPSD_INITIAL_MASTER_PASSWORD@" %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users; then
UPSD_INITIAL_MASTER_PASSWORD=$(head -c 20 /dev/urandom | md5sum | head -c 10) UPSD_INITIAL_MASTER_PASSWORD=$(head -c 20 /dev/urandom | md5sum | head -c 10)
@ -349,7 +353,7 @@ if grep -q "password = @UPSD_INITIAL_SLAVE_PASSWORD@" %{CONFPATH}/upsd.users ; t
sed -i s/@UPSD_INITIAL_SLAVE_PASSWORD@/$UPSD_INITIAL_SLAVE_PASSWORD/ %{CONFPATH}/upsd.users sed -i s/@UPSD_INITIAL_SLAVE_PASSWORD@/$UPSD_INITIAL_SLAVE_PASSWORD/ %{CONFPATH}/upsd.users
fi fi
# Be sure that all files are owned by a dedicated user. # Be sure that all files are owned by a dedicated user.
/bin/chown %{USER}:root %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users /bin/chown %{NUT_USER}:root %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users
/bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users /bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users
# Migrate Suspend to Disc to the new convention (bnc#449861 and later bnc#871406): # Migrate Suspend to Disc to the new convention (bnc#449861 and later bnc#871406):
# It was never on by default, but documentation up to 11.0 recommends # It was never on by default, but documentation up to 11.0 recommends
@ -390,9 +394,9 @@ fi
%config(noreplace) %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/nut %config(noreplace) %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/nut
%{_udevrulesdir}/*.rules %{_udevrulesdir}/*.rules
%config(noreplace) %{CONFPATH}/hosts.conf %config(noreplace) %{CONFPATH}/hosts.conf
%config(noreplace) %attr(600,%{USER},root) %{CONFPATH}/upsd.conf %config(noreplace) %attr(600,%{NUT_USER},root) %{CONFPATH}/upsd.conf
%config(noreplace) %attr(600,%{USER},root) %{CONFPATH}/upsd.users %config(noreplace) %attr(600,%{NUT_USER},root) %{CONFPATH}/upsd.users
%config(noreplace) %attr(600,%{USER},root) %{CONFPATH}/upsmon.conf %config(noreplace) %attr(600,%{NUT_USER},root) %{CONFPATH}/upsmon.conf
%dir %{CONFPATH} %dir %{CONFPATH}
%config(noreplace) %{CONFPATH}/nut.conf %config(noreplace) %{CONFPATH}/nut.conf
%config(noreplace) %{CONFPATH}/ups.conf %config(noreplace) %{CONFPATH}/ups.conf
@ -402,7 +406,7 @@ fi
%{MODELPATH}/* %{MODELPATH}/*
%exclude %{MODELPATH}/snmp-ups %exclude %{MODELPATH}/snmp-ups
%exclude %{MODELPATH}/netxml-ups %exclude %{MODELPATH}/netxml-ups
%attr(700,%{USER},%{GROUP}) %{STATEPATH} %attr(700,%{NUT_USER},%{NUT_GROUP}) %{STATEPATH}
%{_unitdir}/*.service %{_unitdir}/*.service
%{systemdsystemdutildir}/system-shutdown/* %{systemdsystemdutildir}/system-shutdown/*
%{_libexecdir}/systemd/system-sleep/%{name}.sh %{_libexecdir}/systemd/system-sleep/%{name}.sh