wok annotate ndoutils/receipt @ rev 24019

syslinux: fix build
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Feb 28 16:32:57 2021 +0000 (5 weeks ago)
parents a78610b2eb47
children
rev   line source
erjo@8703 1 # SliTaz package receipt.
erjo@8703 2
erjo@8703 3 PACKAGE="ndoutils"
Hans-G?nter@23232 4 VERSION="2.1.3"
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"
Hans-G?nter@23232 9 WEB_SITE="https://www.nagios.org/"
Hans-G?nter@23232 10
erjo@8703 11 TARBALL="$PACKAGE-$VERSION.tar.gz"
erjo@8703 12 WGET_URL="$SF_MIRROR/nagios/$TARBALL"
Hans-G?nter@23232 13
Hans-G?nter@23232 14 DEPENDS="mysql nagios"
Hans-G?nter@23232 15 BUILD_DEPENDS="mysql-dev procps"
Hans-G?nter@23232 16
pascal@15601 17 CONFIG_FILES="/etc/nagios"
pascal@15601 18
erjo@8703 19 # Rules to configure and make the package.
erjo@8703 20 compile_rules()
erjo@8703 21 {
Hans-G?nter@23232 22 patch --input=$stuff/patches/Makefile.in-$VERSION \
Hans-G?nter@23232 23 Makefile.in || exit 1
Hans-G?nter@23232 24 patch --input=$stuff/patches/src_Makefile.in-$VERSION \
Hans-G?nter@23232 25 src/Makefile.in || exit 1
erjo@8703 26
Hans-G?nter@23232 27 addgroup nagios
Hans-G?nter@23232 28 adduser -D -G nagios nagios
Hans-G?nter@23232 29
Hans-G?nter@23232 30 ./configure \
Hans-G?nter@23232 31 --prefix=/usr \
Hans-G?nter@23232 32 --with-ndo2db-user=nagios \
Hans-G?nter@23232 33 --with-ndo2db-group=nagios \
Hans-G?nter@23232 34 --localstatedir=/var/run/nagios \
Hans-G?nter@23232 35 --sysconfdir=/etc/nagios \
Hans-G?nter@23232 36 --libexecdir=/usr/lib/$PACKAGE \
Hans-G?nter@23232 37 --mandir=/usr/share/man \
Hans-G?nter@23232 38 $CONFIGURE_ARGS &&
Hans-G?nter@23232 39 make all &&
Hans-G?nter@23232 40 make DESTDIR=$DESTDIR install &&
pascal@15601 41 make DESTDIR=$DESTDIR install-config
erjo@8703 42 }
erjo@8703 43
erjo@8703 44 # Rules to gen a SliTaz package suitable for Tazpkg.
erjo@8703 45 genpkg_rules()
erjo@8703 46 {
Hans-G?nter@23232 47 mkdir -p $fs/usr/lib
Hans-G?nter@23232 48 mkdir -p $fs/usr/share/nagios/ndoutils
Hans-G?nter@23232 49 mkdir -p $fs/etc/nagios
Hans-G?nter@23232 50 mkdir -p $fs/etc/mysql.d
Hans-G?nter@23232 51
Hans-G?nter@23232 52 cp -a $install/usr/bin $fs/usr
Hans-G?nter@23232 53 cp -a $install/ndomod.o $fs/usr/lib
Hans-G?nter@23232 54 cp -a $install/etc $fs
erjo@8703 55
Hans-G?nter@23232 56 # configuration file ndo2db.cfg
erjo@8703 57 sed -i -e 's/ndo2db_user=nagios/ndo2db_user=nagios/' \
erjo@8703 58 -e 's/ndo2db_group=nagios/ndo2db_group=nagios/' \
erjo@8703 59 -e 's|/usr/local/nagios/var/|/var/run/nagios/|' \
erjo@8703 60 -e 's/db_user=ndouser/db_user=root/' \
Hans-G?nter@23232 61 -e 's/db_pass=ndopassword/db_pass=/' \
Hans-G?nter@23232 62 $fs/etc/nagios/ndo2db.cfg
erjo@8703 63
Hans-G?nter@23232 64 # configuration file ndomod.cfg
erjo@8703 65 sed -i -e 's|output=/usr/local/nagios/var/|output=/var/run/nagios/|' \
erjo@8703 66 -e 's|buffer_file=/usr/local/nagios/var/|buffer_file=/var/tmp/|' \
erjo@8703 67 $fs/etc/nagios/ndomod.cfg
erjo@8703 68
Hans-G?nter@23232 69 cp -a $src/db/mysql.sql \
Hans-G?nter@23232 70 $fs/usr/share/nagios/ndoutils/nagios.sql
Hans-G?nter@23232 71 cp -a stuff/etc $fs
erjo@8703 72
Hans-G?nter@23232 73 chmod 755 $fs/usr/bin/*
Hans-G?nter@23232 74 chmod 755 $fs/etc/mysql.d/*
erjo@8703 75 }
erjo@8703 76
erjo@8703 77 post_install()
erjo@8703 78 {
Hans-G?nter@23232 79 if ! grep -q nagios "$1/etc/passwd"
Hans-G?nter@23232 80 then
pascal@20319 81 echo
erjo@8703 82 echo -n "Adding user nagios..."
pascal@18730 83 chroot "$1/" adduser -S -D -H nagios
erjo@8703 84 status
erjo@8703 85 fi
erjo@8703 86
Hans-G?nter@23232 87 if ! grep -q ndomod.cfg "$1/etc/nagios/nagios.cfg"
Hans-G?nter@23232 88 then
pascal@18730 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"
pascal@18730 90 chroot "$1/" chown nagios.nagios /etc/nagios/nagios.cfg
erjo@8703 91 fi
erjo@8703 92
pascal@18730 93 chroot "$1/" chown nagios.nagios /usr/lib/ndoutils/ndomod.o \
pascal@18730 94 /etc/nagios/ndo2db.cfg /etc/nagios/ndomod.cfg \
pascal@18730 95 /etc/nagios
erjo@8703 96
pascal@18730 97 sed -i "s/nagios/ndo2db nagios/" "$1/etc/rcS.conf"
erjo@8703 98
Hans-G?nter@23232 99 if [ -z "$1" ]
Hans-G?nter@23232 100 then
erjo@8703 101 [ -f /var/run/mysqld/mysql.pid ] || /etc/init.d/mysql start
erjo@8703 102 /etc/mysql.d/$PACKAGE
erjo@8703 103 #/usr/bin/ndo2db -c /etc/nagios/ndo2db.cfg
erjo@8703 104 /etc/init.d/ndo2db start
erjo@8703 105 /etc/init.d/nagios stop
erjo@8703 106 /etc/init.d/nagios start
erjo@8703 107
erjo@8703 108 fi
erjo@8703 109 }
erjo@8703 110
erjo@8703 111 pre_remove()
erjo@8703 112 {
erjo@8703 113 /etc/init.d/ndo2db stop
erjo@8703 114 }
erjo@8703 115
erjo@8703 116 post_remove()
erjo@8703 117 {
pascal@18730 118 sed -i "s/ndo2db//" "$1/etc/rcS.conf"
erjo@8703 119 /etc/init.d/nagios restart
pascal@18730 120 sed -i 's|broker_module=/usr/lib/ndoutils/ndomod.o config_file=/etc/nagios/ndomod.cfg||' "$1/etc/nagios/nagios.cfg"
erjo@8703 121 }