diff --git a/man-pages.spec b/man-pages.spec index ddb2e55..65d7c3d 100644 --- a/man-pages.spec +++ b/man-pages.spec @@ -7,7 +7,7 @@ Summary: Linux kernel and C library user-space interface documentation Name: man-pages Version: 5.04 -Release: 3%{?dist} +Release: 4%{?dist} License: GPL+ and GPLv2+ and BSD and MIT and Copyright only and IEEE URL: http://www.kernel.org/doc/man-pages/ Source: http://www.kernel.org/pub/linux/docs/man-pages/man-pages-%{version}.tar.xz @@ -16,6 +16,10 @@ Source1: http://www.kernel.org/pub/linux/docs/man-pages/man-pages-posix/%{posix_ # additional man-pages, the source tarball is fedora/rhel only Source2: %{additional_name}.tar.xz +Requires(post): %{_sbindir}/update-alternatives +Requires(postun): %{_sbindir}/update-alternatives +Requires(preun): %{_sbindir}/update-alternatives + # attr.5 man page was moved from attr to man-pages in attr-2.4.47-11 Conflicts: attr < 2.4.47-11 @@ -82,12 +86,37 @@ pushd %{additional_name} make install DESTDIR=$RPM_BUILD_ROOT popd +# rename files for alternative usage +mv %{buildroot}%{_mandir}/man7/man.7 %{buildroot}%{_mandir}/man7/man.%{name}.7 +touch %{buildroot}%{_mandir}/man7/man.7 + +%post +# set up the alternatives files +%{_sbindir}/update-alternatives --install %{_mandir}/man7/man.7.gz man.7.gz %{_mandir}/man7/man.%{name}.7.gz 300 \ + >/dev/null 2>&1 || : + +%preun +if [ $1 -eq 0 ]; then + %{_sbindir}/update-alternatives --remove man.7.gz %{_mandir}/man7/man.%{name}.7.gz >/dev/null 2>&1 || : +fi + +%postun +if [ $1 -ge 1 ]; then + if [ "$(+readlink %{_sysconfdir}/alternatives/man.7.gz+)" == "%{_mandir}/man7/man.%{name}.7.gz" ]; then + %{_sbindir}/update-alternatives --set man.7.gz %{_mandir}/man7/man.%{name}.7.gz >/dev/null 2>&1 || : + fi +fi + %files %doc README man-pages-%{version}.Announce Changes %doc %{posix_name}/POSIX-COPYRIGHT %{posix_name}/%{posix_name}.{README,Announce} +%ghost %{_mandir}/man7/man.7* %{_mandir}/man*/* %changelog +* Thu Feb 27 2020 Nikola Forró - 5.04-4 +- use alternatives for man.7 + * Mon Feb 03 2020 Nikola Forró - 5.04-3 - add kernel_lockdown.7 man page resolves: #1797591