cfengine-3.5.3.ebuild 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. inherit eutils autotools flag-o-matic
  5. MY_PV="${PV//_beta/b}"
  6. MY_PV="${MY_PV/_p/p}"
  7. MY_P="${PN}-${MY_PV}"
  8. DESCRIPTION="An automated suite of programs for configuring and maintaining
  9. Unix-like computers"
  10. HOMEPAGE="http://www.cfengine.org/"
  11. SRC_URI="http://cfengine.com/source-code/download?file=${MY_P}.tar.gz -> ${MY_P}.tar.gz"
  12. LICENSE="GPL-3"
  13. SLOT="3"
  14. KEYWORDS="~amd64 ~arm ~ppc ~s390 ~sparc ~x86"
  15. IUSE="acl examples libvirt mysql postgres +qdbm selinux tokyocabinet vim-syntax xml"
  16. DEPEND="acl? ( virtual/acl )
  17. mysql? ( virtual/mysql )
  18. postgres? ( dev-db/postgresql )
  19. selinux? ( sys-libs/libselinux )
  20. tokyocabinet? ( dev-db/tokyocabinet )
  21. qdbm? ( dev-db/qdbm )
  22. libvirt? ( app-emulation/libvirt )
  23. xml? ( dev-libs/libxml2:2 ) \
  24. dev-libs/openssl
  25. dev-libs/libpcre"
  26. RDEPEND="${DEPEND}"
  27. PDEPEND="vim-syntax? ( app-vim/cfengine-syntax )"
  28. REQUIRED_USE="qdbm? ( !tokyocabinet )
  29. tokyocabinet? ( !qdbm )
  30. !tokyocabinet? ( qdbm )
  31. !qdbm? ( tokyocabinet )"
  32. S="${WORKDIR}/${MY_P}"
  33. src_prepare() {
  34. default
  35. epatch "${FILESDIR}/${PN}-3.4.5-acl.patch"
  36. epatch "${FILESDIR}/${P}-ifconfig.patch"
  37. eautoreconf
  38. }
  39. src_configure() {
  40. # Enforce /var/cfengine for historical compatibility
  41. econf \
  42. --enable-fhs \
  43. --docdir=/usr/share/doc/${PF} \
  44. --with-workdir=/var/cfengine \
  45. --with-pcre \
  46. $(use_with acl libacl) \
  47. $(use_with qdbm) \
  48. $(use_with tokyocabinet) \
  49. $(use_with postgres postgresql) \
  50. $(use_with mysql mysql check) \
  51. $(use_with libvirt) \
  52. $(use_enable selinux)
  53. # Fix Makefile to skip inputs, see below "examples"
  54. #sed -i -e 's/\(SUBDIRS.*\) inputs/\1/' Makefile || die
  55. # We install the documentation through portage
  56. sed -i -e 's/\(install-data-am.*\) install-docDATA/\1/' Makefile || die
  57. }
  58. src_install() {
  59. newinitd "${FILESDIR}"/cf-serverd.rc6 cf-serverd || die
  60. newinitd "${FILESDIR}"/cf-monitord.rc6 cf-monitord || die
  61. newinitd "${FILESDIR}"/cf-execd.rc6 cf-execd || die
  62. emake DESTDIR="${D}" install || die
  63. # fix ifconfig path in provided promises
  64. find "${D}"/usr/share -name "*.cf" | xargs sed -i "s,/sbin/ifconfig,$(which ifconfig),g"
  65. # Evil workaround for now..
  66. mv "${D}"/usr/share/doc/${PN}/ "${D}"/usr/share/doc/${PF}
  67. dodoc AUTHORS
  68. if ! use examples; then
  69. rm -rf "${D}"/usr/share/doc/${PF}/example*
  70. fi
  71. # Create cfengine working directory
  72. dodir /var/cfengine/bin
  73. fperms 700 /var/cfengine
  74. # Copy cfagent into the cfengine tree otherwise cfexecd won't
  75. # find it. Most hosts cache their copy of the cfengine
  76. # binaries here. This is the default search location for the
  77. # binaries.
  78. for bin in promises agent monitord serverd execd runagent key; do
  79. dosym /usr/sbin/cf-$bin /var/cfengine/bin/cf-$bin || die
  80. done
  81. }
  82. pkg_postinst() {
  83. echo
  84. elog "NOTE: BDB (BerkelyDB) support has been removed as of ${PN}-3.3.0"
  85. echo
  86. einfo "Init scripts for cf-serverd, cf-monitord, and cf-execd are provided."
  87. einfo
  88. einfo "To run cfengine out of cron every half hour modify your crontab:"
  89. einfo "0,30 * * * * /usr/sbin/cf-execd -F"
  90. echo
  91. elog "If you run cfengine the very first time, you MUST generate the keys for cfengine by running:"
  92. elog "emerge --config ${CATEGORY}/${PN}"
  93. # Fix old cf-servd, remove it after some releases.
  94. local found=0
  95. for fname in $(find /etc/runlevels/ -type f -or -type l -name 'cf-servd'); do
  96. found=1
  97. rm $fname
  98. ln -s /etc/init.d/cf-serverd $(echo $fname | sed 's:cf-servd:cf-serverd:')
  99. done
  100. if [ "${found}" -eq 1 ]; then
  101. echo
  102. elog "/etc/init.d/cf-servd has been renamed to /etc/init.d/cf-serverd"
  103. fi
  104. }
  105. pkg_config() {
  106. if [ "${ROOT}" == "/" ]; then
  107. if [ ! -f "/var/cfengine/ppkeys/localhost.priv" ]; then
  108. einfo "Generating keys for localhost."
  109. /usr/sbin/cf-key
  110. fi
  111. else
  112. die "cfengine cfkey does not support any value of ROOT other than /."
  113. fi
  114. }