diff options
-rw-r--r-- | net-analyzer/munin/Manifest | 3 | ||||
-rw-r--r-- | net-analyzer/munin/munin-2.0.33.ebuild | 447 |
2 files changed, 450 insertions, 0 deletions
diff --git a/net-analyzer/munin/Manifest b/net-analyzer/munin/Manifest index 38f758ca..568083a7 100644 --- a/net-analyzer/munin/Manifest +++ b/net-analyzer/munin/Manifest @@ -20,6 +20,9 @@ AUX munin.apache.include-2.4 577 SHA256 21245e9eb7b759d2d2e65c2d1424da6d8c6fd8f4 AUX webapp-hook-1.0.0 2253 SHA256 e3ac807ec0e34e7b91105ec0b6c15828275d57996a9488d616dd34b140d16b32 SHA512 d2dfdb3ae06863b1e2bf167824df9bd11c4e3edb234d14e5f01a6a182634380033da05c7d041ee2ec81144fb457393b25b3a13005e8b92b94c27aea20894b145 WHIRLPOOL a50100b11dfc945040a4923b4c3f40978f07678791650fe39c1d677d4accaacd61d5315da77f7022565962f13134baac166c9fce4df877705134370439c504b3 DIST munin-2.0.19-gentoo-1.tar.xz 10884 SHA256 e9fcec3cd671a0008348ab3f33e435073bbfca328e3f026552d18d88b131ae30 SHA512 f4d4b20c9250f1f7a2772da7541a1cb60c6f0e64804a5f40452c4e54534a6d47ece583ef1a755e71bd98e474b6b1842dcad5d8165e558ccf2b88669e4a090599 WHIRLPOOL 5f796db3b2f29b069b77f2d06f530221272675af0d65423a945010ebef742a623a9bff0e9c705e8db94c5ab2ec81a0a10a46884afc23d92fc640b3ae0d45e91b DIST munin-2.0.19.tar.gz 1335496 SHA256 13db9b00d432b92907d61f9f2bd18c2aafca03b2a6e257222fff17aa4ed02896 SHA512 c08ab54634587bb2abc4e55e52114d417ce9f3d2b421c4f44c5df3506238ecd80d1f27359346404a4eab7d779a42bc3438ebb75210e979662f261de1521a464b WHIRLPOOL 288ac49ae86aff13591cbe7357afe963d6da95b3915d94ea3887a63347dbd45969d3a86d8378d2c6ddcb3b8ad24f27ff95ce2567cdfbb216e6584219db7800e1 +DIST munin-2.0.33-gentoo-1.tar.xz 11024 SHA256 f956d9051e0da05231bb8777c0ca3342ca5bb86e48c44a68289c41c42c440e46 SHA512 c1f49f01fd641e157145d9710a091696c09380887a374ee845e516d40384ee6bc576019f3510ac322436b1f10ee1b675ae512b9f677a6a0fa2ef022cbb7269b8 WHIRLPOOL 3c0fbccc4c8ee9a2dacf8ce1845d149198c8d53ed17cd62fd17bae60986ca6616e12213d4f520fd06e8329accec559a7f9529559f21dc62de3aa0b66680d7ab7 +DIST munin-2.0.33.tar.gz 1349546 SHA256 99dbc1e5f4f0fed4e28f295245333544193f9a26c597f2a78571ae20b4d450b6 SHA512 33c56fcb347396f29662f304aa50f0e3dfc909b067ea49809762bbbb4dd2cd7e95789c318adcef64923e6d0248dcf9ea6fe933c49d920b6b7856d85511d40d67 WHIRLPOOL 2429b605d19bbf4caa460e9f2b46de8e2462bf606bd1143bcdcbb4f2e079b2acf5f87def86affa6152ed8b26cf14bc83d62274bb58424818deb2b5f2024de7f0 EBUILD munin-2.0.19-r1.ebuild 13553 SHA256 a4f8104b1a555ac089359c8baff41800bc46199fbc0b6f65295098d0332e6a8c SHA512 b669edbf6069ed918ae67cd86cb0db21b8cf8510a467a236d7a86eceb385844f2eea4a4f1d2f3f3bdc1a330f3f43c5358953d8b35f183e7ae9c9881ac61dda2f WHIRLPOOL bea2801d59e341899faa5d72190850cd2ecabd9e44f062593c19d3afa0f583276bc8cbf5e53ad181cc723b16e02cb4fe1ebe93abbe96ba06728ce36f038dfe4c EBUILD munin-2.0.19-r2.ebuild 13545 SHA256 40a7374cbe7ef7521b2dfb7c849d8d33b37164a76a456aac0dfda3940b81cbbd SHA512 4f5220ff42494b95f6a8c6ec406512cecc3531e968b9f1f757fb4635d027508f9e4a8e696e8bf5ada3767b6aef923ef4ce6eb95ebbfcf164073b5e39476fdf1e WHIRLPOOL 4041caa51589f7ed4b4546b8d8b1012e6a1d1710400ec68c284ba592f56b2a686c09682198fec6427af5a6b9bf2b4e9f5441ed1e0311cadce3a05f39c1f561f8 EBUILD munin-2.0.19.ebuild 13547 SHA256 ff5714c09e9368231672a8f45e5c8f168b55331c148277b5904f0f21fb7b2bc8 SHA512 4567aec8cddde068b9273702e21228ea0095bc046619cfd6b818cbe60838818477094ed935dba488bbd7d47765bc5e60fa6db8100c670ecd2265073000f103bb WHIRLPOOL ad81f819afe8cdc2b89cbd77da0afeabd37565761be0de4b41068e0180937086855dafd6fb26de116cee94f40c68ec9e84d2febc057c14f41ba227aebbe6b01d +EBUILD munin-2.0.33.ebuild 13941 SHA256 60fedd64d15e280e63860ca5b2ce42f5d1add543b9f6e86b3d47abb9761b18f1 SHA512 5cdc16c691f6840464b50aa22bfe36ee19493bacf74e6c54b0f62ed74904667f553748dff7364c3ee97fb2fdfc365e4b6e0894e94a4b4f709d0076c9e2f2e1e0 WHIRLPOOL 4e29d9beec28ecd31ae397059b57ed6ca2ccd7cf05baecb154a387942dd1c5dcdee702d81b22ab4c3f52a76fb4a9d11099f04252589c6c9c33cfec47fcb89235 diff --git a/net-analyzer/munin/munin-2.0.33.ebuild b/net-analyzer/munin/munin-2.0.33.ebuild new file mode 100644 index 00000000..a0bab4e0 --- /dev/null +++ b/net-analyzer/munin/munin-2.0.33.ebuild @@ -0,0 +1,447 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +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=" + https://github.com/munin-monitoring/munin/archive/${PV}.tar.gz -> ${P}.tar.gz + https://dev.gentoo.org/~graaff/munin/${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 selinux 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] + 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 + apache? ( www-servers/apache[apache2_modules_cgi,apache2_modules_cgid,apache2_modules_rewrite] ) + asterisk? ( dev-perl/Net-Telnet ) + cgi? ( + dev-perl/FCGI + dev-perl/CGI-Fast + ) + dhcpd? ( + >=net-misc/dhcp-3[server] + dev-perl/Net-IP + dev-perl/HTTP-Date + ) + doc? ( dev-python/sphinx ) + http? ( dev-perl/libwww-perl ) + irc? ( dev-perl/Net-IRC ) + kernel_linux? ( sys-process/procps ) + memcached? ( dev-perl/Cache-Memcached ) + mysql? ( + virtual/mysql + dev-perl/Cache-Cache + dev-perl/DBD-mysql + ) + postgres? ( dev-perl/DBD-Pg dev-db/postgresql:* ) + ssl? ( dev-perl/Net-SSLeay ) + syslog? ( virtual/perl-Sys-Syslog ) + !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 + ) + selinux? ( sec-policy/selinux-munin ) + !<sys-apps/openrc-0.11.8" + +S="${WORKDIR}/${MY_P}" + +pkg_setup() { + webapp_pkg_setup + + enewgroup munin + enewuser munin 177 -1 /var/lib/munin munin + enewuser munin-async -1 /bin/sh /var/spool/munin-async + esethome munin-async /var/spool/munin-async + + java-pkg-opt-2_pkg_setup +} + +src_prepare() { + epatch "${WORKDIR}"/patches/*.patch + + eapply_user + + java-pkg-opt-2_src_prepare +} + +src_configure() { + local cgidir='$(DESTDIR)/usr/libexec/munin/cgi' + use cgi || cgidir="${T}/useless/cgi-bin" + + local cgiuser=$(usex apache apache munin) + + cat >> "${S}"/Makefile.config <<- EOF + PREFIX=\$(DESTDIR)/usr + CONFDIR=\$(DESTDIR)/etc/munin + DOCDIR=${T}/useless/doc + MANDIR=\$(PREFIX)/share/man + LIBDIR=\$(PREFIX)/libexec/munin + HTMLDIR=\$(DESTDIR)/var/www/localhost/htdocs/munin + CGIDIR=${cgidir} + CGITMPDIR=\$(DESTDIR)/var/cache/munin-cgi + CGIUSER=${cgiuser} + DBDIR=\$(DESTDIR)/var/lib/munin + DBDIRNODE=\$(DESTDIR)/var/lib/munin-node + SPOOLDIR=\$(DESTDIR)/var/spool/munin-async + LOGDIR=\$(DESTDIR)/var/log/munin + PERLSITELIB=$(perl -V:vendorlib | cut -d"'" -f2) + JCVALID=$(usex java yes no) + STATEDIR=\$(DESTDIR)/var/run/munin + EOF +} + +# parallel make and install need to be fixed before, and I haven't +# gotten around to do so yet. +src_compile() { + emake -j1 + use doc && emake -C doc html +} + +src_test() { + if [[ ${EUID} == 0 ]]; then + eerror "You cannot run tests as root." + eerror "Please enable FEATURES=userpriv before proceeding." + return 1 + fi + + local testtargets="test-common test-node test-plugins" + use minimal || testtargets+=" test-master" + + LC_ALL=C emake -j1 ${testtargets} +} + +src_install() { + local dirs=" + /var/log/munin + /var/lib/munin/plugin-state + /etc/munin/plugin-conf.d + " + use minimal || dirs+=" /etc/munin/munin-conf.d/" + + webapp_src_preinst + + keepdir ${dirs} + fowners munin:munin ${dirs} + + # parallel install doesn't work and it's also pointless to have this + # run in parallel for now (because it uses internal loops). + emake -j1 DESTDIR="${ED}" $(usex minimal "install-minimal install-man" install) + + # we remove /run from the install, as it's not the package's to deal + # with. + rm -rf "${ED}"/run # || die + + # remove the plugins for non-Gentoo package managers; use -f so that + # it doesn't fail when installing on non-Linux platforms. + rm -f "${ED}"/usr/libexec/munin/plugins/{apt{,_all},yum} \ + || die "Failed to remove non-Gentoo package-manager plugins" + + if ! use minimal; then + dodir "${MY_HTDOCSDIR}"/{config,static,templates} + dodir "${MY_HTDOCSDIR}"/templates/partial + find "${ED}"/etc/munin/static/ -type f -exec mv -v {} "${ED}"/"${MY_HTDOCSDIR}"/static/ \; + find "${ED}"/etc/munin/templates/ -type f -not -name munin-\* -exec mv -v {} "${ED}"/"${MY_HTDOCSDIR}"/templates/partial/ \; + find "${ED}"/etc/munin/templates/ -type f -name munin-\* -exec mv -v {} "${ED}"/"${MY_HTDOCSDIR}"/templates/ \; + dodir "${MY_HTDOCSDIR}"/config/plugins + rmdir "${ED}"/etc/munin/templates/partial + rmdir "${ED}"/etc/munin/{plugins,static,templates} || die "Cannot remove directories from '${ED}/etc/'" + + # remove .htaccess files + find "${ED}" -type f -name .htaccess -delete || die "Failed to remove .htaccess files from destination '${ED}'" + rmdir "${ED}"/var/www/localhost/htdocs/munin || die "Cannot remove '${ED}/var/www/localhost/htdocs/munin' directory" + + if use cgi; then + dodir "${MY_CGIBINDIR}"/munin + mv "${ED}"/usr/libexec/munin/cgi/munin-cgi-graph "${ED}"/"${MY_CGIBINDIR}"/munin/ + mv "${ED}"/usr/libexec/munin/cgi/munin-cgi-html "${ED}"/"${MY_CGIBINDIR}"/munin/ + rmdir "${ED}"/usr/libexec/munin/cgi || die "Cannot remove '${ED}/usr/libexec/munin/cgi' directory" + + keepdir /var/cache/munin-cgi + touch "${ED}"/var/log/munin/munin-cgi-{graph,html}.log + + webapp_serverowned /var/cache/munin-cgi + webapp_serverowned /var/log/munin/munin-cgi-{graph,html}.log + else + keepdir /var/cache/munin-cgi + touch "${ED}"/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 + + fi + fi + + # The webapp application folder needs to be writable by the 'munin' user, + # as *all* HTML content is auto-generated by cron. Unfortunately, + # webapp-config does not seem to propagate permissions on this top-level + # directory, so the following statement appears in the hope that this will + # change at some point in the future... + webapp_serverowned "${MY_HTDOCSDIR}" + + # ... so we'll ensure that the correct permissions are set in a hook + # instead! + webapp_hook_script "${FILESDIR}"/webapp-hook-1.0.0 + + webapp_src_install + + dodoc "${FILESDIR}"/lighttpd.sample + + insinto /etc/munin/plugin-conf.d/ + newins "${FILESDIR}"/${PN}-1.3.2-plugins.conf munin-node + + newinitd "${FILESDIR}"/munin-node_init.d_2.0.19 munin-node + newconfd "${FILESDIR}"/munin-node_conf.d_1.4.6-r2 munin-node + + newinitd "${FILESDIR}"/munin-asyncd.init.2 munin-asyncd + + if use systemd; then + dodir /usr/lib/tmpfiles.d + cat > "${ED}"/usr/lib/tmpfiles.d/"${CATEGORY}:${PN}${SLOT:+:${SLOT}}.conf" <<- EOF + d /run/munin 0700 munin munin - - + EOF + + systemd_dounit "${FILESDIR}"/munin-async.service + systemd_dounit "${FILESDIR}"/munin-graph.{service,socket} + systemd_dounit "${FILESDIR}"/munin-html.{service,socket} + systemd_dounit "${FILESDIR}"/munin-node.service + fi + + cat >> "${T}"/munin.env <<- EOF + CONFIG_PROTECT=/var/spool/munin-async/.ssh + EOF + newenvd "${T}"/munin.env 50munin + + dodoc README ChangeLog INSTALL + if use doc; then + cd "${S}"/doc/_build/html || die + docinto html + dodoc -r * + cd "${S}" || die + fi + + dodir /etc/logrotate.d/ + sed -e "s:@CGIUSER@:$(usex apache apache munin):g" \ + "${FILESDIR}"/logrotate.d-munin.3 > "${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 -e '/#graph_strategy cgi/s:#graph_strategy cgi:graph_strategy cron:' \ + -i "${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 <<- EOF + IdentityFile /var/lib/munin/.ssh/id_ecdsa + IdentityFile /var/lib/munin/.ssh/id_rsa + EOF + + fowners munin:munin /var/lib/munin/.ssh/{,config} + fperms go-rwx /var/lib/munin/.ssh/{,config} + + insinto /usr/share/${PN} + doins "${FILESDIR}"/"${PN}-crontab" + doins "${FILESDIR}"/"${PN}-fcrontab" + fi +} + +pkg_config() { + if use minimal; then + einfo "Nothing to do." + return 0 + fi + + einfo "Press enter to install the default crontab for the munin master" + einfo "installation from /usr/share/${PN}/f?crontab" + einfo "If you have a large site, you may wish to customize it." + read + + ebegin "Setting up cron ..." + if has_version sys-process/fcron; then + fcrontab - -u munin < /usr/share/${PN}/fcrontab + else + # dcron is very fussy about syntax + # the following is the only form that works in BOTH dcron and vixie-cron + crontab - -u munin < /usr/share/${PN}/crontab + fi + eend $? + + einfo "Press enter to set up the SSH keys used for SSH transport" + read + + # generate one rsa (for legacy) and one ecdsa (for new systems) + ssh-keygen -t rsa \ + -f /var/lib/munin/.ssh/id_rsa -N '' \ + -C "created by portage for ${CATEGORY}/${PN}" || die + ssh-keygen -t ecdsa \ + -f /var/lib/munin/.ssh/id_ecdsa -N '' \ + -C "created by portage for ${CATEGORY}/${PN}" || die + chown -R munin:munin /var/lib/munin/.ssh || die + chmod 0600 /var/lib/munin/.ssh/id_{rsa,ecdsa} || die + + einfo "Your public keys are available in " + einfo " /var/lib/munin/.ssh/id_rsa.pub" + einfo " /var/lib/munin/.ssh/id_ecdsa.pub" + einfo "and follows for convenience" + echo + cat /var/lib/munin/.ssh/id_*.pub +} + +pkg_postinst() { + elog "Please follow the munin documentation to set up the plugins you" + elog "need, afterwards start munin-node." + elog "" + elog "To make use of munin-async, make sure to set up the corresponding" + elog "SSH key in /var/lib/munin-async/.ssh/authorized_keys" + elog "" + if ! use minimal; then + elog "Please run" + elog " emerge --config net-analyzer/munin" + elog "to automatically configure munin's cronjobs as well as generate" + elog "passwordless SSH keys to be used with munin-async." + fi + elog "" + elog "Further information about setting up Munin in Gentoo can be found" + elog "in the Gentoo Wiki: https://wiki.gentoo.org/wiki/Munin" + + if use cgi; then + #chown $(usex apache apache munin) \ + # "${EROOT}"/var/cache/munin-cgi \ + # "${EROOT}"/var/log/munin/munin-cgi-{graph,html}.log + + if use apache; then + elog "To use Munin with CGI you should include /etc/apache2/vhosts.d/munin.include" + elog "or /etc/apache2/vhosts.d/munin-2.4.include (for Apache 2.4) from the virtual" + elog "host you want it to be served." + elog "If you want to enable CGI-based HTML as well, you have to add to" + elog "/etc/conf.d/apache2 the option -D MUNIN_HTML_CGI." + else + elog "Effective CGI support has just been added in 2.0.7-r6." + elog "Documentation on how to use it is still sparse." + elog "" + elog "An example lighttpd CGI configuration excerpt has been deployed to" + elog "/usr/share/doc/${PF}/" + fi + fi + + # we create this here as we don't want Portage to check /run + # symlinks but we still need this to be present before the reboot. + if ! use minimal; then + if [[ -d "${ROOT}"/run ]]; then + if ! [[ -d "${ROOT}"/run/munin ]]; then + mkdir "${ROOT}"/run/munin + chown munin:munin "${ROOT}"/run/munin + chmod 0700 "${ROOT}"/run/munin + fi + elif [[ -d "${ROOT}"/var/run ]]; then + if ! [[ -d "${ROOT}"/var/run/munin ]]; then + mkdir "${ROOT}"/var/run/munin + chown munin:munin "${ROOT}"/var/run/munin + chmod 0700 "${ROOT}"/var/run/munin + fi + fi + fi +} + +# vi: set diffopt=iwhite,filler: |