Unix Merge Configuration Files

Last modified by Eleni Cojocariu on 2026/08/13 15:14

Explanation

When upgrading an XWiki distribution using the ZIP package on a Unix system, the configuration files have to be merged rather than overwritten, so that your settings survive and the options the new version added are kept. The commands below do that with standard Unix tools, assuming xwiki.new is the directory of the new installation and xwiki the directory of the previous one.

Back Up the New Files

Each configuration file of the new installation — web.xml, xwiki.cfg, xwiki.properties, struts-config.xml and logback.xml — is first moved aside under an .ori extension, so that the merge can write the result back under the original name:

mv xwiki.new/WEB-INF/web.xml xwiki.new/WEB-INF/web.xml.ori
mv xwiki.new/WEB-INF/xwiki.cfg xwiki.new/WEB-INF/xwiki.cfg.ori
mv xwiki.new/WEB-INF/xwiki.properties xwiki.new/WEB-INF/xwiki.properties.ori
mv xwiki.new/WEB-INF/struts-config.xml xwiki.new/WEB-INF/struts-config.xml.ori
mv xwiki.new/WEB-INF/classes/logback.xml xwiki.new/WEB-INF/classes/logback.xml.ori

Merge with sdiff

sdiff then compares the file from the old installation with the backup of the new one and writes the merged result into the new installation:

sudo sdiff xwiki/WEB-INF/web.xml xwiki.new/WEB-INF/web.xml.ori -B -W -E -o xwiki.new/WEB-INF/web.xml
sudo sdiff xwiki/WEB-INF/xwiki.cfg xwiki.new/WEB-INF/xwiki.cfg.ori -B -W -E -o xwiki.new/WEB-INF/xwiki.cfg
sudo sdiff xwiki/WEB-INF/xwiki.properties xwiki.new/WEB-INF/xwiki.properties.ori -B -W -E -o xwiki.new/WEB-INF/xwiki.properties
sudo sdiff xwiki/WEB-INF/struts-config.xml xwiki.new/WEB-INF/struts-config.xml.ori -B -W -E -o xwiki.new/WEB-INF/struts-config.xml
sudo sdiff xwiki/WEB-INF/classes/logback.xml xwiki.new/WEB-INF/classes/logback.xml.ori -B -W -E -o xwiki.new/WEB-INF/classes/logback.xml

Get Connected