ports/75348: Tomcat port overwrites server.xml config file
Brent Verner
brent at rcfile.org
Tue Dec 21 10:43:58 PST 2004
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
-------------- next part --------------
#!/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
More information about the freebsd-java
mailing list