man-db-2.7.6.1-r2.ebuild 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils user versionator
  5. DESCRIPTION="a man replacement that utilizes berkdb instead of flat files"
  6. HOMEPAGE="http://www.nongnu.org/man-db/"
  7. SRC_URI="mirror://nongnu/${PN}/${P}.tar.xz"
  8. LICENSE="GPL-3"
  9. SLOT="0"
  10. KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-linux ~arm-linux ~x86-linux"
  11. IUSE="berkdb +gdbm +manpager nls selinux static-libs zlib"
  12. CDEPEND=">=dev-libs/libpipeline-1.4.0
  13. berkdb? ( sys-libs/db:= )
  14. gdbm? ( sys-libs/gdbm )
  15. !berkdb? ( !gdbm? ( sys-libs/gdbm ) )
  16. sys-apps/groff
  17. zlib? ( sys-libs/zlib )
  18. !sys-apps/man"
  19. DEPEND="${CDEPEND}
  20. app-arch/xz-utils
  21. virtual/pkgconfig
  22. nls? (
  23. >=app-text/po4a-0.45
  24. sys-devel/gettext
  25. )"
  26. RDEPEND="${CDEPEND}
  27. selinux? ( sec-policy/selinux-mandb )
  28. "
  29. PDEPEND="manpager? ( app-text/manpager )"
  30. pkg_setup() {
  31. # Create user now as Makefile in src_install does setuid/chown
  32. enewgroup man 15
  33. enewuser man 13 -1 /usr/share/man man
  34. if (use gdbm && use berkdb) || (use !gdbm && use !berkdb) ; then #496150
  35. ewarn "Defaulting to USE=gdbm due to ambiguous berkdb/gdbm USE flag settings"
  36. fi
  37. }
  38. src_configure() {
  39. export ac_cv_lib_z_gzopen=$(usex zlib)
  40. econf \
  41. --docdir='$(datarootdir)'/doc/${PF} \
  42. --with-systemdtmpfilesdir="${EPREFIX}"/usr/lib/tmpfiles.d \
  43. --enable-setuid \
  44. --enable-cache-owner=man \
  45. --with-sections="1 1p 8 2 3 3p 4 5 6 7 9 0p tcl n l p o 1x 2x 3x 4x 5x 6x 7x 8x" \
  46. $(use_enable nls) \
  47. $(use_enable static-libs static) \
  48. --with-db=$(usex gdbm gdbm $(usex berkdb db gdbm))
  49. # Disable color output from groff so that the manpager can add it. #184604
  50. sed -i \
  51. -e '/^#DEFINE.*\<[nt]roff\>/{s:^#::;s:$: -c:}' \
  52. src/man_db.conf || die
  53. }
  54. src_install() {
  55. default
  56. dodoc docs/{HACKING,TODO}
  57. prune_libtool_files
  58. exeinto /etc/cron.daily
  59. newexe "${FILESDIR}"/man-db.cron man-db #289884
  60. }
  61. pkg_preinst() {
  62. local cachedir="${EROOT}var/cache/man"
  63. # If the system was already exploited, and the attacker is hiding in the
  64. # cachedir of the old man-db, let's wipe them out.
  65. # see bug #602588 comment 18
  66. local _replacing_version=
  67. local _setgid_vuln=0
  68. for _replacing_version in ${REPLACING_VERSIONS}; do
  69. if version_is_at_least '2.7.6.1-r2' "${_replacing_version}"; then
  70. debug-print "Skipping security bug #602588 ... existing installation (${_replacing_version}) should not be affected!"
  71. else
  72. _setgid_vuln=1
  73. debug-print "Applying cleanup for security bug #602588"
  74. fi
  75. done
  76. [[ ${_setgid_vuln} -eq 1 ]] && rm -rf "${cachedir}"
  77. # Fall back to recreating the cachedir
  78. if [[ ! -d ${cachedir} ]] ; then
  79. mkdir -p "${cachedir}" || die
  80. chown man:man "${cachedir}" || die
  81. fi
  82. # Update the whatis cache
  83. if [[ -f ${cachedir}/whatis ]] ; then
  84. einfo "Cleaning ${cachedir} from sys-apps/man"
  85. find "${cachedir}" -type f '!' '(' -name index.bt -o -name index.db ')' -delete
  86. fi
  87. }
  88. pkg_postinst() {
  89. if [[ $(get_version_component_range 2 ${REPLACING_VERSIONS}) -lt 7 ]] ; then
  90. einfo "Rebuilding man-db from scratch with new database format!"
  91. mandb --quiet --create
  92. fi
  93. }