wok annotate ndoutils/receipt @ rev 25460

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