Elektra
0.9.5
|
The install-config-file
tool makes using Elektra for a configuration file easier. Please refer to its man page for details on its syntax.
It is especially useful in the context of package upgrades. In this case
their
is the current version of the maintainer's copy of a configuration file,base
is the previous version of the maintainer's copy of the configuration file.our
is the user's copy of the configuration file, derived from base
First of all, we create a small example configuration file. To do so, we first create a temporary file and store its location in Elektra.
``` kdb set user:/tests/tempfiles/firstFile echo -e "keyA=a\nkeyB=b\nkeyC=c" > kdb get user:/tests/tempfiles/firstFile
kdb install-config-file system:/tests/installing kdb get user:/tests/tempfiles/firstFile
mini
kdb set system:/tests/installing/keyB X
kdb set user:/tests/tempfiles/secondFile $(echo $(mktemp -d)/$(basename $(kdb get user:/tests/tempfiles/firstFile))) echo -e "keyA=a\nkeyB=b\nkeyC=Y" > kdb get user:/tests/tempfiles/secondFile
kdb install-config-file system:/tests/installing $(kdb get user:/tests/tempfiles/secondFile) mini
kdb get system:/tests/installing/keyB #> X kdb get system:/tests/installing/keyC #> Y
kdb umount system:/tests/installing rm -rf $(kdb get user:/tests/tempfiles/firstFile) rm -rf $(kdb get user:/tests/tempfiles/secondFile) kdb rm -rf user:/tests/tempfiles kdb rm -rf user:/elektra/merge/preserve ```