use alternatives for man.7

This commit is contained in:
Nikola Forró 2020-02-28 12:12:38 +01:00
parent 910adacdbc
commit db7a1a14ff

View File

@ -7,7 +7,7 @@
Summary: Linux kernel and C library user-space interface documentation Summary: Linux kernel and C library user-space interface documentation
Name: man-pages Name: man-pages
Version: 5.04 Version: 5.04
Release: 3%{?dist} Release: 4%{?dist}
License: GPL+ and GPLv2+ and BSD and MIT and Copyright only and IEEE License: GPL+ and GPLv2+ and BSD and MIT and Copyright only and IEEE
URL: http://www.kernel.org/doc/man-pages/ URL: http://www.kernel.org/doc/man-pages/
Source: http://www.kernel.org/pub/linux/docs/man-pages/man-pages-%{version}.tar.xz 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 # additional man-pages, the source tarball is fedora/rhel only
Source2: %{additional_name}.tar.xz 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 # attr.5 man page was moved from attr to man-pages in attr-2.4.47-11
Conflicts: attr < 2.4.47-11 Conflicts: attr < 2.4.47-11
@ -82,12 +86,37 @@ pushd %{additional_name}
make install DESTDIR=$RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT
popd 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 %files
%doc README man-pages-%{version}.Announce Changes %doc README man-pages-%{version}.Announce Changes
%doc %{posix_name}/POSIX-COPYRIGHT %{posix_name}/%{posix_name}.{README,Announce} %doc %{posix_name}/POSIX-COPYRIGHT %{posix_name}/%{posix_name}.{README,Announce}
%ghost %{_mandir}/man7/man.7*
%{_mandir}/man*/* %{_mandir}/man*/*
%changelog %changelog
* Thu Feb 27 2020 Nikola Forró <nforro@redhat.com> - 5.04-4
- use alternatives for man.7
* Mon Feb 03 2020 Nikola Forró <nforro@redhat.com> - 5.04-3 * Mon Feb 03 2020 Nikola Forró <nforro@redhat.com> - 5.04-3
- add kernel_lockdown.7 man page - add kernel_lockdown.7 man page
resolves: #1797591 resolves: #1797591