Date: Fri, 13 Aug 2004 10:16:40 +0800 From: Dryice Liu <dryice@hotpop.com> To: FreeBSD-gnats-submit@FreeBSD.org Cc: dd@FreeBSD.org Subject: ports/70390: [update]net/dictd: fix overwrite config file Message-ID: <20040813014838.8BDE1106DF59@smtp-3.hotpop.com> Resent-Message-ID: <200408130220.i7D2KJIY008659@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 70390 >Category: ports >Synopsis: [update]net/dictd: fix overwrite config file >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: Fri Aug 13 02:20:18 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Dryice Liu >Release: FreeBSD 5.2.1-RELEASE i386 >Organization: >Environment: System: FreeBSD dryice.3322.org 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #1: Mon Mar 1 16:17:42 CST 2004 >Description: Problem: I'm using net/dictd and I found if I deinstall - install it, or portupgrade it, it will overwrite my /usr/local/etc/dictd.conf with a default one. Changes: - install a sample config file by default and try to keep user config file - new file: pkg-install - new file: pkg-deinstall >How-To-Repeat: cd /usr/ports/net/dictd make install clean make some change on /usr/local/etc/dictd.conf cd /usr/ports/net/dictd make deinstall install The changes are lost >Fix: --- dictd.diff begins here --- diff -ruN dictd.old/Makefile dictd/Makefile --- dictd.old/Makefile Sat Jun 5 03:18:10 2004 +++ dictd/Makefile Fri Aug 13 10:02:18 2004 @@ -47,7 +47,8 @@ .for i in example.conf example.dictrc example.site example2.conf example3.conf ${INSTALL_DATA} ${WRKSRC}/$i ${DATADIR} .endfor - @${SED} "s|%%PREFIX%%|${PREFIX}|g" < ${FILESDIR}/${PORTNAME}.conf > ${PREFIX}/etc/${PORTNAME}.conf + @${SED} "s|%%PREFIX%%|${PREFIX}|g" < ${FILESDIR}/${PORTNAME}.conf > ${PREFIX}/etc/${PORTNAME}.conf.sample + @${SETENV} PKG_PREFIX="${PREFIX}" PKG_DESTDIR="${DESTDIR}" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL @${SED} "s|%%PREFIX%%|${PREFIX}|g" < ${FILESDIR}/${PORTNAME}.sh > ${PREFIX}/etc/rc.d/${PORTNAME}.sh @${CHMOD} +x ${PREFIX}/etc/rc.d/${PORTNAME}.sh @${SED} "s|%%PREFIX%%|${PREFIX}|g" < ${PKGMESSAGE} diff -ruN dictd.old/pkg-deinstall dictd/pkg-deinstall --- dictd.old/pkg-deinstall Thu Jan 1 08:00:00 1970 +++ dictd/pkg-deinstall Fri Aug 13 10:01:22 2004 @@ -0,0 +1,12 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +case $2 in +DEINSTALL) + if cmp -s ${PKG_PREFIX-/usr/local}/etc/dictd.conf ${PKG_PREFIX-/usr/local}/etc/dictd.conf.sample; then + rm -f ${PKG_PREFIX-/usr/local}/etc/dictd.conf; + fi + ;; +esac diff -ruN dictd.old/pkg-install dictd/pkg-install --- dictd.old/pkg-install Thu Jan 1 08:00:00 1970 +++ dictd/pkg-install Fri Aug 13 09:51:13 2004 @@ -0,0 +1,12 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +case $2 in +POST-INSTALL) + if [ ! -f ${PKG_PREFIX-/usr/local}/etc/dictd.conf ]; then + cp ${PKG_PREFIX-/usr/local}/etc/dictd.conf.sample ${PKG_PREFIX-/usr/local}/etc/dictd.conf + fi + ;; +esac diff -ruN dictd.old/pkg-plist dictd/pkg-plist --- dictd.old/pkg-plist Mon Jan 29 05:23:04 2001 +++ dictd/pkg-plist Fri Aug 13 10:02:21 2004 @@ -5,6 +5,6 @@ share/dictd/example.site share/dictd/example2.conf share/dictd/example3.conf -etc/dictd.conf +etc/dictd.conf.sample etc/rc.d/dictd.sh @dirrm share/dictd --- dictd.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040813014838.8BDE1106DF59>