From 6a1d83201b51fae054355585950bbd47a84a2598 Mon Sep 17 00:00:00 2001 From: Lars Thegler Date: Tue, 12 Dec 2006 12:47:43 +0000 Subject: [PATCH] - Update to rcNG [1] - Include reload command [2] - Update MASTER_SITES PR: ports/103626 Submitted by: brd [1], Sean McAfee [2] --- net-mgmt/smokeping/Makefile | 21 +++++++------- net-mgmt/smokeping/files/smokeping.in | 41 +++++++++++++++++++++++++++ net-mgmt/smokeping/files/smokeping.sh | 29 ------------------- net-mgmt/smokeping/pkg-message | 6 ++-- net-mgmt/smokeping/pkg-plist | 1 - net/smokeping/Makefile | 21 +++++++------- net/smokeping/files/smokeping.in | 41 +++++++++++++++++++++++++++ net/smokeping/files/smokeping.sh | 29 ------------------- net/smokeping/pkg-message | 6 ++-- net/smokeping/pkg-plist | 1 - 10 files changed, 110 insertions(+), 86 deletions(-) create mode 100644 net-mgmt/smokeping/files/smokeping.in delete mode 100644 net-mgmt/smokeping/files/smokeping.sh create mode 100644 net/smokeping/files/smokeping.in delete mode 100644 net/smokeping/files/smokeping.sh diff --git a/net-mgmt/smokeping/Makefile b/net-mgmt/smokeping/Makefile index 9b3a1fe461b5..6e5cf4a80f76 100644 --- a/net-mgmt/smokeping/Makefile +++ b/net-mgmt/smokeping/Makefile @@ -7,9 +7,10 @@ PORTNAME= smokeping PORTVERSION= 2.0.9 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= net www -MASTER_SITES= http://people.ee.ethz.ch/~oetiker/webtools/smokeping/pub/ +MASTER_SITES= http://oss.oetiker.ch/smokeping/pub/ \ + http://smokeping.cs.pu.edu.tw/pub/ MAINTAINER= lth@FreeBSD.org COMMENT= Latency logging and graphing system @@ -72,6 +73,8 @@ RUN_DEPENDS+= ${SITE_PERL}/${PERL_ARCH}/Net/DNS.pm:${PORTSDIR}/dns/p5-Net-DNS NO_BUILD= yes USE_PERL5= yes +USE_RC_SUBR= smokeping + MAN1= smokeping.1 \ smokeping.cgi.1 \ tSmoke.1 @@ -124,7 +127,7 @@ SMOKEPING_UID= 117 GROUP= smokeping SMOKEPING_GID= 117 -FILES_SUB= USER=${USER} UID=${SMOKEPING_UID} \ +SUB_LIST+= USER=${USER} UID=${SMOKEPING_UID} \ GROUP=${GROUP} GID=${SMOKEPING_GID} \ PERL=${PERL} PREFIX=${PREFIX} @@ -205,7 +208,7 @@ post-patch: @${FIND} ${WRKSRC} -name \*.orig -delete pre-configure: - @${REINPLACE_CMD} ${FILES_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + @${REINPLACE_CMD} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ ${WRKSRC}/lib/Smokeping.pm \ ${WRKSRC}/lib/Smokeping/Examples.pm \ ${WRKSRC}/bin/smokeping.dist \ @@ -214,11 +217,11 @@ pre-configure: ${WRKSRC}/etc/config.dist \ ${WRKSRC}/lib/Smokeping/probes/*.pm @${FIND} ${WRKSRC} -name \*.bak -delete - @${SED} ${FILES_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + @${SED} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ ${PKGDIR}/pkg-message > ${PKGMESSAGE} - @${SED} ${FILES_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + @${SED} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ ${PKGDIR}/pkg-install > ${PKGINSTALL} - @${SED} ${FILES_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + @${SED} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ ${PKGDIR}/pkg-deinstall > ${PKGDEINSTALL} @${MV} ${WRKSRC}/bin/smokeping.dist ${WRKSRC}/bin/smokeping @${MV} ${WRKSRC}/bin/tSmoke.dist ${WRKSRC}/bin/tSmoke @@ -263,10 +266,6 @@ do-install: @${CHOWN} -R ${USER}:${GROUP} ${PREFIX}/var/smokeping @${MKDIR} ${PREFIX}/smokeping/htdocs/img @${CHOWN} -R ${WWWOWN}:${WWWGRP} ${PREFIX}/smokeping/htdocs/img - @if [ ! -f ${PREFIX}/etc/rc.d/smokeping.sh ]; then \ - ${ECHO} "Installing ${PREFIX}/etc/rc.d/smokeping.sh startup file."; \ - ${INSTALL_SCRIPT} ${FILESDIR}/smokeping.sh ${PREFIX}/etc/rc.d/smokeping.sh; \ - fi post-install: @PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL diff --git a/net-mgmt/smokeping/files/smokeping.in b/net-mgmt/smokeping/files/smokeping.in new file mode 100644 index 000000000000..f44b2d387059 --- /dev/null +++ b/net-mgmt/smokeping/files/smokeping.in @@ -0,0 +1,41 @@ +#!/bin/sh +# $FreeBSD$ + +# PROVIDE: smokeping +# REQUIRE: DAEMON +# BEFORE: LOGIN +# KEYWORD: shutdown + +# Define these smokeping_* variables in one of these files: +# /etc/rc.conf +# /etc/rc.conf.local +# /etc/rc.conf.d/smokeping +# +# DO NOT CHANGE THESE DEFAULT VALUES HERE +# +smokeping_enable=${smokeping_enable-"NO"} +smokeping_flags=${smokeping_flags-""} +smokeping_pidfile=${smokeping_pidfile-"%%PREFIX%%/var/smokeping/smokeping.pid"} +smokeping_logfile=${smokeping_logfile-"/var/log/smokeping.log"} +smokeping_user=${smokeping_user-"%%USER%%"} +smokeping_group=${smokeping_group-"%%GROUP%%"} + +. %%RC_SUBR%% + +name="smokeping" +rcvar=`set_rcvar` +command="/usr/local/bin/smokeping" +command_args="--logfile=${smokeping_logfile}" +pidfile="${smokeping_pidfile}" + +extra_commands="reload" +reload_cmd="smokeping_reloadcmd" + +smokeping_reloadcmd() +{ + $command --reload +} + +load_rc_config $name +run_rc_command "$1" + diff --git a/net-mgmt/smokeping/files/smokeping.sh b/net-mgmt/smokeping/files/smokeping.sh deleted file mode 100644 index e47e7470d6d2..000000000000 --- a/net-mgmt/smokeping/files/smokeping.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then - echo "$0: Cannot determine the PREFIX" >&2 - exit 1 -fi - -case "$1" in -start) - [ -r ${PREFIX}/etc/smokeping/config ] && \ - su -f -m smokeping -c ${PREFIX}/bin/smokeping > /dev/null && \ - echo -n ' smokeping' - ;; -restart) - [ -r ${PREFIX}/etc/smokeping/config ] && \ - su -f -m smokeping -c "${PREFIX}/bin/smokeping --restart" > /dev/null && \ - echo -n ' smokeping' - ;; -stop) - [ -r ${PREFIX}/var/smokeping/smokeping.pid ] && \ - su -f -m smokeping -c "kill `cat ${PREFIX}/var/smokeping/smokeping.pid`" > /dev/null && \ - echo -n ' smokeping' - ;; -*) - echo "Usage: `basename $0` {start|restart|stop}" >&2 - ;; -esac - -exit 0 diff --git a/net-mgmt/smokeping/pkg-message b/net-mgmt/smokeping/pkg-message index b95c237cbed4..a1fe2a445c28 100644 --- a/net-mgmt/smokeping/pkg-message +++ b/net-mgmt/smokeping/pkg-message @@ -16,11 +16,13 @@ details on installation and configuration. If you are upgrading from a previous version of Smokeping, the manpage 'smokeping_upgrade' may be of help. +Once configured, you can start SmokePing by adding: -Once configured, you can start SmokePing data collection by running: + smokeping_enable="YES" - %%PREFIX%%/etc/rc.d/smokeping.sh start +to /etc/rc.conf, and then running, as root: + %%PREFIX%%/etc/rc.d/smokeping start To enable Apache web access, add the following to your %%PREFIX%%/etc/apache/httpd.conf: diff --git a/net-mgmt/smokeping/pkg-plist b/net-mgmt/smokeping/pkg-plist index 3a00a70d121b..cdaa2c042fda 100644 --- a/net-mgmt/smokeping/pkg-plist +++ b/net-mgmt/smokeping/pkg-plist @@ -1,6 +1,5 @@ bin/smokeping bin/tSmoke -etc/rc.d/smokeping.sh @unexec if cmp -s %D/etc/smokeping/basepage.html %D/etc/smokeping/basepage.html.dist; then rm -f %D/etc/smokeping/basepage.html; fi etc/smokeping/basepage.html.dist @exec [ -f %B/basepage.html ] || cp %B/%f %B/basepage.html diff --git a/net/smokeping/Makefile b/net/smokeping/Makefile index 9b3a1fe461b5..6e5cf4a80f76 100644 --- a/net/smokeping/Makefile +++ b/net/smokeping/Makefile @@ -7,9 +7,10 @@ PORTNAME= smokeping PORTVERSION= 2.0.9 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= net www -MASTER_SITES= http://people.ee.ethz.ch/~oetiker/webtools/smokeping/pub/ +MASTER_SITES= http://oss.oetiker.ch/smokeping/pub/ \ + http://smokeping.cs.pu.edu.tw/pub/ MAINTAINER= lth@FreeBSD.org COMMENT= Latency logging and graphing system @@ -72,6 +73,8 @@ RUN_DEPENDS+= ${SITE_PERL}/${PERL_ARCH}/Net/DNS.pm:${PORTSDIR}/dns/p5-Net-DNS NO_BUILD= yes USE_PERL5= yes +USE_RC_SUBR= smokeping + MAN1= smokeping.1 \ smokeping.cgi.1 \ tSmoke.1 @@ -124,7 +127,7 @@ SMOKEPING_UID= 117 GROUP= smokeping SMOKEPING_GID= 117 -FILES_SUB= USER=${USER} UID=${SMOKEPING_UID} \ +SUB_LIST+= USER=${USER} UID=${SMOKEPING_UID} \ GROUP=${GROUP} GID=${SMOKEPING_GID} \ PERL=${PERL} PREFIX=${PREFIX} @@ -205,7 +208,7 @@ post-patch: @${FIND} ${WRKSRC} -name \*.orig -delete pre-configure: - @${REINPLACE_CMD} ${FILES_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + @${REINPLACE_CMD} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ ${WRKSRC}/lib/Smokeping.pm \ ${WRKSRC}/lib/Smokeping/Examples.pm \ ${WRKSRC}/bin/smokeping.dist \ @@ -214,11 +217,11 @@ pre-configure: ${WRKSRC}/etc/config.dist \ ${WRKSRC}/lib/Smokeping/probes/*.pm @${FIND} ${WRKSRC} -name \*.bak -delete - @${SED} ${FILES_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + @${SED} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ ${PKGDIR}/pkg-message > ${PKGMESSAGE} - @${SED} ${FILES_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + @${SED} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ ${PKGDIR}/pkg-install > ${PKGINSTALL} - @${SED} ${FILES_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + @${SED} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ ${PKGDIR}/pkg-deinstall > ${PKGDEINSTALL} @${MV} ${WRKSRC}/bin/smokeping.dist ${WRKSRC}/bin/smokeping @${MV} ${WRKSRC}/bin/tSmoke.dist ${WRKSRC}/bin/tSmoke @@ -263,10 +266,6 @@ do-install: @${CHOWN} -R ${USER}:${GROUP} ${PREFIX}/var/smokeping @${MKDIR} ${PREFIX}/smokeping/htdocs/img @${CHOWN} -R ${WWWOWN}:${WWWGRP} ${PREFIX}/smokeping/htdocs/img - @if [ ! -f ${PREFIX}/etc/rc.d/smokeping.sh ]; then \ - ${ECHO} "Installing ${PREFIX}/etc/rc.d/smokeping.sh startup file."; \ - ${INSTALL_SCRIPT} ${FILESDIR}/smokeping.sh ${PREFIX}/etc/rc.d/smokeping.sh; \ - fi post-install: @PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL diff --git a/net/smokeping/files/smokeping.in b/net/smokeping/files/smokeping.in new file mode 100644 index 000000000000..f44b2d387059 --- /dev/null +++ b/net/smokeping/files/smokeping.in @@ -0,0 +1,41 @@ +#!/bin/sh +# $FreeBSD$ + +# PROVIDE: smokeping +# REQUIRE: DAEMON +# BEFORE: LOGIN +# KEYWORD: shutdown + +# Define these smokeping_* variables in one of these files: +# /etc/rc.conf +# /etc/rc.conf.local +# /etc/rc.conf.d/smokeping +# +# DO NOT CHANGE THESE DEFAULT VALUES HERE +# +smokeping_enable=${smokeping_enable-"NO"} +smokeping_flags=${smokeping_flags-""} +smokeping_pidfile=${smokeping_pidfile-"%%PREFIX%%/var/smokeping/smokeping.pid"} +smokeping_logfile=${smokeping_logfile-"/var/log/smokeping.log"} +smokeping_user=${smokeping_user-"%%USER%%"} +smokeping_group=${smokeping_group-"%%GROUP%%"} + +. %%RC_SUBR%% + +name="smokeping" +rcvar=`set_rcvar` +command="/usr/local/bin/smokeping" +command_args="--logfile=${smokeping_logfile}" +pidfile="${smokeping_pidfile}" + +extra_commands="reload" +reload_cmd="smokeping_reloadcmd" + +smokeping_reloadcmd() +{ + $command --reload +} + +load_rc_config $name +run_rc_command "$1" + diff --git a/net/smokeping/files/smokeping.sh b/net/smokeping/files/smokeping.sh deleted file mode 100644 index e47e7470d6d2..000000000000 --- a/net/smokeping/files/smokeping.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then - echo "$0: Cannot determine the PREFIX" >&2 - exit 1 -fi - -case "$1" in -start) - [ -r ${PREFIX}/etc/smokeping/config ] && \ - su -f -m smokeping -c ${PREFIX}/bin/smokeping > /dev/null && \ - echo -n ' smokeping' - ;; -restart) - [ -r ${PREFIX}/etc/smokeping/config ] && \ - su -f -m smokeping -c "${PREFIX}/bin/smokeping --restart" > /dev/null && \ - echo -n ' smokeping' - ;; -stop) - [ -r ${PREFIX}/var/smokeping/smokeping.pid ] && \ - su -f -m smokeping -c "kill `cat ${PREFIX}/var/smokeping/smokeping.pid`" > /dev/null && \ - echo -n ' smokeping' - ;; -*) - echo "Usage: `basename $0` {start|restart|stop}" >&2 - ;; -esac - -exit 0 diff --git a/net/smokeping/pkg-message b/net/smokeping/pkg-message index b95c237cbed4..a1fe2a445c28 100644 --- a/net/smokeping/pkg-message +++ b/net/smokeping/pkg-message @@ -16,11 +16,13 @@ details on installation and configuration. If you are upgrading from a previous version of Smokeping, the manpage 'smokeping_upgrade' may be of help. +Once configured, you can start SmokePing by adding: -Once configured, you can start SmokePing data collection by running: + smokeping_enable="YES" - %%PREFIX%%/etc/rc.d/smokeping.sh start +to /etc/rc.conf, and then running, as root: + %%PREFIX%%/etc/rc.d/smokeping start To enable Apache web access, add the following to your %%PREFIX%%/etc/apache/httpd.conf: diff --git a/net/smokeping/pkg-plist b/net/smokeping/pkg-plist index 3a00a70d121b..cdaa2c042fda 100644 --- a/net/smokeping/pkg-plist +++ b/net/smokeping/pkg-plist @@ -1,6 +1,5 @@ bin/smokeping bin/tSmoke -etc/rc.d/smokeping.sh @unexec if cmp -s %D/etc/smokeping/basepage.html %D/etc/smokeping/basepage.html.dist; then rm -f %D/etc/smokeping/basepage.html; fi etc/smokeping/basepage.html.dist @exec [ -f %B/basepage.html ] || cp %B/%f %B/basepage.html