Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Jun 2013 18:52:55 +0000 (UTC)
From:      Chris Rees <crees@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r319893 - in head/sysutils/monitorix: . files
Message-ID:  <201306041852.r54Iqtbj016686@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: crees
Date: Tue Jun  4 18:52:55 2013
New Revision: 319893
URL: http://svnweb.freebsd.org/changeset/ports/319893

Log:
  Update to 3.2.1
  
  The database (.rrd) files have moved to /var/db/monitorix by default, and the
  port is careful to ensure that existing files are migrated.
  
  The configuration file needs to have the base_lib line updated to
  /var/db/monitorix/ (note trailing slash).  The rc script comes with
  instructions to those who don't happen to follow every single commit :)

Modified:
  head/sysutils/monitorix/Makefile
  head/sysutils/monitorix/distinfo
  head/sysutils/monitorix/files/monitorix.in
  head/sysutils/monitorix/files/pkg-message.in
  head/sysutils/monitorix/pkg-plist

Modified: head/sysutils/monitorix/Makefile
==============================================================================
--- head/sysutils/monitorix/Makefile	Tue Jun  4 18:45:47 2013	(r319892)
+++ head/sysutils/monitorix/Makefile	Tue Jun  4 18:52:55 2013	(r319893)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 
 PORTNAME=	monitorix
-PORTVERSION=	3.0.0
+PORTVERSION=	3.2.1
 CATEGORIES=	sysutils
 MASTER_SITES=	http://www.monitorix.org/ \
 		http://www.monitorix.org/old_versions/ \
@@ -30,6 +30,7 @@ MANCOMPRESSED=	no
 NO_BUILD=	yes
 USE_RC_SUBR=	${PORTNAME}
 
+DBDIR?=		/var/db/${PORTNAME}
 CGIDIR?=	www/cgi-bin
 CGIPATH?=	/cgi-bin
 WWW_OWNER?=	${WWWOWN}
@@ -38,11 +39,13 @@ REPORT_LANG=	ca de en it pl
 WWWROOT=	${WWWDIR:S,/${PORTNAME}$,,}
 
 SUB_FILES=	pkg-message
-SUB_LIST=	PERL=${PERL}
+SUB_LIST=	PERL=${PERL} \
+		DBDIR=${DBDIR}
 
 PLIST_SUB+=	CGIDIR=${CGIDIR} \
 		WWW_OWNER=${WWW_OWNER} \
-		WWW_GROUP=${WWW_GROUP}
+		WWW_GROUP=${WWW_GROUP} \
+		DBDIR=${DBDIR}
 
 WWW_FILES=	logo_top.png \
 		logo_bot.png \
@@ -51,11 +54,13 @@ WWW_FILES=	logo_top.png \
 PORTDOCS=	*
 PORTDATA=	*.pm
 
+.include <bsd.port.options.mk>
+
 pre-everything::
 	@${ECHO_MSG} ""
 	@${ECHO_MSG} "You may set following options:"
 	@${ECHO_MSG} ""
-	@${ECHO_MSG} "DATADIR=${DATADIR}	Where do you put RRD databases?"
+	@${ECHO_MSG} "DBDIR=${DBDIR}	Where do you put RRD databases?"
 	@${ECHO_MSG} "CGIDIR=${CGIDIR}	Where do you put cgi?"
 	@${ECHO_MSG} "CGIPATH=${CGIPATH}	What is the relative URL for cgi files?"
 	@${ECHO_MSG} "WWWDIR=${WWWDIR}	Where do you put httpd's document root?"
@@ -69,7 +74,7 @@ post-patch:
 		${WRKSRC}/${PORTNAME}.cgi
 	@${REINPLACE_CMD} \
 		-e 's|^\(base_dir *= *\).*|\1${WWWDIR}/|' \
-		-e 's|^\(base_lib *= *\).*|\1${DATADIR}/|' \
+		-e 's|^\(base_lib *= *\).*|\1${DBDIR}/|' \
 		-e 's|^\(base_cgi *= *\).*|\1${CGIPATH}/|' \
 		-e 's|^\(secure_log[[:space:]]*= *\).*|\1/var/log/auth.log|' \
 		-e "s|/var/lib/milter-greylist/db/|/var/milter-greylist/|" \
@@ -98,7 +103,7 @@ do-install:
 	@${INSTALL_DATA} ${WRKSRC}/reports/${l}.html \
 		${WWWDIR}/reports/$l.html.sample
 .endfor
-.if !defined(NOPORTDOCS)
+.if ${PORT_OPTIONS:MDOCS}
 	@${MKDIR} ${DOCSDIR}
 . for f in docs/* README README.FreeBSD README.nginx Changes
 	@${INSTALL_DATA} ${WRKSRC}/$f ${DOCSDIR}
@@ -114,6 +119,12 @@ post-install:
 		${CP} -p ${PREFIX}/etc/monitorix.conf.sample \
 			${PREFIX}/etc/monitorix.conf ; \
 	fi
+	if [ ! -d ${DBDIR} ]; then \
+		${INSTALL} -d -o ${WWW_OWNER} -g ${WWW_GROUP} ${DBDIR}; \
+		if [ -f ${DATADIR}/fs.rrd ]; then \
+			${MV} ${DATADIR}/*.rrd ${DBDIR}; \
+		fi; \
+	fi
 	@${CAT} ${PKGMESSAGE}
 
 .include <bsd.port.mk>

Modified: head/sysutils/monitorix/distinfo
==============================================================================
--- head/sysutils/monitorix/distinfo	Tue Jun  4 18:45:47 2013	(r319892)
+++ head/sysutils/monitorix/distinfo	Tue Jun  4 18:52:55 2013	(r319893)
@@ -1,2 +1,2 @@
-SHA256 (monitorix-3.0.0.tar.gz) = c503491d6550a99762fc636f07098fc5a66bd170f5d009a05052b4273e5ae224
-SIZE (monitorix-3.0.0.tar.gz) = 158342
+SHA256 (monitorix-3.2.1.tar.gz) = ef37ee4301dc76451cadfa5d1d01ade9249cc36d19e8757e024cd3b2121a7781
+SIZE (monitorix-3.2.1.tar.gz) = 168852

Modified: head/sysutils/monitorix/files/monitorix.in
==============================================================================
--- head/sysutils/monitorix/files/monitorix.in	Tue Jun  4 18:45:47 2013	(r319892)
+++ head/sysutils/monitorix/files/monitorix.in	Tue Jun  4 18:52:55 2013	(r319893)
@@ -7,21 +7,31 @@
 # BEFORE: LOGIN
 # KEYWORD: shutdown
 
-monitorix_enable=${monitorix_enable:-"NO"}
-
 . /etc/rc.subr
 
-name="monitorix"
+name=monitorix
 rcvar=monitorix_enable
 
 load_rc_config $name
 
+: ${monitorix_enable:=NO}
+
 start_cmd="${name}_start"
+start_precmd=monitorix_check_rrds
 
 pidfile="/var/run/${name}.pid"
-command_interpreter="."
+command_interpreter=.
 procname="%%PREFIX%%/bin/${name}"
 
+monitorix_check_rrds()
+{
+	baselib=`grep ^base_lib %%PREFIX%%/etc/monitorix.conf`
+	baselib=${baselib##*= }
+	if [ "$baselib" = "%%DATADIR%%/" ]; then
+		err 1 "Please update your monitorix.conf, replacing the base_lib value with %%DBDIR%%/ (note trailing slash)."
+	fi
+}
+
 monitorix_start()
 {
 	if [ -z "$rc_fast" -a -n "$rc_pid" ]; then

Modified: head/sysutils/monitorix/files/pkg-message.in
==============================================================================
--- head/sysutils/monitorix/files/pkg-message.in	Tue Jun  4 18:45:47 2013	(r319892)
+++ head/sysutils/monitorix/files/pkg-message.in	Tue Jun  4 18:52:55 2013	(r319893)
@@ -1,7 +1,7 @@
 ================================================================
 
  The port has a generic default config, please adjust your
- settings in file: %%PREFIX%%/etc/monitorix.conf 
+ settings in file: %%PREFIX%%/etc/monitorix.conf
 
  The configuration file changed between 2.6.x and 3.0.0.
  It is suggested that you back up your old config file and

Modified: head/sysutils/monitorix/pkg-plist
==============================================================================
--- head/sysutils/monitorix/pkg-plist	Tue Jun  4 18:45:47 2013	(r319892)
+++ head/sysutils/monitorix/pkg-plist	Tue Jun  4 18:52:55 2013	(r319893)
@@ -21,3 +21,9 @@ bin/monitorix
 %%WWWDIR%%/cgi
 @dirrmtry %%WWWDIR%%/imgs
 @dirrmtry %%WWWDIR%%
+
+@comment rrd files are now kept in /var/db/monitorix, we'll move
+@comment previous files over for the user
+@exec [ -d %%DBDIR%% ] || install -d -o %%WWW_OWNER%% -g %%WWW_GROUP%% %%DBDIR%%
+@exec [ -f %%DATADIR%%/fs.rrd ] && mv %%DATADIR%%/*.rrd %%DBDIR%%
+@unexec rmdir %%DBDIR%% 2>/dev/null || true



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306041852.r54Iqtbj016686>