Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Feb 2010 16:23:00 GMT
From:      "Alexey V. Panfilov" <ports@subnets.ru>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/143728: [PATCH] net-mgmt/mrtg: use $USERS & $GROUPS to handle users instead of via pkg-install and fix translations
Message-ID:  <201002101623.o1AGN0p1025769@www.freebsd.org>
Resent-Message-ID: <201002101630.o1AGU1VU020480@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         143728
>Category:       ports
>Synopsis:       [PATCH] net-mgmt/mrtg: use $USERS & $GROUPS to handle users instead of via pkg-install and fix translations
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 10 16:30:01 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Alexey V. Panfilov
>Release:        7.3-PRERELEASE
>Organization:
n/a
>Environment:
FreeBSD work-book.lehis.ru 7.3-PRERELEASE FreeBSD 7.3-PRERELEASE #4: Tue Feb  9 11:34:27 MSK 2010     root@work-book.lehis.ru:/usr/obj/usr/src/sys/BOOK-STABLE  i386

>Description:
This is aggregated PR:
1. http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/143179 (please, close it - current PR includes it) - remove /var/run/mrtg via pkg-deinstall instead of via plist
pkg-install is already listed in SUB_FILES, no need to invoke sed manually

Received via e-mail:
2. Fix wrong choice strings for translation
3. Fix some words at russian translation

Added file(s):
- files/pkg-deinstall.in
- files/patch-aa
- files/patch-ab
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

diff -ruN --exclude=CVS Makefile Makefile
--- Makefile	2010-02-05 14:42:41.000000000 +0300
+++ Makefile	2010-02-10 18:00:43.000000000 +0300
@@ -7,7 +7,7 @@
 
 PORTNAME=	mrtg
 PORTVERSION=	2.16.2
-PORTREVISION=	4
+PORTREVISION=	5
 PORTEPOCH=	1
 CATEGORIES=	net-mgmt ipv6
 MASTER_SITES=	http://oss.oetiker.ch/mrtg/pub/ \
@@ -24,22 +24,21 @@
 CONFIGURE_ARGS=	--with-gd-lib=${LOCALBASE}/lib \
 		--with-gd-inc=${LOCALBASE}/include
 
+USERS=		mrtg
+GROUPS=		mrtg
+
 USE_PERL5=	YES
 MAKE_ENV+=	PERL=${PERL}
-MRTG_USER?=	mrtg
-MRTG_GROUP?=	mrtg
-MRTG_UID?=	279
-MRTG_GID?=	279
 MRTG_RUNDIR?=	/var/run/mrtg
 
 USE_RC_SUBR=	mrtg_daemon
-SUB_FILES=	pkg-install pkg-message
+SUB_FILES=	pkg-deinstall pkg-install pkg-message
 SUB_LIST=	PERL=${PERL} \
-		MRTG_USER=${MRTG_USER} \
-		MRTG_GROUP=${MRTG_GROUP} \
-		MRTG_UID=${MRTG_UID} \
-		MRTG_GID=${MRTG_GID} \
-		MRTG_RUNDIR=${MRTG_RUNDIR}
+		MRTG_RUNDIR=${MRTG_RUNDIR} \
+		USERS=${USERS} \
+		GROUPS=${GROUPS}
+PKGINSTALL=	${WRKDIR}/pkg-install
+PKGDEINSTALL=	${WRKDIR}/pkg-deinstall
 
 GNU_CONFIGURE=	YES
 CONFIGURE_ENV=	PERL=${PERL}
@@ -80,20 +79,12 @@
 post-patch:
 	@${RM} ${WRKSRC}/lib/mrtg2/BER.pm ${WRKSRC}/lib/mrtg2/SNMP_*.pm
 
-pre-configure:
-	@${SED} -e 's,%%MRTG_USER%%,${MRTG_USER},g;' \
-		-e 's,%%MRTG_GROUP%%,${MRTG_GROUP},g;' \
-		-e 's,%%MRTG_UID%%,${MRTG_UID},g;' \
-		-e 's,%%MRTG_GID%%,${MRTG_GID},g;' \
-		-e 's,%%MRTG_RUNDIR%%,${MRTG_RUNDIR},g;' \
-		< ${FILESDIR}/pkg-install.in > ${PKGINSTALL}
-	@${SETENV} @PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} \
-		PRE-INSTALL
-
 do-install:
 .if !defined(NOPORTDOCS)
 	@${MKDIR} ${DOCSDIR}
 	@${INSTALL_DATA} ${DOCS:S,^,${WRKSRC}/,} ${DOCSDIR}/
+.endif
+.if !defined(NOPORTEXAMPLES)
 	@${MKDIR} ${EXAMPLESDIR}/doc ${EXAMPLESDIR}/images
 	@${INSTALL_DATA} ${EXAMPLES:S,^,${WRKSRC}/doc/,} ${EXAMPLESDIR}/doc/
 	@${INSTALL_DATA} ${IMAGES:S,^,${WRKSRC}/images/,} ${EXAMPLESDIR}/images/
diff -ruN --exclude=CVS files/patch-aa files/patch-aa
--- files/patch-aa	1970-01-01 03:00:00.000000000 +0300
+++ files/patch-aa	2010-02-10 11:48:04.000000000 +0300
@@ -0,0 +1,11 @@
+--- bin/mrtg.orig	2010-01-15 17:02:33.000000000 +0300
++++ bin/mrtg	2010-01-15 16:38:33.000000000 +0300
+@@ -1608,7 +1608,7 @@
+         print HTML "
+ <!-- Begin $sample{$peri} -->
+ 		<div class=\"graph\">
+-			<h2>".&$LOC("$sample{$peri}")." ".&$LOC("Average)")."</h2>
++			<h2>".&$LOC("$sample{$peri}").&$LOC(" Average\)")."</h2>
+ 			<img src=\"$imagepath$router-$full{$peri}.${main::GRAPHFMT}\" title=\"$full{$peri}\" alt=\"$full{$peri}\" />
+ 			<table>
+ 				<tr>
diff -ruN --exclude=CVS files/patch-ab files/patch-ab
--- files/patch-ab	1970-01-01 03:00:00.000000000 +0300
+++ files/patch-ab	2010-02-10 11:48:04.000000000 +0300
@@ -0,0 +1,32 @@
+--- lib/mrtg2/locales_mrtg.pm.orig	2008-05-16 18:45:41.000000000 +0400
++++ lib/mrtg2/locales_mrtg.pm	2010-01-15 16:33:33.000000000 +0300
+@@ -4137,10 +4137,10 @@
+      'Max'                                    => 'нБЛУ.',
+      'Current'                                => 'фЕЛХЭЙК',
+      'version'                                => 'ЧЕТУЙС',
+-     '`Daily\' Graph \((.*) Minute'           => 'уХФПЮОЩК ФТБЖЙЛ (УТЕДОЕЕ ЪБ $1 НЙОХФ',
+-     '`Weekly\' Graph \(30 Minute'            => 'оЕДЕМШОЩК ФТБЖЙЛ (УТЕДОЕЕ ЪБ 30 НЙОХФ' ,
+-     '`Monthly\' Graph \(2 Hour'              => 'нЕУСЮОЩК ФТБЖЙЛ  (УТЕДОЕЕ ЪБ 2 ЮБУБ',
+-     '`Yearly\' Graph \(1 Day'                => 'зПДПЧПК ФТБЖЙЛ (УТЕДОЕЕ ЪБ 1 ДЕОШ', 
++     '`Daily\' Graph \((.*) Minute'           => 'уХФПЮОЩК ЗТБЖЙЛ (УТЕДОЕЕ ЪБ $1 НЙОХФ',
++     '`Weekly\' Graph \(30 Minute'            => 'оЕДЕМШОЩК ЗТБЖЙЛ (УТЕДОЕЕ ЪБ 30 НЙОХФ' ,
++     '`Monthly\' Graph \(2 Hour'              => 'нЕУСЮОЩК ЗТБЖЙЛ  (УТЕДОЕЕ ЪБ 2 ЮБУБ',
++     '`Yearly\' Graph \(1 Day'                => 'зПДПЧПК ЗТБЖЙЛ (УТЕДОЕЕ ЪБ 1 ДЕОШ', 
+      'Incoming Traffic in (\S+) per Second'   => 'чИПДСЭЙК ФТБЖЙЛ Ч $1 Ч УЕЛХОДХ',
+      'Outgoing Traffic in (\S+) per Second'   => 'йУИПДСЭЙК ФТБЖЙЛ Ч $1 Ч УЕЛХОДХ',
+      'at which time (.*) had been up for(.*)' => 'Ч ЬФП ЧТЕНС $1 ВЩМБ ЧЛМАЮЕОБ $2',
+@@ -4245,10 +4245,10 @@
+      'Max'                                    => 'Максимально',
+      'Current'                                => 'Сейчас',
+      'version'                                => 'версия',
+-     '`Daily\' Graph \((.*) Minute'           => 'Суточный трафик (среднее за $1 минут',
+-     '`Weekly\' Graph \(30 Minute'            => 'Недельный трафик (среднее за 30 минут' ,
+-     '`Monthly\' Graph \(2 Hour'              => 'Месячный трафик  (среднее за 2 часа',
+-     '`Yearly\' Graph \(1 Day'                => 'Годовой трафик (среднее за 1 день', 
++     '`Daily\' Graph \((.*) Minute'           => 'Суточный график (среднее за $1 минут',
++     '`Weekly\' Graph \(30 Minute'            => 'Недельный график (среднее за 30 минут' ,
++     '`Monthly\' Graph \(2 Hour'              => 'Месячный график  (среднее за 2 часа',
++     '`Yearly\' Graph \(1 Day'                => 'Годовой график (среднее за 1 день', 
+      'Incoming Traffic in (\S+) per Second'   => 'Входящий трафик в $1 в секунду',
+      'Outgoing Traffic in (\S+) per Second'   => 'Исходящий трафик в $1 в секунду',
+      'at which time <strong>(\S+)</strong> had been up for <strong>(\S+)</strong>' => 'время после инициализации устройства <strong>$1</strong>: <strong>$2</strong>.',
diff -ruN --exclude=CVS files/pkg-deinstall.in files/pkg-deinstall.in
--- files/pkg-deinstall.in	1970-01-01 03:00:00.000000000 +0300
+++ files/pkg-deinstall.in	2010-02-10 17:42:49.000000000 +0300
@@ -0,0 +1,2 @@
+#!/bin/sh
+rm -rf %%MRTG_RUNDIR%% 
diff -ruN --exclude=CVS files/pkg-install.in files/pkg-install.in
--- files/pkg-install.in	2008-05-24 06:31:24.000000000 +0400
+++ files/pkg-install.in	2010-02-10 17:42:49.000000000 +0300
@@ -8,27 +8,16 @@
 MKDIR="/bin/mkdir -p"
 NOLOGIN="/usr/sbin/nologin"
 
-MRTG_USER=%%MRTG_USER%%
-MRTG_GROUP=%%MRTG_GROUP%%
-MRTG_UID=%%MRTG_UID%%
-MRTG_GID=%%MRTG_GID%%
 MRTG_RUNDIR=%%MRTG_RUNDIR%%
 
 case "$2" in
-	
-PRE-INSTALL)
-  ${PW} groupshow -n ${MRTG_GROUP} >/dev/null 2>&1 \
-    || ${PW} groupadd -n ${MRTG_GROUP} -g ${MRTG_GID}
-  ${PW} usershow -n ${MRTG_USER} >/dev/null 2>&1 \
-    || ${PW} useradd ${MRTG_USER} -g ${MRTG_GROUP} -u ${MRTG_UID} -s ${NOLOGIN}
-  ;;
 
 POST-INSTALL)
 	if [ ! -d "$MRTG_RUNDIR" ]; then
 		${MKDIR} $MRTG_RUNDIR
 	fi
 
-	${CHOWN} -R ${MRTG_USER}:${MRTG_USER} ${MRTG_RUNDIR}
+	${CHOWN} -R %%USERS%%:%%GROUPS%% ${MRTG_RUNDIR}
 	${CHMOD} 0700 ${MRTG_RUNDIR}
 	;;
 esac
diff -ruN --exclude=CVS pkg-plist pkg-plist
--- pkg-plist	2010-01-10 18:09:14.000000000 +0300
+++ pkg-plist	2010-02-10 17:42:49.000000000 +0300
@@ -61,7 +61,6 @@
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/images/mrtg-r.png
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/images/mrtg-ti.gif
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/images/mrtg-ti.png
-@dirrmtry /var/run/mrtg
 @dirrmtry %%ETCDIR%%
 %%PORTDOCS%%@dirrm %%DOCSDIR%%
 %%PORTEXAMPLES%%@dirrm %%EXAMPLESDIR%%/images


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



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