wok-6.x view ndoutils/receipt @ rev 23600

updated firefox-official (72.0.1 -> 75.0)
author Hans-G?nter Theisgen
date Fri Apr 10 16:03:29 2020 +0100 (2020-04-10)
parents a78610b2eb47
children afae00265386
line source
1 # SliTaz package receipt.
3 PACKAGE="ndoutils"
4 VERSION="2.1.3"
5 CATEGORY="network"
6 SHORT_DESC="Provide mysql access to nagios."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="GPL2"
9 WEB_SITE="https://www.nagios.org/"
11 TARBALL="$PACKAGE-$VERSION.tar.gz"
12 WGET_URL="$SF_MIRROR/nagios/$TARBALL"
14 DEPENDS="mysql nagios"
15 BUILD_DEPENDS="mysql-dev procps"
17 CONFIG_FILES="/etc/nagios"
19 # Rules to configure and make the package.
20 compile_rules()
21 {
22 patch --input=$stuff/patches/Makefile.in-$VERSION \
23 Makefile.in || exit 1
24 patch --input=$stuff/patches/src_Makefile.in-$VERSION \
25 src/Makefile.in || exit 1
27 addgroup nagios
28 adduser -D -G nagios nagios
30 ./configure \
31 --prefix=/usr \
32 --with-ndo2db-user=nagios \
33 --with-ndo2db-group=nagios \
34 --localstatedir=/var/run/nagios \
35 --sysconfdir=/etc/nagios \
36 --libexecdir=/usr/lib/$PACKAGE \
37 --mandir=/usr/share/man \
38 $CONFIGURE_ARGS &&
39 make all &&
40 make DESTDIR=$DESTDIR install &&
41 make DESTDIR=$DESTDIR install-config
42 }
44 # Rules to gen a SliTaz package suitable for Tazpkg.
45 genpkg_rules()
46 {
47 mkdir -p $fs/usr/lib
48 mkdir -p $fs/usr/share/nagios/ndoutils
49 mkdir -p $fs/etc/nagios
50 mkdir -p $fs/etc/mysql.d
52 cp -a $install/usr/bin $fs/usr
53 cp -a $install/ndomod.o $fs/usr/lib
54 cp -a $install/etc $fs
56 # configuration file ndo2db.cfg
57 sed -i -e 's/ndo2db_user=nagios/ndo2db_user=nagios/' \
58 -e 's/ndo2db_group=nagios/ndo2db_group=nagios/' \
59 -e 's|/usr/local/nagios/var/|/var/run/nagios/|' \
60 -e 's/db_user=ndouser/db_user=root/' \
61 -e 's/db_pass=ndopassword/db_pass=/' \
62 $fs/etc/nagios/ndo2db.cfg
64 # configuration file ndomod.cfg
65 sed -i -e 's|output=/usr/local/nagios/var/|output=/var/run/nagios/|' \
66 -e 's|buffer_file=/usr/local/nagios/var/|buffer_file=/var/tmp/|' \
67 $fs/etc/nagios/ndomod.cfg
69 cp -a $src/db/mysql.sql \
70 $fs/usr/share/nagios/ndoutils/nagios.sql
71 cp -a stuff/etc $fs
73 chmod 755 $fs/usr/bin/*
74 chmod 755 $fs/etc/mysql.d/*
75 }
77 post_install()
78 {
79 if ! grep -q nagios "$1/etc/passwd"
80 then
81 echo
82 echo -n "Adding user nagios..."
83 chroot "$1/" adduser -S -D -H nagios
84 status
85 fi
87 if ! grep -q ndomod.cfg "$1/etc/nagios/nagios.cfg"
88 then
89 sed -i '/LOG ROTATION METHOD/i\broker_module=/usr/lib/ndoutils/ndomod.o config_file=/etc/nagios/ndomod.cfg' "$1/etc/nagios/nagios.cfg"
90 chroot "$1/" chown nagios.nagios /etc/nagios/nagios.cfg
91 fi
93 chroot "$1/" chown nagios.nagios /usr/lib/ndoutils/ndomod.o \
94 /etc/nagios/ndo2db.cfg /etc/nagios/ndomod.cfg \
95 /etc/nagios
97 sed -i "s/nagios/ndo2db nagios/" "$1/etc/rcS.conf"
99 if [ -z "$1" ]
100 then
101 [ -f /var/run/mysqld/mysql.pid ] || /etc/init.d/mysql start
102 /etc/mysql.d/$PACKAGE
103 #/usr/bin/ndo2db -c /etc/nagios/ndo2db.cfg
104 /etc/init.d/ndo2db start
105 /etc/init.d/nagios stop
106 /etc/init.d/nagios start
108 fi
109 }
111 pre_remove()
112 {
113 /etc/init.d/ndo2db stop
114 }
116 post_remove()
117 {
118 sed -i "s/ndo2db//" "$1/etc/rcS.conf"
119 /etc/init.d/nagios restart
120 sed -i 's|broker_module=/usr/lib/ndoutils/ndomod.o config_file=/etc/nagios/ndomod.cfg||' "$1/etc/nagios/nagios.cfg"
121 }