cfengine-2.2.10-r4.ebuild 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. # Copyright 1999-2013 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="2"
  4. inherit eutils multilib
  5. DESCRIPTION="An automated suite of programs for configuring and maintaining
  6. Unix-like computers"
  7. HOMEPAGE="http://www.cfengine.org/"
  8. SRC_URI="http://cfengine.com/source_code/download?file=${P}.tar.gz -> ${P}.tar.gz"
  9. LICENSE="GPL-2"
  10. SLOT="0"
  11. KEYWORDS="amd64 arm ppc ppc64 ~s390 sparc x86"
  12. IUSE="vim-syntax"
  13. RDEPEND=">=sys-libs/db-4
  14. >=dev-libs/openssl-0.9.7
  15. app-portage/portage-utils"
  16. DEPEND="${RDEPEND}
  17. virtual/yacc
  18. sys-devel/flex"
  19. PDEPEND="vim-syntax? ( app-vim/cfengine-syntax )"
  20. src_prepare() {
  21. # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=520696
  22. # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=511666
  23. # https://bugs.gentoo.org/339808
  24. epatch "${FILESDIR}/admit-noclass-520696.patch" \
  25. "${FILESDIR}/511666-segfault.patch" \
  26. "${FILESDIR}/${P}-snprintf_buffer_overflow.patch"
  27. # 2048 causes crashes on some 32-bit hardened kernels, and the warning
  28. # messages say to turn it back down.
  29. use x86 && sed -ie "s:CF_IFREQ 2048:CF_IFREQ 1024:g" src/cf.defs.h
  30. }
  31. src_configure() {
  32. # Enforce /var/cfengine for historical compatibility
  33. econf \
  34. --with-workdir=/var/cfengine \
  35. --with-berkeleydb=/usr
  36. # Fix Makefile to skip doc,inputs, & contrib install to wrong locations
  37. sed -i -e 's/\(DIST_SUBDIRS.*\) contrib inputs doc/\1/' Makefile
  38. sed -i -e 's/\(SUBDIRS.*\) contrib inputs/\1/' Makefile
  39. sed -i -e 's/\(install-data-am.*\) install-docDATA/\1/' Makefile
  40. # Fix man pages
  41. sed -i -e 's/\/usr\/local/\/usr/' doc/*.8
  42. }
  43. src_install() {
  44. newinitd "${FILESDIR}"/cfservd.rc6 cfservd || die
  45. newinitd "${FILESDIR}"/cfenvd.rc6 cfenvd || die
  46. newinitd "${FILESDIR}"/cfexecd.rc6 cfexecd || die
  47. make DESTDIR="${D}" install || die
  48. # Remove static library and libtool file as they are not needed
  49. rm "${D}"/usr/$(get_libdir)/*.la
  50. rm "${D}"/usr/$(get_libdir)/*.a
  51. dodoc AUTHORS ChangeLog README TODO INSTALL
  52. # Manually install doc and inputs
  53. doman doc/*.8
  54. docinto examples
  55. doinfo doc/*.info*
  56. dodoc inputs/*.example
  57. # Create cfengine working directory
  58. mkdir -p "${D}"/var/cfengine
  59. fperms 700 /var/cfengine
  60. keepdir /var/cfengine/bin
  61. keepdir /var/cfengine/inputs
  62. dodir /var/cfengine/modules
  63. }
  64. pkg_postinst() {
  65. # Copy cfagent into the cfengine tree otherwise cfexecd won't
  66. # find it. Most hosts cache their copy of the cfengine
  67. # binaries here. This is the default search location for the
  68. # binaries.
  69. cp -f /usr/sbin/cf{agent,servd,execd} "${ROOT}"/var/cfengine/bin/
  70. einfo
  71. einfo "NOTE: The cfportage module has been deprecated in favor of the"
  72. einfo " upstream 'packages' action."
  73. einfo
  74. einfo "Init scripts for cfservd, cfenvd, and cfexecd are now provided."
  75. einfo
  76. einfo "To run cfengine out of cron every half hour modify your crontab:"
  77. einfo "0,30 * * * * /usr/sbin/cfexecd -F"
  78. einfo
  79. elog "You MUST generate the keys for cfengine by running:"
  80. elog "emerge --config ${CATEGORY}/${PN}"
  81. }
  82. pkg_config() {
  83. if [ "${ROOT}" == "/" ]; then
  84. if [ ! -f "/var/cfengine/ppkeys/localhost.priv" ]; then
  85. einfo "Generating keys for localhost."
  86. /usr/sbin/cfkey
  87. fi
  88. else
  89. die "cfengine cfkey does not support any value of ROOT other than /."
  90. fi
  91. }