evolution-migrator.sh - Migrates gconf settings of Evolution

Evolution already ships with backup/restore functionality since version 2.20 released in September 2007. In handles both evolution data and config, therefore this script is deprecated. Nevertheless, it might still give good ideas on how to handle config migration for other gconf-based applications.

Motivation: I want to transfer the mail client settings of a given user form one station to another, better said I want to automate this task. It is important to note that only settings are considered here, data like emails and calendar entries are not. These can be migrated by ways of simple file transfer.

This script creates a file that contains all the gconf setting of the Evolution application, and if run on a different machines, imports those settings. Whith the same approach the settings of any application can be migrated which relies on gconf.

Few implementation details: Gconf settings can be exported to XML with the command gconftool-2, and this XML can be used to import the settings on the other box. My script first compresses the XML, then encodes it via base64 to create a portable/mail-able/copy-paste-able text file, that is self-extracting, which means executing it automates the decompression and import cycle. It is an important sweet-spot for me that I do not need multiple files, do need to take care of how to name the file, just run it and done.


#!/bin/sh

# version 2.0 - 2007-04-21
OUT=evolution-import_$(date --rfc-3339\=date).sh
cat > $OUT <<EOF
#!/bin/sh

DATA=/tmp/evolution-data.xml
tail -n +7 \$0 | openssl base64 -d -v | gzip -d > \$DATA
gconftool-2 --load \$DATA; rm \$DATA
exit 0

EOF
gconftool-2 --dump /apps/evolution | gzip | openssl base64 >> $OUT
chmod 755 $OUT
© 2003-2020 lithium.io7.org
Content on this site is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.