Date: Tue, 21 Dec 2004 13:43:40 -0500 From: Brent Verner <brent@rcfile.org> To: Kang Liu <liukang@bjut.edu.cn> Cc: freebsd-java@freebsd.org Subject: Re: ports/75348: Tomcat port overwrites server.xml config file Message-ID: <20041221184340.GA14170@rcfile.org> In-Reply-To: <200412211740.iBLHeUcw090127@freefall.freebsd.org> References: <200412211740.iBLHeUcw090127@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041221184340.GA14170>