ports/143182: [PATCH] net-mgmt/smokeping: use $USERS & $GROUPS instead of doing account creation manually

Sevan Janiyan venture37 at geeklan.co.uk
Sun Jan 24 20:10:02 UTC 2010


>Number:         143182
>Category:       ports
>Synopsis:       [PATCH] net-mgmt/smokeping: use $USERS & $GROUPS instead of doing account creation manually
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 24 20:10:01 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Sevan Janiyan
>Release:        FreeBSD 8.0-RELEASE-p2 amd64
>Organization:
>Environment:
System: FreeBSD newbie.thingamajig-systems.co.uk 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #0: Tue Jan  5 21:11:58 UTC
>Description:
by switching to using $USERS & $GROUPS pkg-install is nolonger required     
pkg-deinstall only needs to handle the removal of the .pid file
user @stopdaemon to stop smoking instead of invoking smoking stop manually by pkg-deinstall
use bsd.port.options.mk
use SUB_FILES to update pkg-message

Added file(s):
- files/pkg-deinstall.in
- files/pkg-message.in

Removed file(s):
- pkg-deinstall
- pkg-install
- pkg-message

Port maintainer (lth at FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 0.99
>How-To-Repeat:
>Fix:

--- smokeping-2.4.2_2.patch begins here ---
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/net-mgmt/smokeping/Makefile,v
retrieving revision 1.51
diff -u -r1.51 Makefile
--- Makefile	24 Jan 2010 06:18:07 -0000	1.51
+++ Makefile	24 Jan 2010 20:02:13 -0000
@@ -26,49 +26,6 @@
 NO_BUILD=	yes
 USE_PERL5=	yes
 
-OPTIONS=	FPING "Support for fping probes" on
-OPTIONS+=	ECHOPING "Support for EchoPing probes" off
-OPTIONS+=	CURL "Support for Curl probes" off
-OPTIONS+=	LDAP "Support for LDAP probes" off
-OPTIONS+=	LDAPSSL "Support for SSL-enabled LDAP probes" off
-OPTIONS+=	RADIUS "Support for Radius probes" off
-OPTIONS+=	TELNET "Support for TelnetIOSPing probes" off
-OPTIONS+=	DNS "Support for AnotherDNS probes" off
-
-.include <bsd.port.pre.mk>
-
-.ifdef(WITH_FPING)
-RUN_DEPENDS+=	${LOCALBASE}/sbin/fping:${PORTSDIR}/net/fping
-.endif
-
-.ifdef(WITH_ECHOPING)
-RUN_DEPENDS+=	${LOCALBASE}/bin/echoping:${PORTSDIR}/net/echoping
-.endif
-
-.ifdef(WITH_CURL)
-RUN_DEPENDS+=	${LOCALBASE}/bin/curl:${PORTSDIR}/ftp/curl
-.endif
-
-.if defined(WITH_LDAP) || defined(WITH_LDAPSSL)
-RUN_DEPENDS+=	${SITE_PERL}/Net/LDAP.pm:${PORTSDIR}/net/p5-perl-ldap
-.endif
-
-.ifdef(WITH_RADIUS)
-RUN_DEPENDS+=	${SITE_PERL}/Authen/Radius.pm:${PORTSDIR}/security/p5-Authen-Radius
-.endif
-
-.ifdef(WITH_LDAPSSL)
-RUN_DEPENDS+=	${SITE_PERL}/IO/Socket/SSL.pm:${PORTSDIR}/security/p5-IO-Socket-SSL
-.endif
-
-.ifdef(WITH_TELNET)
-RUN_DEPENDS+=	${SITE_PERL}/Net/Telnet.pm:${PORTSDIR}/net/p5-Net-Telnet
-.endif
-
-.ifdef(WITH_DNS)
-RUN_DEPENDS+=	${SITE_PERL}/${PERL_ARCH}/Net/DNS.pm:${PORTSDIR}/dns/p5-Net-DNS
-.endif
-
 USE_RC_SUBR=	smokeping
 
 MAN1=		smokeping.1 \
@@ -114,18 +71,16 @@
 		smokeping_install.7 \
 		smokeping_upgrade.7
 
-PKGMESSAGE=	${WRKDIR}/pkg-message
-PKGINSTALL=	${WRKDIR}/pkg-install
 PKGDEINSTALL=	${WRKDIR}/pkg-deinstall
 
-USER=		smokeping
-SMOKEPING_UID=	117
-GROUP=		smokeping
-SMOKEPING_GID=	117
-
-SUB_LIST+=	USER=${USER} UID=${SMOKEPING_UID} \
-		GROUP=${GROUP} GID=${SMOKEPING_GID} \
-		PERL=${PERL} PREFIX=${PREFIX}
+USERS=		smokeping
+GROUPS=		smokeping
+
+SUB_FILES=	pkg-deinstall pkg-message
+SUB_LIST=	USERS=${USERS} \
+		GROUPS=${GROUPS} \
+		PERL=${PERL} \
+		PKG_PREFIX=${PKG_PREFIX}
 
 DOC1=		CHANGES CONTRIBUTORS COPYING COPYRIGHT README TODO
 DOC2=		Config/Grammar \
@@ -180,6 +135,50 @@
 
 ETC1=		basepage.html config smokemail tmail
 
+OPTIONS=	FPING "Support for fping probes" on
+OPTIONS+=	ECHOPING "Support for EchoPing probes" off
+OPTIONS+=	CURL "Support for Curl probes" off
+OPTIONS+=	LDAP "Support for LDAP probes" off
+OPTIONS+=	LDAPSSL "Support for SSL-enabled LDAP probes" off
+OPTIONS+=	RADIUS "Support for Radius probes" off
+OPTIONS+=	TELNET "Support for TelnetIOSPing probes" off
+OPTIONS+=	DNS "Support for AnotherDNS probes" off
+
+.include <bsd.port.options.mk>
+.ifdef(WITH_FPING)
+RUN_DEPENDS+=	${LOCALBASE}/sbin/fping:${PORTSDIR}/net/fping
+.endif
+
+.ifdef(WITH_ECHOPING)
+RUN_DEPENDS+=	${LOCALBASE}/bin/echoping:${PORTSDIR}/net/echoping
+.endif
+
+.ifdef(WITH_CURL)
+RUN_DEPENDS+=	${LOCALBASE}/bin/curl:${PORTSDIR}/ftp/curl
+.endif
+
+.if defined(WITH_LDAP) || defined(WITH_LDAPSSL)
+RUN_DEPENDS+=	${SITE_PERL}/Net/LDAP.pm:${PORTSDIR}/net/p5-perl-ldap
+.endif
+
+.ifdef(WITH_RADIUS)
+RUN_DEPENDS+=	${SITE_PERL}/Authen/Radius.pm:${PORTSDIR}/security/p5-Authen-Radius
+.endif
+
+.ifdef(WITH_LDAPSSL)
+RUN_DEPENDS+=	${SITE_PERL}/IO/Socket/SSL.pm:${PORTSDIR}/security/p5-IO-Socket-SSL
+.endif
+
+.ifdef(WITH_TELNET)
+RUN_DEPENDS+=	${SITE_PERL}/Net/Telnet.pm:${PORTSDIR}/net/p5-Net-Telnet
+.endif
+
+.ifdef(WITH_DNS)
+RUN_DEPENDS+=	${SITE_PERL}/${PERL_ARCH}/Net/DNS.pm:${PORTSDIR}/dns/p5-Net-DNS
+.endif
+
+.include <bsd.port.pre.mk>
+
 # Things that shouldn't have been in the tarball in the first place
 post-extract:
 	${RM} ${WRKSRC}/lib/BER.pm
@@ -216,20 +215,11 @@
 		${WRKSRC}/etc/config.dist \
 		${WRKSRC}/lib/Smokeping/probes/*.pm
 	${FIND} ${WRKSRC} -name \*.bak -delete
-	${SED} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
-		${PKGDIR}/pkg-message > ${PKGMESSAGE}
-	${SED} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
-		${PKGDIR}/pkg-install > ${PKGINSTALL}
-	${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
 	${MV} ${WRKSRC}/htdocs/smokeping.cgi.dist ${WRKSRC}/htdocs/smokeping.cgi
 	${MV} ${WRKSRC}/htdocs/tr.cgi.dist ${WRKSRC}/htdocs/tr.cgi
 
-pre-su-install:
-	PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
-
 do-install:
 	${INSTALL_SCRIPT} ${WRKSRC}/bin/smokeping ${PREFIX}/bin
 	${INSTALL_SCRIPT} ${WRKSRC}/bin/tSmoke ${PREFIX}/bin
@@ -267,15 +257,11 @@
 	${CHOWN} -R ${WWWOWN}:${WWWGRP} ${PREFIX}/smokeping/htdocs
 	${CP} -R ${WRKSRC}/lib ${PREFIX}/smokeping/
 	${MKDIR} ${PREFIX}/var/smokeping
-	${CHOWN} -R ${USER}:${GROUP} ${PREFIX}/var/smokeping
+	${CHOWN} -R ${USERS}:${GROUPS} ${PREFIX}/var/smokeping
 
 post-install:
-	PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
 .if !defined(BATCH)
 	${CAT} ${PKGMESSAGE}
 .endif
 
-post-deinstall:
-	PKG_PREFIX=${PREFIX} ${SH} ${PKGDEINSTALL} ${PKGNAME} POST-DEINSTALL
-
 .include <bsd.port.post.mk>
Index: pkg-deinstall
===================================================================
RCS file: pkg-deinstall
diff -N pkg-deinstall
--- pkg-deinstall	24 Feb 2004 12:41:37 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,55 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD: ports/net-mgmt/smokeping/pkg-deinstall,v 1.4 2004/02/24 12:41:37 eik Exp $
-#
-
-echo 'Stopping Smokeping daemon.'
-if [ -f ${PKG_PREFIX}/var/smokeping/smokeping.pid ]; then
-	if [ -x ${PKG_PREFIX}/etc/rc.d/smokeping.sh ]; then
-		${PKG_PREFIX}/etc/rc.d/smokeping.sh stop > /dev/null
-	fi
-	rm ${PKG_PREFIX}/var/smokeping/smokeping.pid
-fi
-
-case $2 in
-POST-DEINSTALL)
-
-	if [ ! -n "$BATCH" ]; then
-
-		if [ -d ${PKG_PREFIX}/etc/smokeping -o -d ${PKG_PREFIX}/var/smokeping ]; then
-			echo '================================================================='
-			echo
-			echo 'You seem to have some custom config and data.'
-			echo 'The "%%USER%%" user and "%%GROUP%%" group were therefore not deleted.'
-			echo
-			echo 'You may delete them with:'
-			echo
-			echo '  pw groupdel %%GROUP%%'
-			echo '  pw userdel %%USER%%'
-			echo
-			echo 'The config and data can be deleted with:'
-			echo
-			echo "  rm -R ${PKG_PREFIX}/etc/smokeping"
-			echo "  rm -R ${PKG_PREFIX}/var/smokeping"
-			echo
-			echo '================================================================='
-		else
-			if pw groupdel -n %%GROUP%%; then
-				echo 'Removed group "%%GROUP%%".'
-			else
-				echo 'Removing group "%%GROUP%%" failed...'
-				exit 1
-			fi
-
-			if pw userdel -n %%USER%%; then
-				echo 'Removed user "%%USER%%".'
-			else
-				echo 'Removing user "%%USER%%" failed...'
-				exit 1
-			fi
-		fi
-	fi
-
-	exit 0
-	;;
-esac
Index: pkg-install
===================================================================
RCS file: pkg-install
diff -N pkg-install
--- pkg-install	11 Jan 2008 12:25:22 -0000	1.6
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,31 +0,0 @@
-#! /bin/sh
-#
-# $FreeBSD: ports/net-mgmt/smokeping/pkg-install,v 1.6 2008/01/11 12:25:22 lth Exp $
-#
-
-case $2 in
-PRE-INSTALL)
-	if ! pw groupshow %%GROUP%% 2>/dev/null 1>&2; then
-		if pw groupadd %%GROUP%% -g %%GID%% ; then
-			echo 'Added group "%%GROUP%%".'
-		else
-			echo 'Adding group "%%GROUP%%" failed...'
-			exit 1
-		fi
-	fi
-
-	if ! pw usershow %%USER%% 2>/dev/null 1>&2; then
-                if pw useradd %%USER%% -u %%UID%% -g %%GROUP%% -h - \
-			-s "/sbin/nologin" -d "/nonexistent" \
-			-c "SmokePing Daemon"; \
-		then
-			echo 'Added user "%%USER%%".'
-		else
-			echo 'Adding user "%%USER%%" failed...'
-			exit 1
-		fi
-	fi
-
-	exit 0
-	;;
-esac
Index: pkg-message
===================================================================
RCS file: pkg-message
diff -N pkg-message
--- pkg-message	31 Aug 2008 19:58:39 -0000	1.7
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,36 +0,0 @@
-=================================================================
-
-SmokePing has now been installed in %%PREFIX%%/smokeping/.
-
-NOTE: A set of sample configuration files have been installed:
-
-  %%PREFIX%%/etc/smokeping/config
-  %%PREFIX%%/etc/smokeping/smokemail
-  %%PREFIX%%/etc/smokeping/basepage.html
-  %%PREFIX%%/etc/smokeping/tmail
-
-You *MUST* edit these to suit your requirements. Please read the
-manpages 'smokeping_install' and 'smokeping_config' for further
-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:
-
-  smokeping_enable="YES"
-
-to /etc/rc.conf, and then running, as root:
-
-  %%PREFIX%%/etc/rc.d/smokeping start
-
-To enable Apache web access, add something like the following to
-your %%PREFIX%%/etc/apache/httpd.conf:
-
-  DocumentRoot %%PREFIX%%/smokeping/htdocs
-  ScriptAlias /smokeping.cgi %%PREFIX%%/smokeping/htdocs/smokeping.cgi
-  ScriptAlias /tr.cgi %%PREFIX%%/smokeping/htdocs/tr.cgi
-
-Enjoy!
-
-=================================================================
Index: pkg-plist
===================================================================
RCS file: /home/ncvs/ports/net-mgmt/smokeping/pkg-plist,v
retrieving revision 1.24
diff -u -r1.24 pkg-plist
--- pkg-plist	29 Oct 2008 14:31:32 -0000	1.24
+++ pkg-plist	24 Jan 2010 20:02:13 -0000
@@ -1,3 +1,4 @@
+ at stopdaemon smokeping
 bin/smokeping
 bin/tSmoke
 @unexec if cmp -s %D/etc/smokeping/basepage.html %D/etc/smokeping/basepage.html.dist; then rm -f %D/etc/smokeping/basepage.html; fi
Index: files/pkg-deinstall.in
===================================================================
RCS file: files/pkg-deinstall.in
diff -N files/pkg-deinstall.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/pkg-deinstall.in	24 Jan 2010 20:02:13 -0000
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# $FreeBSD: ports/net-mgmt/smokeping/pkg-deinstall,v 1.4 2004/02/24 12:41:37 eik Exp $
+#
+
+if [ -f ${PKG_PREFIX}/var/smokeping/smokeping.pid ]; then
+rm ${PKG_PREFIX}/var/smokeping/smokeping.pid
+fi
+
Index: files/pkg-message.in
===================================================================
RCS file: files/pkg-message.in
diff -N files/pkg-message.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/pkg-message.in	24 Jan 2010 20:02:13 -0000
@@ -0,0 +1,36 @@
+=================================================================
+
+SmokePing has now been installed in %%PREFIX%%/smokeping/.
+
+NOTE: A set of sample configuration files have been installed:
+
+  %%ETCDIR%%/config
+  %%ETCDIR%%/smokemail
+  %%ETCDIR%%/basepage.html
+  %%ETCDIR%%/tmail
+
+You *MUST* edit these to suit your requirements. Please read the
+manpages 'smokeping_install' and 'smokeping_config' for further
+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:
+
+  smokeping_enable="YES"
+
+to /etc/rc.conf, and then running, as root:
+
+  %%PREFIX%%/etc/rc.d/smokeping start
+
+To enable Apache web access, add something like the following to
+your %%PREFIX%%/etc/apache/httpd.conf:
+
+  DocumentRoot %%PREFIX%%/smokeping/htdocs
+  ScriptAlias /smokeping.cgi %%PREFIX%%/smokeping/htdocs/smokeping.cgi
+  ScriptAlias /tr.cgi %%PREFIX%%/smokeping/htdocs/tr.cgi
+
+Enjoy!
+
+=================================================================
--- smokeping-2.4.2_2.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list