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 :)
This commit is contained in:
Chris Rees 2013-06-04 18:52:55 +00:00
parent 146ebda01f
commit ad7295cafd
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=319893
5 changed files with 40 additions and 13 deletions

View file

@ -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>

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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