wok-next view ndoutils/receipt @ rev 20636

Fix "can't execute '/usr/bin/update-mime-database': No such file or directory"
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Apr 27 15:12:17 2018 +0300 (2018-04-27)
parents 9e01bc6321ea
children d6378d455338
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 while read patch_file; do
18 if [ ! -f done.$patch_file ]; then
19 patch -p1 < $stuff/$patch_file || exit 1
20 touch done.$patch_file
21 fi
22 done <<EOT
23 $PACKAGE-$VERSION-Makefiles.in.u
24 EOT
26 ./configure \
27 --with-ndo2db-user=nagios \
28 --with-ndo2db-group=nagios \
29 --localstatedir=/var/run/nagios \
30 --sysconfdir=/etc/nagios \
31 --libexecdir=/usr/lib/$PACKAGE \
32 $CONFIGURE_ARGS &&
33 make &&
34 make DESTDIR=$DESTDIR install &&
35 make DESTDIR=$DESTDIR install-config
36 }
38 genpkg_rules() {
39 mkdir -p $fs/usr/share/nagios/ndoutils \
40 $fs/etc/nagios \
41 $fs/etc/mysql.d
43 cp -a $install/usr/bin $fs/usr
44 cp -a $install/usr/lib $fs/usr
45 cp -a $install/etc $fs
47 # config ndo2db.cfg
48 sed -i -e 's/ndo2db_user=nagios/ndo2db_user=nagios/' \
49 -e 's/ndo2db_group=nagios/ndo2db_group=nagios/' \
50 -e 's|/usr/local/nagios/var/|/var/run/nagios/|' \
51 -e 's/db_user=ndouser/db_user=root/' \
52 -e 's/db_pass=ndopassword/db_pass=/' $fs/etc/nagios/ndo2db.cfg
54 # config ndomod.cfg
55 sed -i -e 's|output=/usr/local/nagios/var/|output=/var/run/nagios/|' \
56 -e 's|buffer_file=/usr/local/nagios/var/|buffer_file=/var/tmp/|' \
57 $fs/etc/nagios/ndomod.cfg
59 cp -a $src/db/mysql.sql $fs/usr/share/nagios/ndoutils/nagios.sql
60 cp -a stuff/etc $fs
62 chmod 755 $fs/usr/bin/*
63 chmod 755 $fs/etc/mysql.d/*
64 DEPENDS="nagios mysql"
65 CONFIG_FILES="/etc/nagios"
66 }
68 post_install() {
69 if ! grep -q nagios "$1/etc/passwd"; then
70 chroot "$1/" adduser -S -D -H nagios
71 fi
73 if ! grep -q ndomod.cfg "$1/etc/nagios/nagios.cfg"; then
74 sed -i '/LOG ROTATION METHOD/i\broker_module=/usr/lib/ndoutils/ndomod.o config_file=/etc/nagios/ndomod.cfg' "$1/etc/nagios/nagios.cfg"
75 chroot "$1/" chown nagios.nagios /etc/nagios/nagios.cfg
76 fi
78 chroot "$1/" chown nagios.nagios \
79 /usr/lib/ndoutils/ndomod.o \
80 /etc/nagios/ndo2db.cfg \
81 /etc/nagios/ndomod.cfg \
82 /etc/nagios
84 sed -i "s/nagios/ndo2db nagios/" "$1/etc/rcS.conf"
86 if [ -z "$1" ]; then
87 [ -f /var/run/mysqld/mysql.pid ] || /etc/init.d/mysql start
88 /etc/mysql.d/$PACKAGE
89 #/usr/bin/ndo2db -c /etc/nagios/ndo2db.cfg
90 /etc/init.d/ndo2db start
91 /etc/init.d/nagios stop
92 /etc/init.d/nagios start
93 fi
94 }
96 pre_remove() {
97 /etc/init.d/ndo2db stop
98 }
100 post_remove() {
101 sed -i "s/ndo2db//" "$1/etc/rcS.conf"
102 /etc/init.d/nagios restart
103 sed -i 's|broker_module=/usr/lib/ndoutils/ndomod.o config_file=/etc/nagios/ndomod.cfg||' "$1/etc/nagios/nagios.cfg"
104 }