# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit depend.apache DESCRIPTION="Collects the data from a MySQL server and stores these values in a Round Robin Database." HOMEPAGE="http://gert.sos.be/en/" SRC_URI="http://gert.sos.be/downloads/mysqlar/${P}.tar.gz" LICENSE="GPL-1" SLOT="0" KEYWORDS="~x86 ~amd64" IUSE="" DEPEND="net-analyzer/rrdtool virtual/mysql" RDEPEND="virtual/cron virtual/httpd-php" src_compile() { econf --prefix=/usr \ --sysconfdir=/etc \ --datadir=/var/lib \ --localstatedir=/var/run \ || die "econf failed" emake || die "emake failed" } src_install() { emake DESTDIR="${D}" install \ || die "emake install failed." dodoc AUTHORS ChangeLog INSTALL NEWS README TODO # some fix's for install insinto /etc mv "${D}"/var/lib/mysqlard/mysqlard.cnf "${D}"/etc/mysqlard.cnf newinitd "${FILESDIR}"/mysqlard.rc mysqlard rm "${D}"/var/lib/mysqlard/mysqlard.server # cron entries insinto /var/lib/mysqlard newins "${FILESDIR}"/${PN}.crontab crontab # TODO: install apache config (to right place?) #insinto "${APACHE_VHOSTS_CONFDIR}" #newins "${FILESDIR}"/99_${PN}.httpd.conf 99_${PN}.conf newins "${FILESDIR}"/99_${PN}.httpd.conf ${PN}.httpd.conf # web files insinto /var/www/localhost/htdocs/mysqlard mv "${D}"/var/lib/mysqlard/mysqlar.php "${D}"/var/lib/mysqlard/*.gif \ "${D}"/var/lib/mysqlard/*.css "${D}"/var/www/localhost/htdocs/mysqlard sed -i 's:imgdir="${datadir}":imgdir="/var/www/localhost/htdocs/mysqlard":' "${D}"/etc/mysqlard.cnf keepdir /var/www/localhost/htdocs/mysqlard/archive # need if we use mysqlar.daily, mysqlar.weekly, etc } pkg_postinst() { einfo "" einfo "For full config run:" einfo " emerge --config ${CATEGORY}/${PN}" einfo "" einfo "mysqlar.php has been placed in /var/www/localhost/htdocs/mysqlard" einfo "You can setup it for web view in any other virtualhost by self" einfo "For appear Alias /mysqlard/ only add in virtualhost:" einfo "Include /var/lib/mysqlard/mysqlard.httpd.conf" } pkg_config() { einfo "" einfo "Add the 'mysqlar' user with USAGE privileges to your mysql server" einfo "When prompted for a password, enter your MySQL root password" echo "GRANT USAGE ON *.* TO mysqlar@localhost;" | "${ROOT}"/usr/bin/mysql -u root -p mysql einfo "" einfo "Press enter to install the mysqlard crontab to root's crontab" einfo "installation from /var/lib/mysqlard/crontab" read # the following is the only form that works in BOTH dcron and vixie-cron crontab - -u root < "${ROOT}"/var/lib/mysqlard/crontab einfo "" }