ports/156608: [patch] port net-ngmt/nagvis update to version 1.5.9

Olli Hauer ohauer at FreeBSD.org
Sun Apr 24 10:30:12 UTC 2011


>Number:         156608
>Category:       ports
>Synopsis:       [patch] port net-ngmt/nagvis update to version 1.5.9
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 24 10:30:11 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Olli Hauer
>Release:        
>Organization:
>Environment:


>Description:
Update nagvis to version 1.5.9

Additional I added my pkg-install script which sets more strict
access rights in the directory www/nagvis. The Idea for this script
was taken from the nagvis/install.sh script.


>How-To-Repeat:
>Fix:


--- patch_nagvis.txt begins here ---
Index: nagvis/Makefile
===================================================================
RCS file: /home/pcvs/ports/net-mgmt/nagvis/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- nagvis/Makefile	11 Feb 2011 10:31:11 -0000	1.3
+++ nagvis/Makefile	24 Apr 2011 10:10:58 -0000
@@ -6,9 +6,10 @@
 #
 
 PORTNAME=	nagvis
-PORTVERSION=	1.5.8
+PORTVERSION=	1.5.9
 CATEGORIES=	net-mgmt
-MASTER_SITES=	SF/${PORTNAME}/NagVis%201.5/
+MASTER_SITES=	SF
+MASTER_SITE_SUBDIR=${PORTNAME}/NagVis%201.5
 
 MAINTAINER=	derfi at vei.ru
 COMMENT=	NagVis is a visualization addon for Nagios
@@ -20,7 +21,7 @@
 		GRAPHVIZ	"graphviz is needed for automaps" off
 
 NO_BUILD=	yes
-USE_PHP=	gd gettext mbstring mysql session json pdo pdo_sqlite
+USE_PHP=	gd gettext mbstring session json pdo pdo_sqlite
 WANT_PHP_WEB=	yes
 DEFAULT_PHP_VER=5
 
@@ -28,10 +29,15 @@
 
 WWW_OWNER?=	${WWWOWN}
 WWW_GROUP?=	${WWWGRP}
-SUB_LIST+=	WWW_OWNER=${WWW_OWNER} WWW_GROUP=${WWW_GROUP}
+DIRMODE?=	750
+FILEMODE?=	640
+
+SUB_LIST+=	WWW_OWNER=${WWW_OWNER} WWW_GROUP=${WWW_GROUP} \
+		DIRMODE=${DIRMODE} FILEMODE=${FILEMODE}
 SUB_FILES+=	pkg-install pkg-deinstall
 
 .if defined(WITH_NDO2DB)
+USE_PHP+=	mysql
 RUN_DEPENDS+=	ndo2db-3x:${PORTSDIR}/net-mgmt/ndoutils
 .endif
 
@@ -45,7 +51,7 @@
 
 check-sanity:
 .if !defined(WITH_NDO2DB) && !defined(WITH_MKLIVESTATUS)
-IGNORE= please choose at least one nagios broker module
+IGNORE=	please choose at least one nagios broker module
 .endif
 
 post-extract:
@@ -59,10 +65,7 @@
 		${WRKSRC}/etc/nagvis.ini.php-sample
 
 do-install:
-	@${CP} -R ${WRKSRC} ${WWWDIR}
-	@${MKDIR} ${WWWDIR}/var/tmpl/cache
-	@${MKDIR} ${WWWDIR}/var/tmpl/compile
-	@${MKDIR} ${WWWDIR}/share/var
+	@( cd ${WRKSRC} && ${COPYTREE_SHARE} \* ${WWWDIR}/ )
 
 post-install:
 	@${SH} ${PKGINSTALL} ${DISTNAME} POST-INSTALL
Index: nagvis/distinfo
===================================================================
RCS file: /home/pcvs/ports/net-mgmt/nagvis/distinfo,v
retrieving revision 1.3
diff -u -r1.3 distinfo
--- nagvis/distinfo	11 Feb 2011 10:31:11 -0000	1.3
+++ nagvis/distinfo	24 Apr 2011 10:10:58 -0000
@@ -1,2 +1,2 @@
-SHA256 (nagvis-1.5.8.tar.gz) = 6c87b19550c90dd4ed54040ff4835e3ceb3a4ba93f723f44763c66d289288817
-SIZE (nagvis-1.5.8.tar.gz) = 3296727
+SHA256 (nagvis-1.5.9.tar.gz) = c0911a474563a8bd78e2454e8cd0f5c2cd8b83891869ada31d4d7ed0abddcbaa
+SIZE (nagvis-1.5.9.tar.gz) = 3298253
Index: nagvis/pkg-plist
===================================================================
RCS file: /home/pcvs/ports/net-mgmt/nagvis/pkg-plist,v
retrieving revision 1.3
diff -u -r1.3 pkg-plist
--- nagvis/pkg-plist	11 Feb 2011 10:31:11 -0000	1.3
+++ nagvis/pkg-plist	24 Apr 2011 10:10:58 -0000
@@ -820,7 +820,7 @@
 @dirrm %%WWWDIR%%/share/frontend/nagvis-js/classes
 @dirrm %%WWWDIR%%/share/frontend/nagvis-js
 @dirrm %%WWWDIR%%/share/frontend
- at dirrm %%WWWDIR%%/share
+ at dirrmtry %%WWWDIR%%/share
 @dirrmtry %%WWWDIR%%/etc/maps
 @dirrmtry %%WWWDIR%%/etc/geomap
 @dirrmtry %%WWWDIR%%/etc/automaps
Index: nagvis/files/pkg-install.in
===================================================================
RCS file: /home/pcvs/ports/net-mgmt/nagvis/files/pkg-install.in,v
retrieving revision 1.1
diff -u -r1.1 pkg-install.in
--- nagvis/files/pkg-install.in	1 Nov 2010 20:45:55 -0000	1.1
+++ nagvis/files/pkg-install.in	24 Apr 2011 10:10:58 -0000
@@ -1,7 +1,89 @@
 #!/bin/sh
-#
+# $FreeBSD$
+# ex:ts=4
+
+# Set strict file and directory permissions.
+# Idea taken from nagvis install.sh
+# 2010-12-30 olli hauer
+
+OWNER=%%WWW_OWNER%%:%%WWW_GROUP%%
+DIRMODE=%%DIRMODE%%
+FILEMODE=%%FILEMODE%%
+
+set_perm() {
+	# create missing directories
+	[ "${2#${2%?}}" != '*' ] && /bin/mkdir -p ${2}
+
+	if [ -d "$2" -o -f "$2" -o "${2#${2%?}}" = '*' ]; then
+		# Don't do anything when called with globbing and directory is empty
+		if [ "${2#${2%?}}" = '*' -a -z "$(/bin/ls "${2%/*}/")" ]; then
+			return 0
+		else
+			if [ -z $3 ]; then
+				echo "chown -R $OWNER $2"
+				chown -R $OWNER $2
+			else
+			    echo "chown $OWNER $2"
+			    chown $OWNER $2
+
+			fi
+			echo "chmod $1 $2"
+			chmod $1 $2
+		fi
+	fi
+}
+
+# handle single files
+set_file_perm() {
+	echo "chown $OWNER $2"
+	chown $OWNER $2
+
+	echo "chmod $1 $2"
+	chmod $1 $2
+}
+
 # fix directory owner if installed via package
 if [ "$2" = "POST-INSTALL" ]; then
-    echo "Fixing ownership settings ..."
-    chown -R %%WWW_OWNER%%:%%WWW_GROUP%% %%WWWDIR%%
+
+	# honor PREFIX if installed from package
+	if [ ! -z $PKG_PREFIX ]; then
+		NAGVIS_PATH=${PKG_PREFIX%/}/www/nagvis
+	else
+		NAGVIS_PATH=%%WWWDIR%%
+	fi
+
+	echo "==========================================================="
+	echo "Set access rights ..."
+
+	# Set more strict access rights for save keeping. There is no need
+	# to grant WWW_OWNER:WWW_GROUP general ownership and write permission.
+	chown root:%%WWW_GROUP%% "$NAGVIS_PATH"
+	chmod $DIRMODE "$NAGVIS_PATH"
+
+	# from nagvis source install.sh (with some modifications)
+	set_perm $DIRMODE  "$NAGVIS_PATH/etc" non_recursive
+	set_perm $DIRMODE  "$NAGVIS_PATH/etc/automaps"
+	set_perm $FILEMODE "$NAGVIS_PATH/etc/automaps/*"
+	set_perm $DIRMODE  "$NAGVIS_PATH/etc/geomap"
+	set_perm $FILEMODE "$NAGVIS_PATH/etc/geomap/*"
+	set_perm $DIRMODE  "$NAGVIS_PATH/etc/maps"
+	set_perm $FILEMODE "$NAGVIS_PATH/etc/maps/*"
+
+	set_perm $DIRMODE  "$NAGVIS_PATH/share/userfiles/images/maps"
+	set_perm $FILEMODE "$NAGVIS_PATH/share/userfiles/images/maps/*"
+	set_perm $DIRMODE  "$NAGVIS_PATH/share/userfiles/images/shapes"
+	set_perm $FILEMODE "$NAGVIS_PATH/share/userfiles/images/shapes/*"
+	set_perm $DIRMODE  "$NAGVIS_PATH/var"
+	set_perm $FILEMODE "$NAGVIS_PATH/var/*"
+	set_perm $DIRMODE  "$NAGVIS_PATH/var/tmpl"
+	set_perm $DIRMODE  "$NAGVIS_PATH/var/tmpl/cache"
+	set_perm $DIRMODE  "$NAGVIS_PATH/var/tmpl/compile"
+	set_perm $DIRMODE  "$NAGVIS_PATH/share/var"
+	set_perm $FILEMODE "$NAGVIS_PATH/share/var/*"
+
+	# some additional file permission adjustments
+	set_file_perm $FILEMODE "$NAGVIS_PATH/etc/nagvis.ini.*"
+	[ -f "$NAGVIS_PATH/etc/auth.db" ] && set_file_perm $FILEMODE "$NAGVIS_PATH/etc/auth.db"
+
+	echo "==========================================================="
 fi
--- patch_nagvis.txt ends here ---


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



More information about the freebsd-ports-bugs mailing list