ports/58061: [maintainer] fix number of net/zabbix issues
Sergey Akifyev
asa at gascom.ru
Wed Oct 15 08:20:20 UTC 2003
>Number: 58061
>Category: ports
>Synopsis: [maintainer] fix number of net/zabbix issues
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: maintainer-update
>Submitter-Id: current-users
>Arrival-Date: Wed Oct 15 01:20:13 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator: Sergey Akifyev
>Release: FreeBSD 4.8-RELEASE-p13 i386
>Organization:
JSC Gascom
>Environment:
System: FreeBSD mail.gascom.ru 4.8-RELEASE-p13 FreeBSD 4.8-RELEASE-p13 #5: Mon Oct 6 15:48:47 MSD 2003 asa at boulder.gascom.ru:/usr/src/sys/compile/SMP_STD i386
>Description:
Fixed issues:
* Make use of USE_MYSQL
* Convert scripts to rc.subr
* Fix plist
* Fix pkg-message not displayed during 'make install'
* Depend on net/php4-nms
* Allow to connect to remote MySQL DB
* Even more...
>How-To-Repeat:
>Fix:
--- zabbix.diff begins here ---
diff -ruN zabbix.orig/Makefile zabbix/Makefile
--- zabbix.orig/Makefile Wed Oct 15 05:50:36 2003
+++ zabbix/Makefile Wed Oct 15 07:57:25 2003
@@ -7,6 +7,7 @@
PORTNAME= zabbix
PORTVERSION= 1.0b10
+PORTREVISION= 1
CATEGORIES= net
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR=${PORTNAME}
@@ -16,18 +17,19 @@
COMMENT= Very advanced network monitoring system
.ifdef(ZABBIX_AGENT_ONLY)
-PKGNAMESUFFIX= -agent
-PLIST= ${MASTERDIR}/pkg-plist.agent
-PKGMESSAGE= nonexistent
+PKGNAMESUFFIX= -agent
+PLIST= ${MASTERDIR}/pkg-plist.agent
+PKGMESSAGE= nonexistent
.else
-CONFIGURE_ARGS= --with-mysql --with-net-snmp
+LIB_DEPENDS= netsnmp.5:${PORTSDIR}/net/net-snmp
+RUN_DEPENDS= php:${PORTSDIR}/lang/php4-nms
-LIB_DEPENDS= netsnmp.5:${PORTSDIR}/net/net-snmp \
- mysqlclient.10:${PORTSDIR}/databases/mysql323-client
-BUILD_DEPENDS= mysql:${PORTSDIR}/databases/mysql323-client
-RUN_DEPENDS= safe_mysqld:${PORTSDIR}/databases/mysql323-server
+USE_MYSQL= yes
+CONFIGURE_ARGS= --with-mysql --with-net-snmp
+PKGMESSAGE= ${WRKDIR}/pkg-message
.endif
+USE_RC_SUBR= yes
GNU_CONFIGURE= yes
CONFIGURE_ENV= CPPFLAGS=-I${LOCALBASE}/include
@@ -38,6 +40,17 @@
ZABBIX_CONFIGS+=zabbix_suckerd.conf zabbix_trapper.conf zabbix_trapperd.conf
.endif
+SCRIPT_REGEX= -e 's|%PREFIX%|${PREFIX}|g' -e 's|%LOCALBASE%|${LOCALBASE}|g'
+
+pre-patch:
+.if !defined(ZABBIX_AGENT_ONLY)
+ @${SED} ${SCRIPT_REGEX} ${PKGDIR}/pkg-message > ${PKGMESSAGE}
+ @${SED} ${SCRIPT_REGEX} ${PKGDIR}/scripts/zabbix.sh.sample > \
+ ${WRKDIR}/zabbix.sh.sample
+.endif
+ @${SED} ${SCRIPT_REGEX} ${PKGDIR}/scripts/zabbix-agent.sh.sample > \
+ ${WRKDIR}/zabbix-agent.sh.sample
+
do-install:
.for FILE in ${ZABBIX_BINARIES}
${INSTALL_PROGRAM} ${WRKSRC}/bin/${FILE} ${PREFIX}/bin
@@ -63,6 +76,9 @@
.endif
${INSTALL_SCRIPT} ${MASTERDIR}/scripts/zabbix-agent.sh.sample \
${PREFIX}/etc/rc.d
- ${SH} ${PKGINSTALL}
+ ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
+.ifndef(ZABBIX_AGENT_ONLY)
+ ${CAT} ${PKGMESSAGE}
+.endif
.include <bsd.port.mk>
diff -ruN zabbix.orig/pkg-message zabbix/pkg-message
--- zabbix.orig/pkg-message Wed Oct 15 05:50:36 2003
+++ zabbix/pkg-message Wed Oct 15 07:26:10 2003
@@ -1,10 +1,8 @@
====================================================
ACHTUNG!!!
-1) Run dbsetup.sh from ${PREFIX}/share/zabbix/create
-to setup database tables
-
-2) Install apache with mod_php (it should be
-GD-enabled for graphs to work) and point it
-to serve from ${PREFIX}/share/zabbix/php
+Run dbsetup.sh from %PREFIX%/share/zabbix/create
+to setup database tables. Arguments, given to
+it will be passed to mysql client, allowing
+connection do non-local MySQL server
====================================================
diff -ruN zabbix.orig/pkg-plist zabbix/pkg-plist
--- zabbix.orig/pkg-plist Wed Oct 15 05:50:36 2003
+++ zabbix/pkg-plist Wed Oct 15 07:20:15 2003
@@ -65,6 +65,7 @@
%%DATADIR%%/php/images/sysmaps/Server.png
%%DATADIR%%/php/images/sysmaps/Workstation.png
%%DATADIR%%/php/include/.htaccess
+%%DATADIR%%/php/include/classes.inc.php
%%DATADIR%%/php/include/config.inc.php
%%DATADIR%%/php/include/db.inc.php
%%DATADIR%%/php/include/defines.inc.php
diff -ruN zabbix.orig/pkg-plist.agent zabbix/pkg-plist.agent
--- zabbix.orig/pkg-plist.agent Wed Oct 15 05:50:36 2003
+++ zabbix/pkg-plist.agent Wed Oct 15 07:12:20 2003
@@ -3,6 +3,6 @@
bin/zabbix_sender
etc/zabbix/zabbix_agent.conf.sample
etc/zabbix/zabbix_agentd.conf.sample
- at dirrm /etc/zabbix
+ at dirrm etc/zabbix
@exec ln -sf %D/etc/zabbix /etc/zabbix
@unexec rm /etc/zabbix
diff -ruN zabbix.orig/scripts/dbsetup.sh zabbix/scripts/dbsetup.sh
--- zabbix.orig/scripts/dbsetup.sh Wed Oct 15 05:50:36 2003
+++ zabbix/scripts/dbsetup.sh Wed Oct 15 07:35:33 2003
@@ -1,5 +1,6 @@
#!/bin/sh
-echo "create database zabbix;" | mysql
-cat mysql/schema.sql | mysql zabbix
-cat data/data.sql | mysql zabbix
+{
+ echo "create database zabbix; use zabbix;"
+ cat mysql/schema.sql data/data.sql
+} | mysql ${*}
diff -ruN zabbix.orig/scripts/zabbix-agent.sh.sample zabbix/scripts/zabbix-agent.sh.sample
--- zabbix.orig/scripts/zabbix-agent.sh.sample Wed Oct 15 05:50:36 2003
+++ zabbix/scripts/zabbix-agent.sh.sample Wed Oct 15 07:56:21 2003
@@ -1,14 +1,14 @@
#!/bin/sh
-case "${1}" in
- start)
- echo -n "zabbix-agent "
- zabbix_agentd
- ;;
- stop)
- killall zabbix_agentd
- ;;
- *)
- echo Usage: `basename ${0}` "{start|stop}"
- ;;
-esac
+prefix=%PREFIX%
+
+zabbix_agentd_enable="YES"
+
+. %LOCALBASE%/etc/rc.subr
+
+name="zabbix_agentd"
+rcvar=`set_rcvar`
+command="${prefix}/bin/${name}"
+required_files="/etc/zabbix/${name}.conf"
+
+run_rc_command "$1"
diff -ruN zabbix.orig/scripts/zabbix.sh.sample zabbix/scripts/zabbix.sh.sample
--- zabbix.orig/scripts/zabbix.sh.sample Wed Oct 15 05:50:36 2003
+++ zabbix/scripts/zabbix.sh.sample Wed Oct 15 07:56:14 2003
@@ -1,16 +1,14 @@
#!/bin/sh
-case "${1}" in
- start)
- echo -n "zabbix "
- zabbix_suckerd
- zabbix_trapperd
- ;;
- stop)
- killall zabbix_suckerd
- killall zabbix_trapperd
- ;;
- *)
- echo Usage: `basename ${0}` "{start|stop}"
- ;;
-esac
+prefix=%PREFIX%
+
+zabbix_suckerd_enable="YES"
+
+. %LOCALBASE%/etc/rc.subr
+
+name="zabbix_suckerd"
+rcvar=`set_rcvar`
+command="${prefix}/bin/${name}"
+required_files="/etc/zabbix/${name}.conf"
+
+run_rc_command "$1"
--- zabbix.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list