cfengine-3.6.2.ebuild 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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.package-repos.s3.amazonaws.com/tarballs/${MY_P}.tar.gz -> ${MY_P}.tar.gz"
  12. LICENSE="GPL-3"
  13. SLOT="3"
  14. KEYWORDS="~amd64 ~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}/${P}-ifconfig.patch"
  36. eautoreconf
  37. }
  38. src_configure() {
  39. # Enforce /var/cfengine for historical compatibility
  40. econf \
  41. --enable-fhs \
  42. --docdir=/usr/share/doc/${PF} \
  43. --with-workdir=/var/cfengine \
  44. --with-pcre \
  45. $(use_with acl libacl) \
  46. $(use_with qdbm) \
  47. $(use_with tokyocabinet) \
  48. $(use_with postgres postgresql) \
  49. $(use_with mysql mysql check) \
  50. $(use_with libvirt) \
  51. $(use_enable selinux)
  52. # Fix Makefile to skip inputs, see below "examples"
  53. #sed -i -e 's/\(SUBDIRS.*\) inputs/\1/' Makefile || die
  54. # We install the documentation through portage
  55. sed -i -e 's/\(install-data-am.*\) install-docDATA/\1/' Makefile || die
  56. }
  57. src_install() {
  58. newinitd "${FILESDIR}"/cf-serverd.rc6 cf-serverd || die
  59. newinitd "${FILESDIR}"/cf-monitord.rc6 cf-monitord || die
  60. newinitd "${FILESDIR}"/cf-execd.rc6 cf-execd || die
  61. emake DESTDIR="${D}" install || die
  62. # fix ifconfig path in provided promises
  63. find "${D}"/usr/share -name "*.cf" | xargs sed -i "s,/sbin/ifconfig,$(which ifconfig),g"
  64. # Evil workaround for now..
  65. mv "${D}"/usr/share/doc/${PN}/ "${D}"/usr/share/doc/${PF}
  66. dodoc AUTHORS
  67. if ! use examples; then
  68. rm -rf "${D}"/usr/share/doc/${PF}/example*
  69. fi
  70. # Create cfengine working directory
  71. dodir /var/cfengine/bin
  72. fperms 700 /var/cfengine
  73. # Copy cfagent into the cfengine tree otherwise cfexecd won't
  74. # find it. Most hosts cache their copy of the cfengine
  75. # binaries here. This is the default search location for the
  76. # binaries.
  77. for bin in promises agent monitord serverd execd runagent key; do
  78. dosym /usr/sbin/cf-$bin /var/cfengine/bin/cf-$bin || die
  79. done
  80. }
  81. pkg_postinst() {
  82. echo
  83. elog "NOTE: BDB (BerkelyDB) support has been removed as of ${PN}-3.3.0"
  84. echo
  85. einfo "Init scripts for cf-serverd, cf-monitord, and cf-execd are provided."
  86. einfo
  87. einfo "To run cfengine out of cron every half hour modify your crontab:"
  88. einfo "0,30 * * * * /usr/sbin/cf-execd -F"
  89. echo
  90. elog "If you run cfengine the very first time, you MUST generate the keys for cfengine by running:"
  91. elog "emerge --config ${CATEGORY}/${PN}"
  92. # Fix old cf-servd, remove it after some releases.
  93. local found=0
  94. for fname in $(find /etc/runlevels/ -type f -or -type l -name 'cf-servd'); do
  95. found=1
  96. rm $fname
  97. ln -s /etc/init.d/cf-serverd $(echo $fname | sed 's:cf-servd:cf-serverd:')
  98. done
  99. if [ "${found}" -eq 1 ]; then
  100. echo
  101. elog "/etc/init.d/cf-servd has been renamed to /etc/init.d/cf-serverd"
  102. fi
  103. }
  104. pkg_config() {
  105. if [ "${ROOT}" == "/" ]; then
  106. if [ ! -f "/var/cfengine/ppkeys/localhost.priv" ]; then
  107. einfo "Generating keys for localhost."
  108. /usr/sbin/cf-key
  109. fi
  110. else
  111. die "cfengine cfkey does not support any value of ROOT other than /."
  112. fi
  113. }