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