rev |
line source |
erjo@8703
|
1 # SliTaz package receipt.
|
erjo@8703
|
2
|
erjo@8703
|
3 PACKAGE="ndoutils"
|
erjo@14463
|
4 VERSION="1.5.2"
|
erjo@8703
|
5 CATEGORY="network"
|
erjo@8703
|
6 SHORT_DESC="Provide mysql access to nagios."
|
erjo@8703
|
7 MAINTAINER="pascal.bellard@slitaz.org"
|
pascal@15601
|
8 LICENSE="GPL2"
|
erjo@8703
|
9 TARBALL="$PACKAGE-$VERSION.tar.gz"
|
erjo@8703
|
10 WEB_SITE="http://www.nagios.org/"
|
erjo@8703
|
11 WGET_URL="$SF_MIRROR/nagios/$TARBALL"
|
pascal@15601
|
12 CONFIG_FILES="/etc/nagios"
|
pascal@15601
|
13
|
erjo@8703
|
14 DEPENDS="nagios mysql"
|
erjo@8703
|
15 BUILD_DEPENDS="mysql-dev"
|
erjo@8703
|
16
|
erjo@8703
|
17 # Rules to configure and make the package.
|
erjo@8703
|
18 compile_rules()
|
erjo@8703
|
19 {
|
erjo@8703
|
20 cd $src
|
erjo@8703
|
21
|
erjo@8703
|
22 while read patch_file; do
|
erjo@8703
|
23 if [ ! -f done.$patch_file ]; then
|
slaxemulator@9700
|
24 patch -p1 < $stuff/$patch_file || exit 1
|
erjo@8703
|
25 touch done.$patch_file
|
erjo@8703
|
26 fi
|
erjo@8703
|
27 done <<EOT
|
erjo@8703
|
28 $PACKAGE-$VERSION-Makefiles.in.u
|
erjo@8703
|
29 EOT
|
erjo@8703
|
30
|
erjo@8703
|
31 ./configure --prefix=/usr \
|
erjo@8703
|
32 --with-ndo2db-user=nagios \
|
erjo@8703
|
33 --with-ndo2db-group=nagios \
|
erjo@8703
|
34 --localstatedir=/var/run/nagios \
|
erjo@8703
|
35 --sysconfdir=/etc/nagios \
|
erjo@8703
|
36 --libexecdir=/usr/lib/$PACKAGE \
|
erjo@8703
|
37 --mandir=/usr/share/man $CONFIGURE_ARGS &&
|
erjo@8703
|
38 make && \
|
pascal@15601
|
39 make DESTDIR=$DESTDIR install && \
|
pascal@15601
|
40 make DESTDIR=$DESTDIR install-config
|
erjo@8703
|
41 }
|
erjo@8703
|
42
|
erjo@8703
|
43 # Rules to gen a SliTaz package suitable for Tazpkg.
|
erjo@8703
|
44 genpkg_rules()
|
erjo@8703
|
45 {
|
erjo@8703
|
46 mkdir -p $fs/usr/share/nagios/ndoutils \
|
erjo@8703
|
47 $fs/etc/nagios \
|
erjo@8703
|
48 $fs/var/run/nagios \
|
erjo@8703
|
49 $fs/etc/mysql.d
|
erjo@8703
|
50
|
pascal@15601
|
51 cp -a $install/usr/bin $fs/usr
|
pascal@15601
|
52 cp -a $install/usr/lib $fs/usr
|
pascal@15601
|
53 cp -a $install/etc $fs
|
erjo@8703
|
54
|
erjo@8703
|
55 # config ndo2db.cfg
|
erjo@8703
|
56 sed -i -e 's/ndo2db_user=nagios/ndo2db_user=nagios/' \
|
erjo@8703
|
57 -e 's/ndo2db_group=nagios/ndo2db_group=nagios/' \
|
erjo@8703
|
58 -e 's|/usr/local/nagios/var/|/var/run/nagios/|' \
|
erjo@8703
|
59 -e 's/db_user=ndouser/db_user=root/' \
|
erjo@8703
|
60 -e 's/db_pass=ndopassword/db_pass=/' $fs/etc/nagios/ndo2db.cfg
|
erjo@8703
|
61
|
erjo@8703
|
62 # config ndomod.cfg
|
erjo@8703
|
63 sed -i -e 's|output=/usr/local/nagios/var/|output=/var/run/nagios/|' \
|
erjo@8703
|
64 -e 's|buffer_file=/usr/local/nagios/var/|buffer_file=/var/tmp/|' \
|
erjo@8703
|
65 $fs/etc/nagios/ndomod.cfg
|
erjo@8703
|
66
|
erjo@8703
|
67 cp -a $src/db/mysql.sql $fs/usr/share/nagios/ndoutils/nagios.sql
|
erjo@8703
|
68 cp -a stuff/etc $fs
|
erjo@8703
|
69
|
erjo@8703
|
70 chmod 755 $fs/usr/bin/*
|
erjo@8703
|
71 chmod 755 $fs/etc/mysql.d/*
|
erjo@8703
|
72 }
|
erjo@8703
|
73
|
erjo@8703
|
74 post_install()
|
erjo@8703
|
75 {
|
erjo@8703
|
76 if ! grep -q nagios $1/etc/passwd; then
|
erjo@8703
|
77 echo -n "Adding user nagios..."
|
erjo@8703
|
78 chroot $1/ adduser -S -D -H nagios
|
erjo@8703
|
79 status
|
erjo@8703
|
80 fi
|
erjo@8703
|
81
|
erjo@8703
|
82 if ! grep -q ndomod.cfg $1/etc/nagios/nagios.cfg; then
|
erjo@8703
|
83 sed -i '/LOG ROTATION METHOD/i\broker_module=/usr/lib/ndoutils/ndomod.o config_file=/etc/nagios/ndomod.cfg' $1/etc/nagios/nagios.cfg
|
erjo@8703
|
84 chroot $1/ chown nagios.nagios $1/etc/nagios/nagios.cfg
|
erjo@8703
|
85 fi
|
erjo@8703
|
86
|
erjo@8703
|
87 chroot $1/ chown nagios.nagios $fs/usr/lib/ndoutils/ndomod.o \
|
erjo@8703
|
88 $fs/etc/nagios/ndo2db.cfg $fs/etc/nagios/ndomod.cfg \
|
erjo@8703
|
89 $fs/var/run/nagios $fs/etc/nagios
|
erjo@8703
|
90
|
erjo@8703
|
91 sed -i "s/nagios/ndo2db nagios/" $1/etc/rcS.conf
|
erjo@8703
|
92
|
erjo@8703
|
93 if [ -z "$1" ]; then
|
erjo@8703
|
94 [ -f /var/run/mysqld/mysql.pid ] || /etc/init.d/mysql start
|
erjo@8703
|
95 /etc/mysql.d/$PACKAGE
|
erjo@8703
|
96 #/usr/bin/ndo2db -c /etc/nagios/ndo2db.cfg
|
erjo@8703
|
97 /etc/init.d/ndo2db start
|
erjo@8703
|
98 /etc/init.d/nagios stop
|
erjo@8703
|
99 /etc/init.d/nagios start
|
erjo@8703
|
100
|
erjo@8703
|
101 fi
|
erjo@8703
|
102 }
|
erjo@8703
|
103
|
erjo@8703
|
104 pre_remove()
|
erjo@8703
|
105 {
|
erjo@8703
|
106 /etc/init.d/ndo2db stop
|
erjo@8703
|
107 }
|
erjo@8703
|
108
|
erjo@8703
|
109 post_remove()
|
erjo@8703
|
110 {
|
erjo@8703
|
111 sed -i "s/ndo2db//" $1/etc/rcS.conf
|
erjo@8703
|
112 /etc/init.d/nagios restart
|
erjo@8703
|
113 sed -i 's|broker_module=/usr/lib/ndoutils/ndomod.o config_file=/etc/nagios/ndomod.cfg||' $1/etc/nagios/nagios.cfg
|
erjo@8703
|
114 }
|