Wiki source code of Unix Merge Configuration Files

Last modified by Eleni Cojocariu-testing account on 2026/08/18 15:04

Hide last authors
Eleni Cojocariu 2.1 1 When [[upgrading an XWiki distribution using the ZIP package>>documentation.xs.admin.upgrade.distribution.upgrade-zip-package.WebHome]] 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.
Eleni Cojocariu 1.1 2
Eleni Cojocariu 2.1 3 == Back Up the New Files ==
Eleni Cojocariu 1.1 4
Eleni Cojocariu 2.1 5 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:
Eleni Cojocariu 1.1 6
Eleni Cojocariu 2.1 7 {{code language="bash"}}
8 mv xwiki.new/WEB-INF/web.xml xwiki.new/WEB-INF/web.xml.ori
9 mv xwiki.new/WEB-INF/xwiki.cfg xwiki.new/WEB-INF/xwiki.cfg.ori
10 mv xwiki.new/WEB-INF/xwiki.properties xwiki.new/WEB-INF/xwiki.properties.ori
11 mv xwiki.new/WEB-INF/struts-config.xml xwiki.new/WEB-INF/struts-config.xml.ori
12 mv xwiki.new/WEB-INF/classes/logback.xml xwiki.new/WEB-INF/classes/logback.xml.ori
13 {{/code}}
Eleni Cojocariu 1.1 14
Eleni Cojocariu 2.1 15 == Merge with sdiff ==
Eleni Cojocariu 1.1 16
Eleni Cojocariu 2.1 17 ##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:
Eleni Cojocariu 1.1 18
Eleni Cojocariu 2.1 19 {{code language="bash"}}
Eleni Cojocariu 1.1 20 sudo sdiff xwiki/WEB-INF/web.xml xwiki.new/WEB-INF/web.xml.ori -B -W -E -o xwiki.new/WEB-INF/web.xml
21 sudo sdiff xwiki/WEB-INF/xwiki.cfg xwiki.new/WEB-INF/xwiki.cfg.ori -B -W -E -o xwiki.new/WEB-INF/xwiki.cfg
22 sudo sdiff xwiki/WEB-INF/xwiki.properties xwiki.new/WEB-INF/xwiki.properties.ori -B -W -E -o xwiki.new/WEB-INF/xwiki.properties
23 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
24 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
25 {{/code}}

Get Connected