# Copyright 1999-2016 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id$ EAPI=5 PATCHSET=1 inherit eutils user java-pkg-opt-2 systemd MY_P=${P/_/-} DESCRIPTION="Munin Server Monitoring Tool" HOMEPAGE="http://munin-monitoring.org/" SRC_URI="mirror://sourceforge/munin/${MY_P}.tar.gz https://dev.gentoo.org/~flameeyes/${PN}/${P}-gentoo-${PATCHSET}.tar.xz" LICENSE="GPL-2" SLOT="0" KEYWORDS="amd64 ~arm ~mips ppc x86" IUSE="asterisk irc java memcached minimal mysql postgres ssl test cgi ipv6 syslog ipmi http dhcpd doc apache" REQUIRED_USE="cgi? ( !minimal ) apache? ( cgi )" # Upstream's listing of required modules is NOT correct! # Some of the postgres plugins use DBD::Pg, while others call psql directly. # Some of the mysql plugins use DBD::mysql, while others call mysqladmin directly. # We replace the original ipmi plugins with the freeipmi_ plugin which at least works. DEPEND_COM="dev-lang/perl[berkdb] kernel_linux? ( sys-process/procps ) doc? ( dev-python/sphinx ) asterisk? ( dev-perl/Net-Telnet ) irc? ( dev-perl/Net-IRC ) mysql? ( virtual/mysql dev-perl/Cache-Cache dev-perl/DBD-mysql ) ssl? ( dev-perl/Net-SSLeay ) postgres? ( dev-perl/DBD-Pg dev-db/postgresql ) memcached? ( dev-perl/Cache-Memcached ) cgi? ( dev-perl/FCGI ) apache? ( www-servers/apache[apache2_modules_cgi,apache2_modules_cgid,apache2_modules_rewrite] ) syslog? ( virtual/perl-Sys-Syslog ) http? ( dev-perl/libwww-perl ) dhcpd? ( >=net-misc/dhcp-3[server] dev-perl/Net-IP dev-perl/HTTP-Date ) dev-perl/DBI dev-perl/Date-Manip dev-perl/File-Copy-Recursive dev-perl/List-MoreUtils dev-perl/Log-Log4perl dev-perl/Net-CIDR dev-perl/Net-DNS dev-perl/Net-Netmask dev-perl/Net-SNMP dev-perl/Net-Server[ipv6(-)?] virtual/perl-Digest-MD5 virtual/perl-Getopt-Long virtual/perl-MIME-Base64 virtual/perl-Storable virtual/perl-Text-Balanced virtual/perl-Time-HiRes !minimal? ( dev-perl/HTML-Template dev-perl/IO-Socket-INET6 dev-perl/URI >=net-analyzer/rrdtool-1.3[graph,perl] virtual/ssh )" # Keep this seperate, as previous versions have had other deps here DEPEND="${DEPEND_COM} dev-perl/Module-Build java? ( >=virtual/jdk-1.5 ) test? ( dev-perl/Test-Deep dev-perl/Test-LongString dev-perl/Test-Differences dev-perl/Test-MockModule dev-perl/Test-MockObject dev-perl/File-Slurp dev-perl/IO-stringy dev-perl/IO-Socket-INET6 )" RDEPEND="${DEPEND_COM} virtual/awk ipmi? ( >=sys-libs/freeipmi-1.1.6-r1 ) java? ( >=virtual/jre-1.5 || ( net-analyzer/netcat6 net-analyzer/netcat ) ) !minimal? ( virtual/cron media-fonts/dejavu ) !> "${S}"/Makefile.config < "${D}"/usr/lib/tmpfiles.d/${CATEGORY}:${PN}:${SLOT}.conf <> "${T}"/munin.env < "${D}"/etc/logrotate.d/munin dosym ipmi_ /usr/libexec/munin/plugins/ipmi_sensor_ if use syslog; then sed -i -e '/log_file/s| .*| Sys::Syslog|' \ "${D}"/etc/munin/munin-node.conf || die fi # Use a simpler pid file to avoid trouble with /run in tmpfs. The # munin-node service is ran as user root, and only later drops # privileges. sed -i -e 's:/run/munin/munin-node.pid:/run/munin-node.pid:' \ "${D}"/etc/munin/munin-node.conf || die keepdir /var/spool/munin-async/.ssh touch "${D}"/var/spool/munin-async/.ssh/authorized_keys fowners munin-async:munin /var/spool/munin-async{,/.ssh/{,authorized_keys}} fperms 0750 /var/spool/munin-async{,/.ssh} fperms 0600 /var/spool/munin-async/.ssh/authorized_keys if use minimal; then # This requires the presence of munin-update, which is part of # the non-minimal install... rm "${D}"/usr/libexec/munin/plugins/munin_stats else # remove font files so that we don't have to keep them around rm "${D}"/usr/libexec/${PN}/*.ttf || die if use cgi; then sed -i -e '/#graph_strategy cgi/s:^#::' "${D}"/etc/munin/munin.conf || die keepdir /var/cache/munin-cgi touch "${D}"/var/log/munin/munin-cgi-{graph,html}.log fowners $(usex apache apache munin) \ /var/cache/munin-cgi \ /var/log/munin/munin-cgi-{graph,html}.log if use apache; then insinto /etc/apache2/vhosts.d newins "${FILESDIR}"/munin.apache.include munin.include newins "${FILESDIR}"/munin.apache.include-2.4 munin-2.4.include fi else sed -i -e '/#graph_strategy cgi/s:#graph_strategy cgi:graph_strategy cron:' "${D}"/etc/munin/munin.conf || die fi keepdir /var/lib/munin/.ssh cat - >> "${D}"/var/lib/munin/.ssh/config <> "${D}"/usr/share/${PN}/crontab <> "${D}"/usr/share/${PN}/fcrontab <