net-analyzer/wapiti: drop old
[gentoo.git] / net-analyzer / nagios-plugins / nagios-plugins-2.3.1-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 DESCRIPTION="Official plugins for Nagios"
7 HOMEPAGE="http://nagios-plugins.org/"
8 SRC_URI="http://nagios-plugins.org/download/${P}.tar.gz"
9
10 LICENSE="GPL-2"
11 SLOT="0"
12 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
13 IUSE="ipv6 ldap libressl mysql nagios-dns nagios-ping nagios-game postgres radius samba selinux snmp ssh +ssl"
14
15 # Most of the plugins use automagic dependencies, i.e. the plugin will
16 # get built if the binary it uses is installed. For example, check_snmp
17 # will be built only if snmpget from net-analyzer/net-snmp[-minimal] is
18 # installed. End result: most of our runtime dependencies are required
19 # at build time as well.
20 AUTOMAGIC_DEPEND="
21         nagios-dns? ( net-dns/bind-tools )
22         nagios-game? ( games-util/qstat )
23         nagios-ping? ( net-analyzer/fping )
24         samba? ( net-fs/samba )
25         ssh? ( net-misc/openssh )
26         snmp? ( dev-perl/Net-SNMP
27                         net-analyzer/net-snmp[-minimal] )"
28
29 # Perl really needs to run during the build...
30 BDEPEND="${AUTOMAGIC_DEPEND}
31         dev-lang/perl"
32
33 DEPEND="
34         ldap? ( net-nds/openldap )
35         mysql? ( dev-db/mysql-connector-c )
36         postgres? ( dev-db/postgresql:* )
37         ssl? (
38                 !libressl? ( dev-libs/openssl:0 )
39                 libressl? ( dev-libs/libressl )
40         )
41         radius? ( net-dialup/freeradius-client )"
42
43 # Basically everything in net-analyzer/monitoring-plugins collides with
44 # nagios-plugins. Perl (from BDEPEND) is needed at runtime, too.
45 RDEPEND="${BDEPEND}
46         ${DEPEND}
47         !net-analyzer/monitoring-plugins
48         selinux? ( sec-policy/selinux-nagios )"
49
50 # At least one test is interactive.
51 RESTRICT="test"
52
53 DOCS=(
54         ACKNOWLEDGEMENTS
55         AUTHORS
56         CODING
57         ChangeLog
58         FAQ
59         NEWS
60         README
61         REQUIREMENTS
62         SUPPORT
63         THANKS
64 )
65
66 PATCHES=( "${FILESDIR}/define-own-mysql-port-constant.patch" )
67
68 src_prepare() {
69         default
70
71         # Fix the path to our perl interpreter
72         sed -i -e "1s:/usr/local/bin/perl:/usr/bin/perl:" \
73                 "${S}"/plugins-scripts/*.pl \
74                 || die 'failed to fix perl interpreter path'
75 }
76
77 src_configure() {
78         # Use an array to prevent econf from mangling the ping args.
79         local myconf=()
80
81         if use ssl; then
82                 myconf+=( $(use_with ssl openssl /usr) )
83         else
84                 myconf+=( --without-openssl )
85                 myconf+=( --without-gnutls )
86         fi
87
88         # The autodetection for these two commands can hang if localhost is
89         # down or ICMP traffic is filtered. Bug #468296.
90         myconf+=( --with-ping-command="/bin/ping -n -U -w %d -c %d %s" )
91
92         if use ipv6; then
93                 myconf+=( --with-ping6-command="/bin/ping6 -n -U -w %d -c %d %s" )
94         fi
95
96         econf \
97                 $(use_with mysql) \
98                 $(use_with ipv6) \
99                 $(use_with ldap) \
100                 $(use_with postgres pgsql /usr) \
101                 $(use_with radius) \
102                 "${myconf[@]}" \
103                 --libexecdir="/usr/$(get_libdir)/nagios/plugins" \
104                 --sysconfdir="/etc/nagios"
105 }
106
107 pkg_postinst() {
108         elog "This ebuild has a number of USE flags that determine what you"
109         elog "are able to monitor. Depending on what you want to monitor, some"
110         elog "or all of these USE flags need to be set."
111         elog
112         elog "The plugins are installed in ${ROOT}/usr/$(get_libdir)/nagios/plugins"
113 }