Get rid of rpm-helper, use native systemd macros and systemd-sysusers

MagOS developers have reported problems with failing %%post scriptlets in chroots, new macros will not fail.
This commit is contained in:
Mikhail Novosyolov 2020-11-25 16:00:53 +03:00
parent 4660f5770c
commit f3e6ca2e76
2 changed files with 20 additions and 39 deletions

View file

@ -49,7 +49,6 @@
%{?build_qt3}%{?!build_qt3:%bcond_with qt3}
%{?build_qt4}%{?!build_qt4:%bcond_without qt4}
%{?build_gtk3}%{?!build_gtk3:%bcond_without gtk3}
%{?build_systemd}%{?!build_systemd:%bcond_without systemd}
%ifarch %{arm} %{mips} aarch64
%bcond_with mono
@ -61,19 +60,19 @@
%bcond_with qt3
%bcond_with qt4
%bcond_with gtk3
%bcond_with systemd
%bcond_with python
%endif
Summary: Avahi service discovery (mDNS/DNS-SD) suite
Name: avahi
Version: 0.6.32
Release: 12
Release: 13
License: LGPLv2+
Group: System/Servers
Url: http://avahi.org/
Source0: http://avahi.org/download/%{name}-%{version}.tar.gz
Source1: avahi-hostname.sh
Source2: sysusers.avahi.conf
Source100: %{name}.rpmlintrc
Patch0: avahi-0.6.31-gtk-is-broken-beyond-repair-gtk-die-die-die.patch
Patch1: avahi-0.6.31.workaround.patch
@ -99,18 +98,8 @@ BuildRequires: pkgconfig(QtCore)
%if %{with gtk3}
BuildRequires: pkgconfig(gtk+-3.0)
%endif
%if %{with systemd}
BuildRequires: systemd-units
%endif
Requires(pre,preun,post,postun): rpm-helper
Requires(post,preun): dbus
Recommends: nss_mdns
Requires(post): rpm-helper
Requires(preun): rpm-helper
Requires(post): dbus
Requires(preun): dbus
Requires(pre): systemd
%description
Avahi is a system which facilitates service discovery on a local
@ -127,9 +116,6 @@ of technology is already found in MacOS X (branded 'Rendezvous',
%config(noreplace) %{_sysconfdir}/%{name}/%{name}-daemon.conf
%config(noreplace) %{_sysconfdir}/%{name}/avahi-autoipd.action
%config(noreplace) %{_sysconfdir}/dbus-1/system.d/%{name}-dbus.conf
%if %{without systemd}
%{_initrddir}/%{name}-daemon
%endif
%attr(0755,avahi,avahi) %dir %{_localstatedir}/avahi
%{_sysconfdir}/sysconfig/network-scripts/hostname.d/avahi
%{_bindir}/%{name}-browse
@ -164,25 +150,19 @@ of technology is already found in MacOS X (branded 'Rendezvous',
%if %{with python}
%{_libdir}/avahi/service-types.db
%endif
%if %{with systemd}
%{_sysusersdir}/%{name}.conf
%{_unitdir}/avahi-daemon.service
%{_unitdir}/avahi-daemon.socket
%{_datadir}/dbus-1/system-services/org.freedesktop.Avahi.service
%endif
%pre
%_pre_useradd %{name} %{_var}/%{name} /bin/false
%_pre_useradd %{name}-autoipd %{_var}/%{name} /bin/false
%postun
%_postun_userdel %{name}
%_postun_userdel %{name}-autoipd
%sysusers_create_package %{name} %{SOURCE2}
%post
%_post_service %{name}-daemon
%systemd_post %{name}-daemon.service
%preun
%_preun_service %{name}-daemon
%systemd_preun %{name}-daemon.service
#----------------------------------------------------------------------------
@ -190,7 +170,6 @@ of technology is already found in MacOS X (branded 'Rendezvous',
Summary: Avahi DNS configuration server
Group: System/Servers
Requires: %{name} = %{EVRD}
Requires(post,preun): rpm-helper
Conflicts: avahi < 0.6.31-8
%description dnsconfd
@ -200,20 +179,16 @@ Especially useful on IPv6.
%files dnsconfd
%{_sysconfdir}/%{name}/%{name}-dnsconfd.action
%if %{without systemd}
%{_initrddir}/%{name}-dnsconfd
%else
%{_unitdir}/avahi-dnsconfd.service
%endif
%{_sbindir}/%{name}-dnsconfd
%{_mandir}/man8/%{name}-dnsconfd.8*
%{_mandir}/man8/%{name}-dnsconfd.action.8*
%post dnsconfd
%_post_service %{name}-dnsconfd
%systemd_post %{name}-dnsconfd.service
%preun dnsconfd
%_preun_service %{name}-dnsconfd
%systemd_preun %{name}-dnsconfd.service
#----------------------------------------------------------------------------
@ -679,9 +654,7 @@ export PYTHON=%{__python2}
--enable-compat-libdns_sd \
--enable-compat-howl \
--enable-introspection=no \
%if %{with systemd}
--with-systemdsystemunitdir=%{_unitdir} \
%endif
%if %{without gtk3}
--disable-gtk3
%endif
@ -726,11 +699,12 @@ perl -pi -e "s/%{_lib}/lib/" %{buildroot}%{_libdir}/pkgconfig/avahi-{,ui-}sharp.
mkdir -p %{buildroot}/%{_sysconfdir}/sysconfig/network-scripts/hostname.d/
install -m755 avahi-hostname.sh %{buildroot}/%{_sysconfdir}/sysconfig/network-scripts/hostname.d/avahi
%if %{with systemd}
rm -rf %{buildroot}%{_initrddir}/%{name}-daemon
rm -rf %{buildroot}%{_initrddir}/%{name}-dnsconfd
%endif
rm -f %{buildroot}%{_sysconfdir}/avahi/services/sftp-ssh.service
mkdir -p %{buildroot}%{_sysusersdir}/%{name}.conf
install -m 0644 %{SOURCE2} %{buildroot}%{_sysusersdir}/%{name}.conf
%find_lang %{name}

7
sysusers.avahi.conf Normal file
View file

@ -0,0 +1,7 @@
u avahi - "Avahi" /var/avahi
g avahi - -
m avahi avahi
u avahi-autoipd - "Avahi AutoIPD" /var/avahi
g avahi-autoipd - -
m avahi-autoipd avahi-autoipd