diff options
author | Diego Elio Pettenò <flameeyes@gentoo.org> | 2012-04-09 23:15:27 +0000 |
---|---|---|
committer | Diego Elio Pettenò <flameeyes@gentoo.org> | 2012-04-09 23:15:27 +0000 |
commit | b85407a6579aa2c9c03b02b22c4ea8438a10511f (patch) | |
tree | 3d57636cae04242b23e758b1a733fa1e9924058a /net-analyzer | |
parent | Compability patch for libmp4v2 >= r479 wrt #409281 by Tim Harder (diff) | |
download | gentoo-2-b85407a6579aa2c9c03b02b22c4ea8438a10511f.tar.gz gentoo-2-b85407a6579aa2c9c03b02b22c4ea8438a10511f.tar.bz2 gentoo-2-b85407a6579aa2c9c03b02b22c4ea8438a10511f.zip |
Fix bug #403961, thanks to Tom Hendrikx.
(Portage version: 2.2.0_alpha100/cvs/Linux x86_64)
Diffstat (limited to 'net-analyzer')
-rw-r--r-- | net-analyzer/munin/ChangeLog | 8 | ||||
-rw-r--r-- | net-analyzer/munin/files/munin-1.4.6-if_-hardened-v2.patch | 211 | ||||
-rw-r--r-- | net-analyzer/munin/munin-1.4.6-r5.ebuild | 157 |
3 files changed, 375 insertions, 1 deletions
diff --git a/net-analyzer/munin/ChangeLog b/net-analyzer/munin/ChangeLog index f410dbc01456..3bac51d869a5 100644 --- a/net-analyzer/munin/ChangeLog +++ b/net-analyzer/munin/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for net-analyzer/munin # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/munin/ChangeLog,v 1.67 2012/01/28 01:56:12 flameeyes Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/munin/ChangeLog,v 1.68 2012/04/09 23:15:27 flameeyes Exp $ + +*munin-1.4.6-r5 (09 Apr 2012) + + 09 Apr 2012; Diego E. Pettenò <flameeyes@gentoo.org> + +files/munin-1.4.6-if_-hardened-v2.patch, +munin-1.4.6-r5.ebuild: + Fix bug #403961, thanks to Tom Hendrikx. 28 Jan 2012; Diego E. Pettenò <flameeyes@gentoo.org> munin-1.4.6-r4.ebuild: Some mysql plugins (such as 'mysql_') do use DBD-mysql the same way PostgreSQL diff --git a/net-analyzer/munin/files/munin-1.4.6-if_-hardened-v2.patch b/net-analyzer/munin/files/munin-1.4.6-if_-hardened-v2.patch new file mode 100644 index 000000000000..bb72afb8bd84 --- /dev/null +++ b/net-analyzer/munin/files/munin-1.4.6-if_-hardened-v2.patch @@ -0,0 +1,211 @@ +diff --git a/plugins/node.d.linux/if_.in b/plugins/node.d.linux/if_.in +index da0fc31..63a5dfd 100755 +--- a/plugins/node.d.linux/if_.in ++++ b/plugins/node.d.linux/if_.in +@@ -43,7 +43,9 @@ monitored with this plugin. + + =head1 AUTHOR + +-Unknown author ++Original author unknown ++ ++Copyright (C) 2011 Diego Elio Petteno' <flameeyes@flameeyes.eu> + + =head1 LICENSE + +@@ -64,86 +66,71 @@ Unknown license + + INTERFACE=${0##*if_} + +-findspeed () { +- +- # Who whould have thought it's so much work to determine the +- # maximum speed of a network interface. Buckle up! +- +- IWLIST="$(type -p iwlist)" +- +- WIRELESS=0 ++# Who whould have thought it's so much work to determine the ++# maximum speed of a network interface. Buckle up! ++findspeed_mbps() { + # Do not use interface name to guess technology. Many many + # wifi drivers use "eth*" names. +- case $IWLIST in +- +- '') +- # Used to use iwconfig to look for "no wireless +- # extentions" message - but this seemed un-needed. If we +- # don't have iwlist we can't find out if # the interface +- # is wireless +- :;; +- *) IWO="$($IWLIST $INTERFACE rate 2>&1)" +- case $IWO in +- *no*) :;; +- *) WIRELESS=1;; +- esac +- ;; +- esac +- +- SPEED=U +- # Find speed in Mbps. - or not +- case $WIRELESS:$IWLIST in +- 0:*) +- ETHTOOL="$(type -p ethtool)" +- if [ -x "$ETHTOOL" ]; then +- SPEED="$($ETHTOOL $INTERFACE 2>&1 | +- awk '/Speed:/ { gsub(/[^0-9]*/,"",$2); print $2; }')" +- case $SPEED in +- [0-9]*) :;; # OK +- *) SPEED=U;; # Could be "unknown" +- esac +- else +- INSTALL="ethtool" ++ IWLIST="$(type -p iwlist)" ++ if [ -x "$IWLIST" ]; then ++ SPEED=$($IWLIST $INTERFACE rate 2>&1 | ++ awk 'BEGIN { RATE=U } ++ { if ($2 == "Mb/s") RATE=$1; } ++ END { print RATE; }') ++ ++ if [ "$SPEED" != "U" ]; then ++ echo $SPEED ++ return ++ fi ++ fi ++ ++ # sysfs can report the speed if the driver supports it (but it ++ # doesn't work as well for wireless cards, thus why we check for ++ # iwlist first) ++ if [ -r /sys/class/net/$INTERFACE/speed ]; then ++ SPEED="$(cat /sys/class/net/$INTERFACE/speed 2>/dev/null)" ++ if [ -n "$SPEED" ]; then ++ echo $SPEED ++ return + fi +- ;; +- 1:/*) +- # Current bit rate is not very interesting, it varies too often +- SPEED=$(echo "$IWO" | +- awk 'BEGIN { RATE=U } +- { if ($2 == "Mb/s") RATE=$1; } +- END { print RATE; }') +- +- ;; +- *) +- # Wireless interface, cannot find iwlist +- INSTALL="wireless-tools" +- ;; +- esac ++ fi ++ ++ ETHTOOL="$(type -p ethtool)" ++ if [ -x "$ETHTOOL" ]; then ++ SPEED="$($ETHTOOL $INTERFACE 2>&1 | ++ awk '/Speed:/ { gsub(/[^0-9]*/,"",$2); print $2; }')" ++ ++ if [ $SPEED = [0-9]* ]; then ++ echo $SPEED ++ return ++ fi ++ fi + + MIITOOL="$(type -p mii-tool)" +- case $SPEED:$MIITOOL in +- U:/*) +- SPEED="$($MIITOOL $INTERFACE 2>&1)" +- case $SPEED in +- *1000base*) SPEED=1000;; # as if... +- *100base*) SPEED=100;; +- *10base*) SPEED=10;; +- *) SPEED=U;; +- esac +- ;; +- esac +- +- # sysfs can report the speed if the driver supports it +- SYSFS="$(cat /sys/class/net/$INTERFACE/speed 2>/dev/null)" +- # If it can't, it fails on I/O, so we check cat's return value +- if [ $? -eq 0 -a "$SPEED" = "U" -a -n "$SYSFS" ]; then +- SPEED="$SYSFS" ++ if [ -x $MIITOOL ]; then ++ case $($MIITOOL $INTERFACE 2>&1) in ++ *1000base*) echo 1000; return ;; ++ *100base*) echo 100; return ;; ++ *10base*) echo 10; return ;; ++ esac + fi + +- case $SPEED in +- U) echo "up.info Traffic of the $INTERFACE interface. Unable to determine interface speed. Please install ethtool, wireless-tools (or mii-tool), whatever is appropriate for the interface." +- return;; +- esac ++ echo U ++} ++ ++findspeed() { ++ SPEED=$(findspeed_mbps) ++ ++ if [ -z $SPEED -o $SPEED = "U" ]; then ++ printf "up.info Traffic of the %s interface. Unable to determine interface speed." $INTERFACE ++ if [ $EUID -ne 0 ]; then ++ echo " Please run the plugin as root." ++ else ++ echo " Please install ethtool, wireless-tools, mii-tool or whatever is appropriate for the interface." ++ fi ++ ++ return ++ fi + + BPS=$(( $SPEED * 1000 * 1000 )) + +@@ -207,11 +194,15 @@ case $1 in + esac + + # Escape dots in the interface name (eg. vlans) before using it as a regex +-awk -v interface="$INTERFACE" \ +- 'BEGIN { gsub(/\./, "\\.", interface) } \ +- $1 ~ "^" interface ":" { +- split($0, a, /: */); $0 = a[2]; \ +- print "down.value " $1 "\nup.value " $9 \ +- }' \ +- /proc/net/dev +- ++if [ -r /sys/class/net/$INTERFACE/statistics/rx_bytes ]; then ++ echo "down.value $(cat /sys/class/net/$INTERFACE/statistics/rx_bytes)" ++ echo "up.value $(cat /sys/class/net/$INTERFACE/statistics/tx_bytes)" ++else ++ awk -v interface="$INTERFACE" \ ++ 'BEGIN { gsub(/\./, "\\.", interface) } \ ++ $1 ~ "^" interface ":" { ++ split($0, a, /: */); $0 = a[2]; \ ++ print "down.value " $1 "\nup.value " $9 \ ++ }' \ ++ /proc/net/dev ++fi +diff --git a/plugins/node.d.linux/if_err_.in b/plugins/node.d.linux/if_err_.in +index 331866d..2e35909 100755 +--- a/plugins/node.d.linux/if_err_.in ++++ b/plugins/node.d.linux/if_err_.in +@@ -93,10 +93,15 @@ if [ "$1" = "config" ]; then + fi; + + # Escape dots in the interface name (eg. vlans) before using it as a regex +-awk -v interface="$INTERFACE" \ +- 'BEGIN { gsub(/\./, "\\.", interface) } \ +- $1 ~ "^" interface ":" { +- split($0, a, /: */); $0 = a[2]; \ +- print "rcvd.value " $3 "\ntrans.value " $11 \ +- }' \ +- /proc/net/dev ++if [ -r /sys/class/net/$INTERFACE/statistics/rx_bytes ]; then ++ echo "rcvd.value $(cat /sys/class/net/$INTERFACE/statistics/rx_errors)" ++ echo "trans.value $(cat /sys/class/net/$INTERFACE/statistics/tx_errors)" ++else ++ awk -v interface="$INTERFACE" \ ++ 'BEGIN { gsub(/\./, "\\.", interface) } \ ++ $1 ~ "^" interface ":" { ++ split($0, a, /: */); $0 = a[2]; \ ++ print "rcvd.value " $3 "\ntrans.value " $11 \ ++ }' \ ++ /proc/net/dev ++fi diff --git a/net-analyzer/munin/munin-1.4.6-r5.ebuild b/net-analyzer/munin/munin-1.4.6-r5.ebuild new file mode 100644 index 000000000000..f884e73af183 --- /dev/null +++ b/net-analyzer/munin/munin-1.4.6-r5.ebuild @@ -0,0 +1,157 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/munin/munin-1.4.6-r5.ebuild,v 1.1 2012/04/09 23:15:27 flameeyes Exp $ + +EAPI=2 + +inherit eutils + +DESCRIPTION="Munin Server Monitoring Tool" +HOMEPAGE="http://munin.projects.linpro.no/" +SRC_URI="mirror://sourceforge/munin/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~mips ~ppc ~x86" +IUSE="asterisk doc irc java memcached minimal mysql postgres ssl" + +# 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. +DEPEND_COM="dev-lang/perl + sys-process/procps + asterisk? ( dev-perl/Net-Telnet ) + irc? ( dev-perl/Net-IRC ) + java? ( >=virtual/jdk-1.5 ) + mysql? ( virtual/mysql + dev-perl/Cache-Cache + dev-perl/DBD-mysql ) + ssl? ( dev-perl/Net-SSLeay ) + postgres? ( dev-perl/DBD-Pg dev-db/postgresql-base ) + memcached? ( dev-perl/Cache-Memcached ) + dev-perl/DateManip + dev-perl/Net-CIDR + dev-perl/Net-Netmask + dev-perl/Net-SNMP + dev-perl/libwww-perl + dev-perl/net-server + dev-perl/DBI + 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 + net-analyzer/rrdtool[perl] + dev-perl/Log-Log4perl )" + # Sybase isn't supported in Gentoo + #munin-sybase? ( dev-perl/DBD-Sybase ) + +# Keep this seperate, as previous versions have had other deps here +DEPEND="${DEPEND_COM} + virtual/perl-Module-Build" +RDEPEND="${DEPEND_COM} + !minimal? ( virtual/cron )" + +pkg_setup() { + enewgroup munin + enewuser munin 177 -1 /var/lib/munin munin +} + +src_prepare() { + # upstream needs a lot of DESTDIR loving + # and Gentoo location support + epatch "${FILESDIR}"/${PN}-1.4.4-Makefile.patch + + epatch "${FILESDIR}"/${PN}-1.4.6-apc-temp.patch + epatch "${FILESDIR}"/${PN}-1.4.6-munin-version-identifier.patch + epatch "${FILESDIR}"/${PN}-1.4.6-fix-asterisk-plugins.patch + epatch "${FILESDIR}"/${PN}-1.4.6-if_-hardened-v2.patch + epatch "${FILESDIR}"/${PN}-1.4.6-apc-multi.patch + + # Don't build java plugins if not requested via USE. + if ! use java; then + # sed is needed so the java plugins aren't automagically built. + sed -i -e 's: build-plugins-java : :' \ + -e 's: install-plugins-java : :' Makefile || die + fi + + # Bug 304447, fix for gentoo PS location + sed -i -e 's,/usr/bin/ps,/bin/ps,g' \ + "${S}"/plugins/node.d/ifx_concurrent_sessions_.in || die + + # bug 367785, cleanup make output by disabling HP-UX cruft + sed -i -e "/plugins\/\*\.adv/d" Makefile || die +} + +src_compile() { + emake -j 1 build build-man || die "build/build-man failed" + if use doc; then + emake -j 1 build-doc || die "build-doc failed" + fi + + #Ensure TLS is disabled if built without SSL + if ! use ssl; then + echo "tls disabled" >> ${S}/build/node/munin-node.conf \ + || die "Fixing munin-node.conf Failed!" + echo "tls disabled" >> ${S}/build/master/munin.conf \ + || die "Fixing munin.conf Failed!" + fi + +} + +src_install() { + local dirs + dirs="/var/log/munin/ /var/lib/munin/" + dirs="${dirs} /var/lib/munin/plugin-state/" + dirs="${dirs} /var/run/munin/plugin-state/" + dirs="${dirs} /var/run/munin/spool/" + dirs="${dirs} /etc/munin/plugin-conf.d/" + dirs="${dirs} /etc/munin/munin-conf.d/" + dirs="${dirs} /etc/munin/plugins/" + keepdir ${dirs} + + if use minimal; then + emake -j 1 DESTDIR="${D}" install-common-prime install-node-prime \ + install-plugins-prime || die "install failed" + else + emake -j 1 DESTDIR="${D}" install || die "install failed" + fi + fowners munin:munin ${dirs} || die + + insinto /etc/munin/plugin-conf.d/ + newins "${FILESDIR}"/${PN}-1.3.2-plugins.conf munin-node || die + + # make sure we've got everything in the correct directory + insinto /var/lib/munin + newins "${FILESDIR}"/${PN}-1.3.3-crontab crontab || die + newinitd "${FILESDIR}"/munin-node_init.d_1.4.6-r2 munin-node || die + newconfd "${FILESDIR}"/munin-node_conf.d_1.4.6-r2 munin-node || die + dodoc README ChangeLog INSTALL logo.eps logo.svg build/resources/apache* \ + || die + + # bug 254968 + insinto /etc/logrotate.d/ + newins "${FILESDIR}"/logrotate.d-munin munin || die +} + +pkg_config() { + einfo "Press enter to install the default crontab for the munin master" + einfo "installation from /var/lib/munin/crontab" + einfo "If you have a large site, you may wish to customize it." + read + # dcron is very fussy about syntax + # the following is the only form that works in BOTH dcron and vixie-cron + crontab - -u munin </var/lib/munin/crontab +} + +pkg_postinst() { + elog "Please follow the munin documentation to set up the plugins you" + elog "need, afterwards start munin-node via /etc/init.d/munin-node." + if ! use minimal; then + elog "To have munin's cronjob automatically configured for you if this is" + elog "your munin master installation, please:" + elog "emerge --config net-analyzer/munin" + fi +} |