Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
2bf5c42850 use alternatives for man, apropos and whatis 2020-08-03 15:29:01 +02:00

View file

@ -4,7 +4,7 @@
Summary: Tools for searching and reading man pages
Name: man-db
Version: 2.8.4
Release: 5%{?dist}
Release: 6%{?dist}
# GPLv2+ .. man-db
# GPLv3+ .. gnulib
License: GPLv2+ and GPLv3+
@ -31,6 +31,10 @@ BuildRequires: systemd
BuildRequires: gdbm-devel, gettext, groff, less, libpipeline-devel, zlib-devel
BuildRequires: po4a, perl-interpreter, perl-version
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
Requires(preun): %{_sbindir}/update-alternatives
%description
The man-db package includes five tools for browsing man-pages:
man, whatis, apropos, manpath and lexgrog. man formats and displays
@ -67,6 +71,14 @@ make check
%install
make install DESTDIR=$RPM_BUILD_ROOT prefix=%{_prefix} INSTALL='install -p'
# rename files for alternative usage
for f in man apropos whatis; do
mv %{buildroot}%{_bindir}/$f %{buildroot}%{_bindir}/$f.%{name}
touch %{buildroot}%{_bindir}/$f
mv %{buildroot}%{_mandir}/man1/$f.1 %{buildroot}%{_mandir}/man1/$f.%{name}.1
touch %{buildroot}%{_mandir}/man1/$f.1
done
# move the documentation to the relevant place
mv $RPM_BUILD_ROOT%{_datadir}/doc/man-db/* ./
@ -96,31 +108,57 @@ install -D -p -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_unitdir}/man-db-cache-update.
%find_lang %{name}
%find_lang %{name}-gnulib
# stop and disable timer from previous builds
%pre
# remove alternativized files if they are not symlinks
for f in man apropos whatis; do
[ -L %{_bindir}/$f ] || %{__rm} -f %{_bindir}/$f >/dev/null 2>&1 || :
[ -L %{_mandir}/man1/$f.1.gz ] || %{__rm} -f %{_mandir}/man1/$f.1.gz >/dev/null 2>&1 || :
done
# stop and disable timer from previous builds
if [ -e /usr/lib/systemd/system/mandb.timer ]; then
if test -d /run/systemd; then
systemctl stop man-db.timer
systemctl -q disable man-db.timer
fi
if test -d /run/systemd; then
systemctl stop man-db.timer >/dev/null 2>&1 || :
systemctl -q disable man-db.timer >/dev/null 2>&1 || :
fi
fi
%post
# set up the alternatives files
%{_sbindir}/update-alternatives --install %{_bindir}/man man %{_bindir}/man.%{name} 300 \
--slave %{_bindir}/apropos apropos %{_bindir}/apropos.%{name} \
--slave %{_bindir}/whatis whatis %{_bindir}/whatis.%{name} \
--slave %{_mandir}/man1/man.1.gz man.1.gz %{_mandir}/man1/man.%{name}.1.gz \
--slave %{_mandir}/man1/apropos.1.gz apropos.1.gz %{_mandir}/man1/apropos.%{name}.1.gz \
--slave %{_mandir}/man1/whatis.1.gz whatis.1.gz %{_mandir}/man1/whatis.%{name}.1.gz \
>/dev/null 2>&1 || :
# clear the old cache
%post
%{__rm} -rf %{cache}/*
%{__rm} -rf %{cache}/* >/dev/null 2>&1 || :
%preun
if [ $1 -eq 0 ]; then
%{_sbindir}/update-alternatives --remove man %{_bindir}/man.%{name} >/dev/null 2>&1 || :
fi
%postun
if [ $1 -ge 1 ]; then
if [ "$(readlink %{_sysconfdir}/alternatives/man)" == "%{_bindir}/man.%{name}" ]; then
%{_sbindir}/update-alternatives --set man %{_bindir}/man.%{name} >/dev/null 2>&1 || :
fi
fi
# update cache
%transfiletriggerin -- %{_mandir}
if [ -x /usr/bin/systemd-run -a -x /usr/bin/systemctl ]; then
/usr/bin/systemd-run /usr/bin/systemctl start man-db-cache-update >/dev/null 2>&1 || :
fi
# update cache
%transfiletriggerpostun -- %{_mandir}
if [ -x /usr/bin/systemd-run -a -x /usr/bin/systemctl ]; then
/usr/bin/systemd-run /usr/bin/systemctl start man-db-cache-update >/dev/null 2>&1 || :
fi
%transfiletriggerpostun -- %{_mandir}
# update cache
if [ -x /usr/bin/systemd-run -a -x /usr/bin/systemctl ]; then
/usr/bin/systemd-run /usr/bin/systemctl start man-db-cache-update >/dev/null 2>&1 || :
fi
%files -f %{name}.lang -f %{name}-gnulib.lang
%{!?_licensedir:%global license %%doc}
@ -131,9 +169,12 @@ fi
%config(noreplace) %{_tmpfilesdir}/man-db.conf
%{_unitdir}/man-db-cache-update.service
%{_sbindir}/accessdb
%{_bindir}/man
%{_bindir}/whatis
%{_bindir}/apropos
%ghost %{_bindir}/man
%ghost %{_bindir}/apropos
%ghost %{_bindir}/whatis
%{_bindir}/man.%{name}
%{_bindir}/apropos.%{name}
%{_bindir}/whatis.%{name}
%{_bindir}/manpath
%{_bindir}/lexgrog
%{_bindir}/catman
@ -146,12 +187,15 @@ fi
%{_libexecdir}/man-db/zsoelim
%verify(not mtime) %dir %{cache}
# documentation and translation
%{_mandir}/man1/apropos.1*
%ghost %{_mandir}/man1/man.1*
%ghost %{_mandir}/man1/apropos.1*
%ghost %{_mandir}/man1/whatis.1*
%{_mandir}/man1/man.%{name}.1*
%{_mandir}/man1/apropos.%{name}.1*
%{_mandir}/man1/whatis.%{name}.1*
%{_mandir}/man1/lexgrog.1*
%{_mandir}/man1/man.1*
%{_mandir}/man1/manconv.1*
%{_mandir}/man1/manpath.1*
%{_mandir}/man1/whatis.1*
%{_mandir}/man5/manpath.5*
%{_mandir}/man8/accessdb.8*
%{_mandir}/man8/catman.8*
@ -176,6 +220,9 @@ fi
%config(noreplace) %{_sysconfdir}/cron.daily/man-db.cron
%changelog
* Mon Aug 03 2020 Nikola Forró <nforro@redhat.com> - 2.8.4-6
- use alternatives for man, apropos and whatis
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild