From owner-freebsd-ports-bugs@FreeBSD.ORG Mon Jul 25 16:30:25 2011 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04DEC1065675 for ; Mon, 25 Jul 2011 16:30:25 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id D586A8FC13 for ; Mon, 25 Jul 2011 16:30:24 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p6PGUOxV049931 for ; Mon, 25 Jul 2011 16:30:24 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p6PGUOaK049925; Mon, 25 Jul 2011 16:30:24 GMT (envelope-from gnats) Resent-Date: Mon, 25 Jul 2011 16:30:24 GMT Resent-Message-Id: <201107251630.p6PGUOaK049925@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Warren Block Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7FF531065673 for ; Mon, 25 Jul 2011 16:26:57 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 6F4BA8FC1C for ; Mon, 25 Jul 2011 16:26:57 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p6PGQvsk041151 for ; Mon, 25 Jul 2011 16:26:57 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p6PGQvaf041150; Mon, 25 Jul 2011 16:26:57 GMT (envelope-from nobody) Message-Id: <201107251626.p6PGQvaf041150@red.freebsd.org> Date: Mon, 25 Jul 2011 16:26:57 GMT From: Warren Block To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/159183: [patch] sysutils/scanbuttond: protect user config files X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2011 16:30:25 -0000 >Number: 159183 >Category: ports >Synopsis: [patch] sysutils/scanbuttond: protect user config files >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jul 25 16:30:24 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Warren Block >Release: 8-stable >Organization: >Environment: FreeBSD lightning 8.2-STABLE FreeBSD 8.2-STABLE #0: Sun Jul 24 21:33:19 MDT 2011 root@lightning:/usr/obj/usr/src/sys/LIGHTNING i386 >Description: Reinstalling or upgrading sysutils/scanbuttond will overwrite user-modified config .sh files in /usr/local/etc/scanbuttond/. This patch changes the port to work like other ports. If there are user .sh files present, they are left alone. If not present, sample files are installed. The patch is based on sysutils/apcupsd, which seemed to be the right way to do it. >How-To-Repeat: Modify /usr/local/etc/scanbuttond/buttonpressed.sh initscanner.sh. Reinstall the port. Notice the modified files have been replaced with sample files from the port. >Fix: Apply patch. Patch attached with submission follows: diff -u sysutils/scanbuttond.orig/Makefile sysutils/scanbuttond/Makefile --- sysutils/scanbuttond.orig/Makefile 2009-08-21 18:35:27.000000000 -0600 +++ sysutils/scanbuttond/Makefile 2011-07-25 10:24:01.000000000 -0600 @@ -7,6 +7,7 @@ PORTNAME= scanbuttond PORTVERSION= 0.2.3 +PORTREVISION= 1 CATEGORIES= sysutils MASTER_SITES= SF @@ -30,7 +31,23 @@ pre-configure: @${FIND} ${WRKSRC} -name Makefile.in | ${XARGS} \ ${REINPLACE_CMD} -e 's|-ldl||g' + +pre-install: + @if [ -f ${WRKSRC}/scripts/buttonpressed.sh ]; then \ + for na in buttonpressed.sh initscanner.sh; do \ + ${MV} ${WRKSRC}/scripts/$$na ${WRKSRC}/scripts/$$na.sample ; \ + done; \ + ${REINPLACE_CMD} -e 's|\.sh|.sh.sample|g' ${WRKSRC}/scripts/Makefile ; \ + ${MV} ${WRKSRC}/backends/meta.conf ${WRKSRC}/backends/meta.conf.sample ; \ + ${REINPLACE_CMD} -e 's|meta\.conf|meta.conf.sample|g' ${WRKSRC}/backends/Makefile ; \ + fi + post-install: + @for na in buttonpressed.sh initscanner.sh meta.conf; do \ + if [ ! -f ${ETCDIR}/$$na ]; then \ + ${CP} -p ${ETCDIR}/$$na.sample ${ETCDIR}/$$na; \ + fi; \ + done @${CAT} ${PKGMESSAGE} .include Common subdirectories: sysutils/scanbuttond.orig/files and sysutils/scanbuttond/files diff -u sysutils/scanbuttond.orig/pkg-plist sysutils/scanbuttond/pkg-plist --- sysutils/scanbuttond.orig/pkg-plist 2006-06-06 12:06:49.000000000 -0600 +++ sysutils/scanbuttond/pkg-plist 2011-07-25 10:23:19.000000000 -0600 @@ -1,7 +1,13 @@ bin/scanbuttond -etc/scanbuttond/buttonpressed.sh -etc/scanbuttond/initscanner.sh -etc/scanbuttond/meta.conf +@unexec if cmp -s %D/etc/scanbuttond/buttonpressed.sh.sample %D/etc/scanbuttond/buttonpressed.sh; then rm -f %D/etc/scanbuttond/buttonpressed.sh; fi +etc/scanbuttond/buttonpressed.sh.sample +@exec if [ ! -f %D/etc/scanbuttond/buttonpressed.sh ] ; then cp -p %D/%F %B/buttonpressed.sh; fi +@unexec if cmp -s %D/etc/scanbuttond/initscanner.sh.sample %D/etc/scanbuttond/initscanner.sh; then rm -f %D/etc/scanbuttond/initscanner.sh; fi +etc/scanbuttond/initscanner.sh.sample +@exec if [ ! -f %D/etc/scanbuttond/initscanner.sh ] ; then cp -p %D/%F %B/initscanner.sh; fi +@unexec if cmp -s %D/etc/scanbuttond/meta.conf.sample %D/etc/scanbuttond/meta.conf; then rm -f %D/etc/scanbuttond/meta.conf; fi +etc/scanbuttond/meta.conf.sample +@exec if [ ! -f %D/etc/scanbuttond/meta.conf ] ; then cp -p %D/%F %B/meta.conf; fi lib/libscanbtnd-backend_epson.la lib/libscanbtnd-backend_epson.so lib/libscanbtnd-backend_epson.so.1 >Release-Note: >Audit-Trail: >Unformatted: