wok-next view ndoutils/receipt @ rev 20709

cdrdao: add patch.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat May 26 17:09:29 2018 +0300 (2018-05-26)
parents 757d032c55c7
children a3c581bf52b8
line source
1 # SliTaz package receipt v2.
3 PACKAGE="ndoutils"
4 VERSION="1.5.2"
5 CATEGORY="network"
6 SHORT_DESC="Provide mysql access to nagios"
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="GPL2"
9 WEB_SITE="http://www.nagios.org/"
11 TARBALL="$PACKAGE-$VERSION.tar.gz"
12 WGET_URL="$SF_MIRROR/nagios/$TARBALL"
14 BUILD_DEPENDS="mysql-dev"
16 compile_rules() {
17 ./configure \
18 --with-ndo2db-user=nagios \
19 --with-ndo2db-group=nagios \
20 --localstatedir=/var/run/nagios \
21 --sysconfdir=/etc/nagios \
22 --libexecdir=/usr/lib/$PACKAGE \
23 $CONFIGURE_ARGS &&
24 make &&
25 make DESTDIR=$DESTDIR install &&
26 make DESTDIR=$DESTDIR install-config
27 }
29 genpkg_rules() {
30 mkdir -p $fs/usr/share/nagios/ndoutils \
31 $fs/etc/nagios \
32 $fs/etc/mysql.d
34 cp -a $install/usr/bin $fs/usr
35 cp -a $install/usr/lib $fs/usr
36 cp -a $install/etc $fs
38 # config ndo2db.cfg
39 sed -i -e 's/ndo2db_user=nagios/ndo2db_user=nagios/' \
40 -e 's/ndo2db_group=nagios/ndo2db_group=nagios/' \
41 -e 's|/usr/local/nagios/var/|/var/run/nagios/|' \
42 -e 's/db_user=ndouser/db_user=root/' \
43 -e 's/db_pass=ndopassword/db_pass=/' $fs/etc/nagios/ndo2db.cfg
45 # config ndomod.cfg
46 sed -i -e 's|output=/usr/local/nagios/var/|output=/var/run/nagios/|' \
47 -e 's|buffer_file=/usr/local/nagios/var/|buffer_file=/var/tmp/|' \
48 $fs/etc/nagios/ndomod.cfg
50 cp -a $src/db/mysql.sql $fs/usr/share/nagios/ndoutils/nagios.sql
51 cp -a stuff/etc $fs
53 chmod 755 $fs/usr/bin/*
54 chmod 755 $fs/etc/mysql.d/*
55 DEPENDS="nagios mysql"
56 CONFIG_FILES="/etc/nagios"
57 }
59 post_install() {
60 if ! grep -q nagios "$1/etc/passwd"; then
61 chroot "$1/" adduser -S -D -H nagios
62 fi
64 if ! grep -q ndomod.cfg "$1/etc/nagios/nagios.cfg"; then
65 sed -i '/LOG ROTATION METHOD/i\broker_module=/usr/lib/ndoutils/ndomod.o config_file=/etc/nagios/ndomod.cfg' "$1/etc/nagios/nagios.cfg"
66 chroot "$1/" chown nagios.nagios /etc/nagios/nagios.cfg
67 fi
69 chroot "$1/" chown nagios.nagios \
70 /usr/lib/ndoutils/ndomod.o \
71 /etc/nagios/ndo2db.cfg \
72 /etc/nagios/ndomod.cfg \
73 /etc/nagios
75 sed -i "s/nagios/ndo2db nagios/" "$1/etc/rcS.conf"
77 if [ -z "$1" ]; then
78 [ -f /var/run/mysqld/mysql.pid ] || /etc/init.d/mysql start
79 /etc/mysql.d/$PACKAGE
80 #/usr/bin/ndo2db -c /etc/nagios/ndo2db.cfg
81 /etc/init.d/ndo2db start
82 /etc/init.d/nagios stop
83 /etc/init.d/nagios start
84 fi
85 }
87 pre_remove() {
88 /etc/init.d/ndo2db stop
89 }
91 post_remove() {
92 sed -i "s/ndo2db//" "$1/etc/rcS.conf"
93 /etc/init.d/nagios restart
94 sed -i 's|broker_module=/usr/lib/ndoutils/ndomod.o config_file=/etc/nagios/ndomod.cfg||' "$1/etc/nagios/nagios.cfg"
95 }