wok annotate nagios/receipt @ rev 24402

Add some current_version
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Feb 08 16:59:06 2022 +0000 (2022-02-08)
parents eb5518b1b094
children c145e26c3fc5
rev   line source
erjo@8330 1 # SliTaz package receipt.
erjo@8330 2
erjo@8330 3 PACKAGE="nagios"
pascal@23855 4 VERSION="4.4.6"
erjo@8330 5 CATEGORY="network"
Hans-G?nter@21510 6 SHORT_DESC="Host and network monitoring."
erjo@8330 7 MAINTAINER="erjo@slitaz.org"
pascal@15584 8 LICENSE="GPL2"
Hans-G?nter@21510 9 WEB_SITE="https://www.nagios.org/"
Hans-G?nter@21510 10
erjo@8330 11 TARBALL="$PACKAGE-$VERSION.tar.gz"
erjo@8330 12 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
Hans-G?nter@21510 13
erjo@8330 14 SUGGESTED="nagios-nrpe"
Hans-G?nter@21510 15 DEPENDS="apache libjpeg libltdl libpng nagios-plugins"
Hans-G?nter@21510 16 BUILD_DEPENDS="jpeg-dev libgd-dev libpng-dev libtool procps unzip"
Hans-G?nter@21510 17 # busybox ps and unzip do not supply the required options
pascal@15584 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;/nagios-/!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|.*/nagios-||;s|.tar.*||;q'
pascal@24402 26 }
pascal@24402 27
erjo@8330 28 # Rules to configure and make the package.
erjo@8330 29 compile_rules()
erjo@8330 30 {
Hans-G?nter@21510 31 while read patch_file
Hans-G?nter@21510 32 do
Hans-G?nter@23210 33 if [ ! -f done.$patch_file ]
Hans-G?nter@23210 34 then
slaxemulator@9700 35 patch -p1 < $stuff/$patch_file || return 1
erjo@8330 36 touch done.$patch_file
erjo@8330 37 fi
Hans-G?nter@21510 38 done <<EOT
pascal@20376 39 $PACKAGE-Makefiles.u
erjo@8330 40 EOT
Hans-G?nter@21510 41
Hans-G?nter@21510 42 ./configure \
Hans-G?nter@21510 43 --prefix=/usr \
Hans-G?nter@21510 44 --infodir=/usr/share/info \
Hans-G?nter@21510 45 --mandir=/usr/share/man \
Hans-G?nter@21510 46 --with-nagios-user=nagios \
Hans-G?nter@21510 47 --with-nagios-group=nagios \
Hans-G?nter@21510 48 --with-lockfile=/var/run/nagios/nagios.pid \
Hans-G?nter@21510 49 --with-checkresult-dir=/var/spool/nagios/checkresults \
Hans-G?nter@21510 50 --sysconfdir=/etc/nagios \
Hans-G?nter@21510 51 --with-httpd-conf=/etc/apache/conf.d \
Hans-G?nter@21510 52 --libexecdir=/usr/lib/nagios/plugins \
Hans-G?nter@21510 53 --sbindir=/usr/lib/nagios/cgi \
Hans-G?nter@21510 54 --datadir=/usr/share/nagios \
Hans-G?nter@21510 55 --localstatedir=/var/lib/nagios \
erjo@8330 56 $CONFIGURE_ARGS
erjo@8330 57
erjo@9865 58 sed -i s!HTMLDIR=.*!HTMLDIR=/usr/share/nagios! html/Makefile
erjo@9865 59
pascal@15584 60 #~ make all && make DESTDIR=$DESTDIR fullinstall \
pascal@15584 61 #~ && make DESTDIR=$DESTDIR install-config
Hans-G?nter@21510 62 make all &&
Hans-G?nter@21510 63 make install &&
Hans-G?nter@21510 64 make install-config &&
Hans-G?nter@21510 65 make install-commandmode &&
Hans-G?nter@21510 66 make install-webconf &&
Hans-G?nter@21510 67 make install-classicui
erjo@8330 68 }
erjo@8330 69
erjo@8330 70 # Rules to gen a SliTaz package suitable for Tazpkg.
erjo@8330 71 genpkg_rules()
erjo@8330 72 {
Hans-G?nter@23210 73 mkdir -p $fs/usr $fs/etc/init.d
Hans-G?nter@23210 74 mkdir -p $fs/var/lib/nagios/rw
Hans-G?nter@23210 75 mkdir -p $fs/var/log/nagios
Hans-G?nter@23210 76 mkdir -p $fs/var/spool/nagios/checkresults
Hans-G?nter@23210 77 mkdir -p $fs/etc/apache
erjo@8330 78
Hans-G?nter@21510 79 cp -a $install/etc/apache $fs/etc
Hans-G?nter@21510 80 cp -a $install/etc/nagios $fs/etc
Hans-G?nter@21510 81 cp -a $stuff/nagios $fs/etc/init.d
Hans-G?nter@23210 82 install -o root -g root -m 644 $stuff/htpasswd.users \
Hans-G?nter@23210 83 $fs/etc/nagios/
erjo@8330 84
Hans-G?nter@21510 85 cp -a $install/usr/bin $fs/usr
Hans-G?nter@21510 86 cp -a $install/usr/lib $fs/usr
Hans-G?nter@21510 87 cp -a $install/usr/share $fs/usr
erjo@8330 88
Hans-G?nter@21510 89 # Put documentation in a separate package
Hans-G?nter@23210 90 rm -rf $fs/usr/share/nagios/docs
erjo@8330 91
Hans-G?nter@23210 92 # Mofify Apache configuration for nagvis
Hans-G?nter@23210 93 sed -i 's/Options None/Options FollowSymLinks/' \
Hans-G?nter@23210 94 $fs/etc/apache/conf.d/nagios.conf
Hans-G?nter@21510 95
erjo@8700 96 # Fix permissions
Hans-G?nter@23210 97 chmod 755 $fs/usr/bin/nagios*
erjo@8330 98 }
erjo@8330 99
erjo@8330 100 post_install()
erjo@8330 101 {
Hans-G?nter@23210 102 if ! grep -q nagios "$1/etc/passwd"
Hans-G?nter@23210 103 then
erjo@8330 104 echo -n "Adding user/group nagios..."
pascal@18730 105 chroot "$1/" addgroup -S nagios
pascal@18730 106 chroot "$1/" adduser -S -D -H -G nagios nagios
erjo@8330 107 status
erjo@8330 108 fi
erjo@8330 109
Hans-G?nter@21510 110 # Fix permissions for files and directories
Hans-G?nter@23210 111 chroot "$1/" chown -R nagios.nagios \
Hans-G?nter@23210 112 /var/log/nagios \
Hans-G?nter@23210 113 /var/spool/nagios \
Hans-G?nter@23210 114 /var/lib/nagios \
Hans-G?nter@23210 115 /usr/share/nagios \
Hans-G?nter@23210 116 /etc/nagios/*
erjo@8330 117
pascal@18730 118 chmod 2775 "$1/var/lib/nagios/rw"
pascal@18730 119 chroot "$1/" addgroup www nagios
erjo@8330 120
erjo@8330 121 # Start Nagios daemon if we are on running system
pascal@18730 122 [ "$1" ] || /etc/init.d/nagios start
erjo@8330 123
erjo@8330 124 # post_install messges
erkan@20375 125 echo -e "\nTo start $PACKAGE server you can run :\n"
erjo@8330 126 echo "/etc/init.d/$PACKAGE start"
erjo@8330 127 echo -e "Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf\n"
erjo@8330 128 echo -e "Default login/password for the Web GUI is nagiosadmin/nagios"
erjo@8330 129 }
erjo@8330 130
pascal@14466 131 pre_remove()
pascal@14466 132 {
pascal@18730 133 [ "$1" ] || /etc/init.d/nagios stop
pascal@14466 134 }