use alternatives for man, apropos and whatis
This commit is contained in:
parent
847869c6b7
commit
1139b5a35a
83
man-db.spec
83
man-db.spec
@ -4,7 +4,7 @@
|
||||
Summary: Tools for searching and reading man pages
|
||||
Name: man-db
|
||||
Version: 2.9.1
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
# GPLv2+ .. man-db
|
||||
# GPLv3+ .. gnulib
|
||||
License: GPLv2+ and GPLv3+
|
||||
@ -36,6 +36,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
|
||||
@ -73,6 +77,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/* ./
|
||||
|
||||
@ -103,31 +115,51 @@ install -D -p -m 0644 %{SOURCE4} $RPM_BUILD_ROOT%{_unitdir}/man-db-restart-cache
|
||||
%find_lang %{name}
|
||||
%find_lang %{name}-gnulib
|
||||
|
||||
# stop and disable timer from previous builds
|
||||
%pre
|
||||
# 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}
|
||||
@ -139,10 +171,13 @@ fi
|
||||
%{_unitdir}/man-db-cache-update.service
|
||||
%{_unitdir}/man-db-restart-cache-update.service
|
||||
%{_sbindir}/accessdb
|
||||
%{_bindir}/man
|
||||
%ghost %{_bindir}/man
|
||||
%ghost %{_bindir}/apropos
|
||||
%ghost %{_bindir}/whatis
|
||||
%{_bindir}/man.%{name}
|
||||
%{_bindir}/apropos.%{name}
|
||||
%{_bindir}/whatis.%{name}
|
||||
%{_bindir}/man-recode
|
||||
%{_bindir}/whatis
|
||||
%{_bindir}/apropos
|
||||
%{_bindir}/manpath
|
||||
%{_bindir}/lexgrog
|
||||
%{_bindir}/catman
|
||||
@ -155,13 +190,16 @@ fi
|
||||
%{_libexecdir}/man-db/zsoelim
|
||||
%verify(not mtime) %dir %{cache}
|
||||
# documentation and translation
|
||||
%{_mandir}/man1/apropos.1*
|
||||
%{_mandir}/man1/lexgrog.1*
|
||||
%{_mandir}/man1/man.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/man-recode.1*
|
||||
%{_mandir}/man1/lexgrog.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*
|
||||
@ -187,6 +225,9 @@ fi
|
||||
%config(noreplace) %{_sysconfdir}/cron.daily/man-db.cron
|
||||
|
||||
%changelog
|
||||
* Wed Feb 26 2020 Nikola Forró <nforro@redhat.com> - 2.9.1-2
|
||||
- use alternatives for man, apropos and whatis
|
||||
|
||||
* Wed Feb 26 2020 Nikola Forró <nforro@redhat.com> - 2.9.1-1
|
||||
- update to 2.9.1
|
||||
resolves #1807144
|
||||
|
Loading…
Reference in New Issue
Block a user