From owner-freebsd-java@FreeBSD.ORG Tue Dec 21 18:43:57 2004 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E0FC816A4CE for ; Tue, 21 Dec 2004 18:43:57 +0000 (GMT) Received: from ns1.netavail.net (ns1.netavail.net [66.45.229.141]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7B6FE43D49 for ; Tue, 21 Dec 2004 18:43:55 +0000 (GMT) (envelope-from brent@mutt.rcfile.org) Received: from mutt.rcfile.org (cpe-065-184-047-009.nc.rr.com [65.184.47.9]) by ns1.netavail.net (Postfix) with ESMTP id C2D9D3C063; Tue, 21 Dec 2004 13:43:53 -0500 (EST) Received: from mutt.rcfile.org (localhost [127.0.0.1]) by mutt.rcfile.org (8.13.1/8.13.1) with ESMTP id iBLIhoPn014426; Tue, 21 Dec 2004 13:43:50 -0500 (EST) (envelope-from brent@mutt.rcfile.org) Received: (from brent@localhost) by mutt.rcfile.org (8.13.1/8.13.1/Submit) id iBLIhev8014422; Tue, 21 Dec 2004 13:43:40 -0500 (EST) (envelope-from brent) Date: Tue, 21 Dec 2004 13:43:40 -0500 From: Brent Verner To: Kang Liu Message-ID: <20041221184340.GA14170@rcfile.org> References: <200412211740.iBLHeUcw090127@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="6TrnltStXW4iwmi0" Content-Disposition: inline In-Reply-To: <200412211740.iBLHeUcw090127@freefall.freebsd.org> X-muttrc: $Id: .muttrc,v 1.10 2003/02/08 08:35:24 brent Exp $ X-uname: FreeBSD 4.10-STABLE #31: Thu Nov 18 11:01:01 EST 2004 root@mutt.rcfile.org:/usr/obj/usr/src/sys/MUTT User-Agent: Mutt/1.5.6i X-Spam-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.0.1 X-Spam-Checker-Version: SpamAssassin 3.0.1 (2004-10-22) on mutt.rcfile.org cc: freebsd-java@freebsd.org Subject: Re: ports/75348: Tomcat port overwrites server.xml config file X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Dec 2004 18:43:58 -0000 --6TrnltStXW4iwmi0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline All, Would it help to create a script like the attached (I'd call it install-port-conf or install-conf)? What this would do (should you remove the echo from the cp lines...) is check for the currently installed package from ${PKGORIGIN} and check to see if the file to be installed has been modified from the original distributed file. If the user has modified it, then we'll leave it alone and create the new file as ${FILE}.new. If the user hasn't modified it, copy the old file to ${FILE}.old and install the new ${FILE} From the makefile it might be used as follows: INSTALL_CONF=/path/to/install-conf # probably shipped in port files # ... do-install: ${INSTALL_CONF} ${PKGORIGIN} ${WRKDIR}/server.xml ${APP_HOME}/conf/server.xml ${INSTALL_CONF} ${PKGORIGIN} ${WRKSRC}/web.xml ${APP_HOME}/conf/web.xml Of course, the attached script would need to be completed. The only thing it does reliably is tell you if a previously installed version of a file to be installed was modified by the user. Comments? brent --6TrnltStXW4iwmi0 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=install-conf #!/bin/sh ORIGIN=$1 SRC_FILE=$2 FILE=$3 if pkg_info -q -g $(pkg_info -qO $ORIGIN) | awk '{print $1}' | grep -q $FILE; then echo "File to be installed was modified" echo "Installing new file: $FILE.new" echo cp $SRC_FILE ${FILE}.new elif [ -e $FILE ]; then echo "Preserving old file: ${FILE}.old" echo "Installing new file: $FILE" echo cp $FILE ${FILE}.old echo cp $SRC_FILE $FILE else echo "Installing file: $FILE" echo cp $SRC_FILE $FILE fi --6TrnltStXW4iwmi0--