1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
10 DESCRIPTION="An automated suite of programs for configuring and maintaining
12 HOMEPAGE="http://www.cfengine.org/"
13 SRC_URI="http://cfengine.com/source-code/download?file=${MY_P}.tar.gz -> ${MY_P}.tar.gz"
17 KEYWORDS="amd64 ~arm ~ppc ~s390 ~sparc x86"
19 IUSE="examples html libvirt mysql postgres +qdbm selinux tests tokyocabinet vim-syntax"
21 DEPEND=">=sys-libs/db-4
22 mysql? ( virtual/mysql )
23 postgres? ( dev-db/postgresql )
24 selinux? ( sys-libs/libselinux )
25 tokyocabinet? ( dev-db/tokyocabinet )
27 libvirt? ( app-emulation/libvirt )
28 >=dev-libs/openssl-0.9.7
31 PDEPEND="vim-syntax? ( app-vim/cfengine-syntax )"
33 REQUIRED_USE="^^ ( qdbm tokyocabinet )"
35 S="${WORKDIR}/${MY_P}"
38 # Enforce /var/cfengine for historical compatibility
41 --docdir=/usr/share/doc/${PF} \
42 --with-workdir=/var/cfengine \
45 $(use_with tokyocabinet) \
46 $(use_with postgres postgresql) \
51 # Fix Makefile to skip inputs, see below "examples"
52 #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
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
63 emake DESTDIR="${D}" install || die
65 # Evil workaround for now..
66 mv "${D}"/usr/share/doc/${PN}/ "${D}"/usr/share/doc/${PF}
70 if ! use examples; then
71 rm -rf "${D}"/usr/share/doc/${PF}/example*
74 # Create cfengine working directory
75 dodir /var/cfengine/bin
76 fperms 700 /var/cfengine
78 # Copy cfagent into the cfengine tree otherwise cfexecd won't
79 # find it. Most hosts cache their copy of the cfengine
80 # binaries here. This is the default search location for the
82 for bin in know promises agent monitord serverd execd runagent key report; do
83 dosym /usr/sbin/cf-$bin /var/cfengine/bin/cf-$bin || die
88 dohtml -r docs/ || die
94 elog "NOTE: BDB (BerkelyDB) support has been removed as of ${PN}-3.3.0"
96 einfo "Init scripts for cf-serverd, cf-monitord, and cf-execd are provided."
98 einfo "To run cfengine out of cron every half hour modify your crontab:"
99 einfo "0,30 * * * * /usr/sbin/cf-execd -F"
102 elog "If you run cfengine the very first time, you MUST generate the keys for cfengine by running:"
103 elog "emerge --config ${CATEGORY}/${PN}"
105 # Fix old cf-servd, remove it after some releases.
107 for fname in $(find /etc/runlevels/ -type f -or -type l -name 'cf-servd'); do
110 ln -s /etc/init.d/cf-serverd $(echo $fname | sed 's:cf-servd:cf-serverd:')
113 if [ "${found}" -eq 1 ]; then
115 elog "/etc/init.d/cf-servd has been renamed to /etc/init.d/cf-serverd"
120 if [ "${ROOT}" == "/" ]; then
121 if [ ! -f "/var/cfengine/ppkeys/localhost.priv" ]; then
122 einfo "Generating keys for localhost."
126 die "cfengine cfkey does not support any value of ROOT other than /."