# Copyright 1999-2016 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: f85716720cbe0d49ee037c8f5ccf613f9ad3a5c9 $ EAPI=5 PATCHSET=1 inherit eutils java-pkg-opt-2 systemd user webapp 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="apache asterisk cgi dhcpd doc http ipmi ipv6 irc java memcached minimal mysql postgres ssl syslog systemd test" 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 cgi? ( || ( virtual/httpd-cgi virtual/httpd-fastcgi ) ) 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 < "${ED}"/usr/lib/tmpfiles.d/${CATEGORY}:${PN}:${SLOT}.conf <> "${T}"/munin.env < "${ED}"/etc/logrotate.d/munin dosym ipmi_ /usr/libexec/munin/plugins/ipmi_sensor_ if use syslog; then sed -i -e '/log_file/s| .*| Sys::Syslog|' \ "${ED}"/etc/munin/munin-node.conf \ || die "Adding syslog support to '/etc/munin/munin-node.conf' failed" fi # Use a simpler pid file to avoid trouble with /run in tmpfs. The # munin-node service is run as user root, and only later drops # privileges. sed -i -e 's:/run/munin/munin-node.pid:/run/munin-node.pid:' \ "${ED}"/etc/munin/munin-node.conf \ || die "Flattening PID path in '/etc/munin/munin-node.conf' failed" keepdir /var/spool/munin-async/.ssh touch "${ED}"/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 "${ED}"/usr/libexec/munin/plugins/munin_stats else # remove font files so that we don't have to keep them around rm "${ED}"/usr/libexec/${PN}/*.ttf \ || die "Removing font files failed" if use cgi; then sed -i -e '/#graph_strategy cgi/s:^#::' \ "${ED}"/etc/munin/munin.conf \ || die "Updating graph_strategy to 'cgi' in '/etc/munin/munin-node.conf' failed" 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:' \ "${ED}"/etc/munin/munin.conf \ || die "Updating graph_strategy to 'cron' in '/etc/munin/munin-node.conf' failed" fi keepdir /var/lib/munin/.ssh cat - >> "${ED}"/var/lib/munin/.ssh/config <