Date: Mon, 25 Jul 2011 16:26:57 GMT From: Warren Block <wblock@wonkity.com> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/159183: [patch] sysutils/scanbuttond: protect user config files Message-ID: <201107251626.p6PGQvaf041150@red.freebsd.org> Resent-Message-ID: <201107251630.p6PGUOaK049925@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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 <bsd.port.post.mk> 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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107251626.p6PGQvaf041150>