5. Configuration

NoteNote
 

Older bakonf versions (< 0.5) had an entirely different config file. If you upgraded, be sure to forward you changes to the new config files.

bakonf uses a main configuration file /etc/bakonf/bakonf.xml, which does some standard settings and tells bakonf what other files to include. These additional files are usually located in /etc/bakonf/sources and tell bakonf how to handle some special cases.

5.1. Configuration language

The configuration file is written in XML, and must have the document tag bakonf.

The file can contain the following tags:

<include path="CONFIGFILE_PATTERN"/>

tells bakonf to also parse any files which match the given shell pattern. These are files which modify bakonf's own behavior, and are usually located in /etc/bakonf/sources. These are not directories to be backed up! (Altough, if modified, they will be, since are located under /etc usually).

<filesystem>

Starts declarations about files to be backed up, and can contain:

<scan path="SHELL-PATTERN"/>

tells bakonf to add any file or directory which matched shell pattern PATTERN to its include list. These can be files or directories. Bakonf will descend directories, but will not follow symbolic links! The symlinks are considered configuration items also, so they will be backeup up themselves.

<noscan regex="REGEXP"/>

tells bakonf to ignore any file or directory which matches the regular expression REGEXP from the archive; it won't even open or analise those files.

<metadata>

Starts declarations about metainformations to be included in the archive, and can contain:

<storeoutput command="SHELL-COMMAND" destination="PATH IN ARCHIVE"/>

Tells bakonf to execute the given SHELL-COMMAND and include its output in a file named metadata/PATH IN ARCHIVE in the created archive. For example, the element:

<storeoutput command="cat /proc/version" destination="proc/version"/>
will create a file in the archive with the name metadata/proc/version which will contain the /proc/version file.

The order of precedence for scan/noscan is:

Using these, you can select where you want bakonf to look for files for archiving. The default config file includes /etc, /usr/etc, /usr/local/etc and some others (look in /etc/bakonf after installing).

Example main configuration file (the file included in the distribution):

<bakonf>
<!-- 
     Bakonf main configuration file. Tune to your system.
     See also the files in the sources subdirectory (included by default)
-->
<filesystem>
    <!-- Standard directories -->
    <scan path="/etc" />
    <scan path="/usr/etc" />
    <scan path="/usr/local/etc" />
    <scan path="/var/lib/alternatives" />
</filesystem>
<!-- Include by default the other configuration files -->
<include path="/etc/bakonf/sources/*.xml" />
</bakonf>

Example GNU/Linux proc configuration file (included in the distribution):

<bakonf>
<!--
     File which contains hardware related informations, mostly
     extracted from the /proc filesystem (under GNU/Linux)
-->
<metadata>
<!-- Proc values -->
<storeoutput command="cat /proc/version" destination="proc/version"/>
<storeoutput command="cat /proc/dma" destination="proc/dma"/>
<storeoutput command="cat /proc/interrupts" destination="proc/interrupts"/>
<storeoutput command="cat /proc/ioports" destination="proc/ioports"/>
<storeoutput command="cat /proc/iomem" destination="proc/iomem"/>
<storeoutput command="cat /proc/cpuinfo" destination="proc/cpuinfo"/>
<storeoutput command="cat /proc/partitions" destination="proc/partitions"/>
<!-- Also hardware information -->
<storeoutput command="/sbin/lspci -vv" destination="lspci.txt"/>
<storeoutput command="/sbin/lsusb -vv" destination="lsusb.txt"/>
</metadata>
</bakonf>

5.2. File list

bakonf is composed of:

/etc/bakonf/bakonf.xml

Main configuration file.

/etc/bakonf/sources/*.xml

Configuration files for special cases (config files outside of etc dirs).

/usr/sbin/bakonf.py

Main program

/etc/cron.d/bakonf

Cron file, by default it does not run bakonf, you must uncomment a line to run it.

/var/lib/bakonf/archives

Default directory for configuration file archives.

Caution

You must decide yourself what to do with the configuration archives after bakonf creates them!