You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
2.8 KiB
103 lines
2.8 KiB
2 months ago
|
# Copyright 1999-2024 Gentoo Authors
|
||
7 years ago
|
# Distributed under the terms of the GNU General Public License v2
|
||
|
|
||
1 year ago
|
EAPI=8
|
||
|
|
||
2 months ago
|
inherit autotools systemd
|
||
7 years ago
|
|
||
2 months ago
|
DESCRIPTION="Nagios addon to store Nagios data in a database"
|
||
|
HOMEPAGE="https://github.com/NagiosEnterprises/ndoutils"
|
||
7 years ago
|
SRC_URI="https://github.com/NagiosEnterprises/${PN}/archive/${P}.tar.gz"
|
||
1 year ago
|
S="${WORKDIR}/${PN}-${P}"
|
||
7 years ago
|
|
||
|
LICENSE="GPL-2"
|
||
|
SLOT="0"
|
||
|
KEYWORDS="~amd64 ~ppc ~x86"
|
||
|
|
||
1 year ago
|
DEPEND="
|
||
|
dev-db/mysql-connector-c
|
||
6 years ago
|
dev-perl/DBD-mysql
|
||
2 months ago
|
dev-perl/DBI"
|
||
|
|
||
|
# The default value of the --with-ndo2db-{user,group} flag is "nagios".
|
||
|
# For unrelated reasons, we actually patch out the build-time dependency
|
||
|
# on the user/group, but it should still be there at runtime.
|
||
6 years ago
|
RDEPEND="${DEPEND}
|
||
2 months ago
|
acct-user/nagios
|
||
|
acct-group/nagios
|
||
7 years ago
|
virtual/mysql"
|
||
|
|
||
|
PATCHES=(
|
||
1 year ago
|
"${FILESDIR}"/format-security.patch
|
||
|
"${FILESDIR}"/ndoutils-2.0.0-asprintf.patch
|
||
|
"${FILESDIR}"/sample-config-piddir.patch
|
||
|
"${FILESDIR}"/openrc-init.patch
|
||
2 months ago
|
"${FILESDIR}"/secure-install-permissions.patch
|
||
7 years ago
|
)
|
||
|
|
||
2 months ago
|
src_prepare() {
|
||
|
default
|
||
|
eautoreconf
|
||
|
}
|
||
|
|
||
7 years ago
|
src_configure() {
|
||
|
# The localstatedir is where our socket will be created by the
|
||
5 years ago
|
# nagios daemon, so we put it in /var/lib/nagios where the "nagios"
|
||
|
# user will be able to write.
|
||
7 years ago
|
#
|
||
|
# And normally, we would use /run for the pid file, but the daemon
|
||
5 years ago
|
# drops permissions before creating it, so the piddir also needs
|
||
7 years ago
|
# to be writable by the nagios user.
|
||
2 months ago
|
#
|
||
|
# Oh, and the build fails without --enable-mysql, so don't try.
|
||
|
#
|
||
7 years ago
|
econf --enable-mysql \
|
||
5 years ago
|
--localstatedir=/var/lib/nagios \
|
||
7 years ago
|
--sysconfdir=/etc/nagios \
|
||
5 years ago
|
--with-piddir=/var/lib/nagios
|
||
7 years ago
|
}
|
||
|
|
||
|
src_compile() {
|
||
|
# Avoid "emake all" so that we don't build the stuff for nagios-2.x
|
||
|
# and nagios-3.x, some of which throws QA warnings. We don't use it
|
||
|
# anyway.
|
||
1 year ago
|
emake -C src file2sock log2ndo ndo2db-4x ndomod-4x.o sockdebug
|
||
7 years ago
|
}
|
||
|
|
||
|
src_install() {
|
||
1 year ago
|
# The documentation isn't installed by the build system
|
||
|
HTML_DOCS=( docs/html/. )
|
||
7 years ago
|
default
|
||
1 year ago
|
|
||
|
dodoc Changelog UPGRADING \
|
||
|
"docs/NDOUTILS DB Model.pdf" "docs/NDOUtils Documentation.pdf"
|
||
|
|
||
|
systemd_newunit startup/default-service ndoutils.service
|
||
|
|
||
7 years ago
|
insinto /etc/nagios
|
||
|
newins config/ndo2db.cfg-sample ndo2db.cfg
|
||
|
newins config/ndomod.cfg-sample ndomod.cfg
|
||
1 year ago
|
newinitd startup/openrc-init ndo2db
|
||
|
newconfd startup/openrc-conf ndo2db
|
||
7 years ago
|
|
||
1 year ago
|
insinto /usr/share/ndoutils
|
||
7 years ago
|
doins -r db
|
||
6 years ago
|
|
||
|
# These need to be executable...
|
||
1 year ago
|
exeinto /usr/share/ndoutils/db
|
||
6 years ago
|
doexe db/{installdb,prepsql,upgradedb}
|
||
|
|
||
|
# Use symlinks because the installdb/upgradedb scripts use relative
|
||
|
# paths to the SQL queries.
|
||
1 year ago
|
dosym ../share/ndoutils/db/installdb /usr/bin/ndoutils-installdb
|
||
|
dosym ../share/ndoutils/db/upgradedb /usr/bin/ndoutils-upgradedb
|
||
|
|
||
|
keepdir /var/lib/nagios
|
||
7 years ago
|
}
|
||
|
|
||
|
pkg_postinst() {
|
||
|
elog "To include NDO in your Nagios setup, you'll need to activate"
|
||
|
elog "the NDO broker module in /etc/nagios/nagios.cfg:"
|
||
|
elog " broker_module=/usr/bin/ndomod.o config_file=/etc/nagios/ndomod.cfg"
|
||
|
}
|