summaryrefslogtreecommitdiff
blob: d1b0e53b96bedcedf982a616f2eca5a07f46fdea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit eutils perl-module

DESCRIPTION="Nagios/Icinga plugin to check current server's RAID status"
HOMEPAGE="https://github.com/glensc/nagios-plugin-check_raid"
SRC_URI="${HOMEPAGE}/archive/${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="3ware aacraid dmraid hpa hpsa i2o megaraid-sas megaraid-scsi mpt mpt-sas2"

DEPEND="dev-perl/Monitoring-Plugin
		dev-perl/Module-Pluggable"
RDEPEND="${DEPEND}
		sys-apps/smartmontools
		sys-fs/lsscsi
		3ware? ( sys-block/tw_cli )
		aacraid? ( sys-block/arcconf )
		dmraid? ( sys-fs/dmraid )
		hpa? ( sys-block/hpacucli )
		hpsa? ( sys-apps/cciss_vol_status )
		i2o? ( sys-apps/raidutils )
		megaraid-sas? ( sys-block/megacli )
		megaraid-scsi? ( sys-block/megarc )
		mpt-sas2? ( sys-block/sas2ircu )
		mpt? ( sys-block/mpt-status )
		"

# TODO:
# Package all the other Perl build pieces, and stop using the monolithic perl script.
src_prepare() {
	# Upstream has a custom Makefile that is meant to build bundles.
	mv -f Makefile Makefile.upstream
	sed -i '/CPANfile/d' Makefile.PL
	default
}

src_install() {
	default
	plugindir="/usr/$(get_libdir)/nagios/plugins"
	dodir "$plugindir"
	mv -f "${D}"/usr/bin/check_raid.pl "${D}"/"${plugindir}"
	dodoc README.md ChangeLog.md CONTRIBUTING.md check_raid.cfg
}

pkg_postinst() {
	einfo "The following RAID controllers are supported without special tools:"
	einfo "GDT (Intel/ICP) RAID Controller"
	einfo "HP MSA (special configuration needed)"
	einfo "The following RAID controllers do not have tools packaged in Gentoo, but ARE supported by this tool:"
	einfo "Intel: CmdTool2"
	einfo "Areca: areca-cli"
	einfo "See https://github.com/glensc/nagios-plugin-check_raid/issues/10"
	einfo "Marvell RAID: mvcli"
	einfo "See https://github.com/glensc/nagios-plugin-check_raid/issues/92"
	einfo "Adaptec ServeRAID: aaccli"
	einfo "Adaptec AACRAID: afacli (* some controllers supported by USE=aacraid, sys-block/arcconf)"
	einfo "Adaptec ServeRAID 7k: ipssend"
}