The {\ttfamily 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


\begin{DoxyItemize}
\item {\ttfamily their} is the current version of the maintainer\textquotesingle{}s copy of a configuration file,
\item {\ttfamily base} is the previous version of the maintainer\textquotesingle{}s copy of the configuration file.
\item {\ttfamily our} is the user\textquotesingle{}s copy of the configuration file, derived from {\ttfamily base}
\end{DoxyItemize}

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/first\+File  echo -\/e \char`\"{}key\+A=a\textbackslash{}nkey\+B=b\textbackslash{}nkey\+C=c\char`\"{} $>$ {\ttfamily kdb get user/tests/tempfiles/first\+File} 
\begin{DoxyCode}
The following call to `kdb install-config-file` will mount it at `system/tests/installing` and additionally
       create a copy of it.
The copy will be required for a three-way merge later on.
\end{DoxyCode}
 kdb install-\/config-\/file system/tests/installing {\ttfamily kdb get user/tests/tempfiles/first\+File} ini 
\begin{DoxyCode}
We can now safely make changes to our configuration.
\end{DoxyCode}
 kdb set system/tests/installing/keyB X 
\begin{DoxyCode}
Let's assume that we've downloaded a different version of this file from the internet and placed it into
       the directory `/tmp/new`.
At this point we can use `kdb install-config-file` to merge the changes of this downloaded version into the
       configuration that we currently store in Elektra.

Note the slash `/` in the beginning of the second parameter of the call to `kdb install-config-file`.
This tool uses `kdb mount` and in consequence also the resolver.
You have to enter the paths accordingly.
Read the tutorials on mounting and namespaces if you are not sure what this means.
\end{DoxyCode}
 kdb set user/tests/tempfiles/second\+File \$(echo \$(mktemp -\/d)/\$(basename \$(kdb get user/tests/tempfiles/first\+File))) echo -\/e \char`\"{}key\+A=a\textbackslash{}nkey\+B=b\textbackslash{}nkey\+C=\+Y\char`\"{} $>$ {\ttfamily kdb get user/tests/tempfiles/second\+File} kdb install-\/config-\/file system/tests/installing \$(kdb get user/tests/tempfiles/second\+File) ini 
\begin{DoxyCode}
We can check that this worked by calling
\end{DoxyCode}
 kdb get system/tests/installing/keyB \#$>$ X kdb get system/tests/installing/keyC \#$>$ Y 
\begin{DoxyCode}
Finally, we use the following commands to clean up our tutorial.
\end{DoxyCode}
 kdb umount system/tests/installing rm -\/rf \$(kdb get user/tests/tempfiles/first\+File) rm -\/rf \$(kdb get user/tests/tempfiles/second\+File) kdb rm -\/rf user/tests/tempfiles kdb rm -\/rf user/elektra/merge/preserve ``` 