wok view ndoutils/receipt @ rev 25249

updated python-websocket-client (0.57.0 -> 0.59.0)
author Hans-G?nter Theisgen
date Thu Jul 14 07:30:53 2022 +0100 (2022-07-14)
parents 3ed673065a99
children d3556b8f5c3d
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 # What is the latest version available today?
20 current_version()
21 {
22 wget -O - https://sourceforge.net/projects//nagios/files/ 2>/dev/null | \
23 sed '/scope="row/!d;/ndoutils-/!d;s|.*href="|"https://sourceforge.net|;q' | xargs wget -O - 2>/dev/null | \
24 sed '/scope="row/!d;s|.*href="|"https://sourceforge.net|;q' | xargs wget -O - 2>/dev/null | \
25 sed '/scope="row/!d;s|.*/ndoutils-||;s|.tar.*||;q'
26 }
28 # Rules to configure and make the package.
29 compile_rules()
30 {
31 patch --input=$stuff/patches/Makefile.in-$VERSION \
32 Makefile.in || exit 1
33 patch --input=$stuff/patches/src_Makefile.in-$VERSION \
34 src/Makefile.in || exit 1
36 addgroup nagios
37 adduser -D -G nagios nagios
39 ./configure \
40 --prefix=/usr \
41 --with-ndo2db-user=nagios \
42 --with-ndo2db-group=nagios \
43 --localstatedir=/var/run/nagios \
44 --sysconfdir=/etc/nagios \
45 --libexecdir=/usr/lib/$PACKAGE \
46 --mandir=/usr/share/man \
47 $CONFIGURE_ARGS &&
48 make all &&
49 make DESTDIR=$DESTDIR install &&
50 make DESTDIR=$DESTDIR install-config
51 }
53 # Rules to gen a SliTaz package suitable for Tazpkg.
54 genpkg_rules()
55 {
56 mkdir -p $fs/usr/lib
57 mkdir -p $fs/usr/share/nagios/ndoutils
58 mkdir -p $fs/etc/nagios
59 mkdir -p $fs/etc/mysql.d
61 cp -a $install/usr/bin $fs/usr
62 cp -a $install/ndomod.o $fs/usr/lib
63 cp -a $install/etc $fs
65 # configuration file ndo2db.cfg
66 sed -i -e 's/ndo2db_user=nagios/ndo2db_user=nagios/' \
67 -e 's/ndo2db_group=nagios/ndo2db_group=nagios/' \
68 -e 's|/usr/local/nagios/var/|/var/run/nagios/|' \
69 -e 's/db_user=ndouser/db_user=root/' \
70 -e 's/db_pass=ndopassword/db_pass=/' \
71 $fs/etc/nagios/ndo2db.cfg
73 # configuration file ndomod.cfg
74 sed -i -e 's|output=/usr/local/nagios/var/|output=/var/run/nagios/|' \
75 -e 's|buffer_file=/usr/local/nagios/var/|buffer_file=/var/tmp/|' \
76 $fs/etc/nagios/ndomod.cfg
78 cp -a $src/db/mysql.sql \
79 $fs/usr/share/nagios/ndoutils/nagios.sql
80 cp -a stuff/etc $fs
82 chmod 755 $fs/usr/bin/*
83 chmod 755 $fs/etc/mysql.d/*
84 }
86 post_install()
87 {
88 if ! grep -q nagios "$1/etc/passwd"
89 then
90 echo
91 echo -n "Adding user nagios..."
92 chroot "$1/" adduser -S -D -H nagios
93 status
94 fi
96 if ! grep -q ndomod.cfg "$1/etc/nagios/nagios.cfg"
97 then
98 sed -i '/LOG ROTATION METHOD/i\broker_module=/usr/lib/ndoutils/ndomod.o config_file=/etc/nagios/ndomod.cfg' "$1/etc/nagios/nagios.cfg"
99 chroot "$1/" chown nagios.nagios /etc/nagios/nagios.cfg
100 fi
102 chroot "$1/" chown nagios.nagios /usr/lib/ndoutils/ndomod.o \
103 /etc/nagios/ndo2db.cfg /etc/nagios/ndomod.cfg \
104 /etc/nagios
106 sed -i "s/nagios/ndo2db nagios/" "$1/etc/rcS.conf"
108 if [ -z "$1" ]
109 then
110 [ -f /var/run/mysqld/mysql.pid ] || /etc/init.d/mysql start
111 /etc/mysql.d/$PACKAGE
112 #/usr/bin/ndo2db -c /etc/nagios/ndo2db.cfg
113 /etc/init.d/ndo2db start
114 /etc/init.d/nagios stop
115 /etc/init.d/nagios start
117 fi
118 }
120 pre_remove()
121 {
122 /etc/init.d/ndo2db stop
123 }
125 post_remove()
126 {
127 sed -i "s/ndo2db//" "$1/etc/rcS.conf"
128 /etc/init.d/nagios restart
129 sed -i 's|broker_module=/usr/lib/ndoutils/ndomod.o config_file=/etc/nagios/ndomod.cfg||' "$1/etc/nagios/nagios.cfg"
130 }