HDTV and XBMC in your living room - based on Nvidia VDPAU, VDR and Ubuntu Linux

Applying persistant changes to configuration files

Many configuration files are automatically overwritten by yaVDR regularly with new content. If you're going to introduce persistant changes to configuration files manually, a decent understanding of the templating concept and the creation of custom templates will be mandatory. This article covers both topics.

Standard templates and custom templates

In yaVDR the main configuration files are compiled automatically from so called templates. The default templates, provided by the yaVDR team, are called 'standard templates'. We offer an overview page that lists all these standard templates.

As soon as you're introducing a change to the configuration files, you will be faced with a few hurdles:

  • A direct change of a configuration file will be overwritten by the 'standard template' as soon as you update yaVDR system packages (e.g. yavdr-utils, yavdr-startup, ...). The installation/update of these packages trigger the regeneration of all configuration files.
  • Also, you're not supposed to change the 'standard templates' themselves, since these 'standard templates' will be reset during a package update.


Thus, there is the possibility to create custom templates that complement these 'standard templates' or over-rule parts of them.
Your custom templates have to be created manually in the directory /etc/yavdr/templates_custom/. This directory (and its content) won't be changed, updated or deleted through package updates.

Note: To keep your frustration low, previous versions of the configuration files will be back-upped (to /var/cache/yavdr/process-template-backup) before overwriting them.

Example #1: /etc/X11.xorg.conf.yavdr

As a practical example, let's have a look at the configuration file /etc/X11/xorg.conf.yavdr. If there are no custom templates, the file xorg.conf.yavdr is entirely based on the default templates, which are maintained, delivered and updated by the yaVDR team.


Before we're gonna create custom templates for xorg.conf.yavdr, we look at the yaVDR standard templates for this file first.
These are located in the directory /usr/share/yavdr/templates/etc/X11/xorg.conf.yavdr/. The following command will display the content of this directory:

$ ls -all /usr/share/yavdr/templates/etc/X11/xorg.conf.yavdr/

These template files will be processed in alphanumercial order to generate the xorg.conf.yavdr. That means, a single file contains only a fraction of the final configuration file. As mentioned above, persitant changes have to be introduced in a separate directory.

Check whether this directory exists, or create it via:

$ sudo mkdir -p /etc/yavdr/templates_custom/etc/X11/xorg.conf.yavdr/

You have nearly full freedom to name your file inside this directory.
But, you have to used the proper numerical prefix, to get your change into the correct position in the configuration file.

Example:

  • 001my_template

Your file will be inserted between 000header and 0100serverlayout-header once the xorg.conf.yavdr is generated:

  • 000header
  • 001my_tempate
  • 0100serverlayout-header
  • ...

Finally, you can initiate the generation of the configuration file manually:

$ sudo process-template /etc/X11/xorg.conf.yavdr

If you like to replace (instead of inserting) a part of our 'standard templates', your file name needs to be identical to file name of the standard template.

Of course, this works not only for the xorg.conf.yavdr, but for all configuration files!

Example #2: /etc/vdr/vdr-nvram-wakeup

For certain files, you might not like to have them updated (completely, or parts of it) at all. Thus, we create a custom template to prevent future updates:

We start again with the creation of the directory:

$ mpdir -p /etc/yaVDR/templates_custom/etc/vdr/vdr-nvram-wakeup/

We will now copy all original templates into this directory:

$ cp /usr/share/yavdr/templates/etc/vdr/vdr-nvram-wakeup.conf/10_enable-nvram /etc/yavdr/templates_custom/etc/vdr/vdr-nvram-wakeup.conf/
$ cp /usr/share/yavdr/templates/etc/vdr/vdr-nvram-wakeup.conf/20_commandline /etc/yavdr/templates_custom/etc/vdr/vdr-nvram-wakeup.conf/
$ cp /usr/share/yavdr/templates/etc/vdr/vdr-nvram-wakeup.conf/30_specialshutdown /etc/yavdr/templates_custom/etc/vdr/vdr-nvram-wakeup.conf/
$ cp /usr/share/yavdr/templates/etc/vdr/vdr-nvram-wakeup.conf/40_force-reboot /etc/yavdr/templates_custom/etc/vdr/vdr-nvram-wakeup.conf/

In the next step, you can customize these files to your needs.
Use your editor of choice, e.g.:

$ nano /etc/yavdr/templates_custom/etc/vdr/vdr-nvram-wakeup.conf/10_enable-nvram
$ nano /etc/yavdr/templates_custom/etc/vdr/vdr-nvram-wakeup.conf/20_commandline
$ nano /etc/yavdr/templates_custom/etc/vdr/vdr-nvram-wakeup.conf/30_specialshutdown
$ nano /etc/yavdr/templates_custom/etc/vdr/vdr-nvram-wakeup.conf/40_force-reboot

Finally, generate the template via:

$ sudo process-template /etc/vdr/vdr-nvram-wakeup.conf

You can check the final configuration file via:

$ cat /etc/vdr/vdr-nvram-wakeup.conf

Summary

The 'standard templates', provided with the distribution, are located in:

/usr/share/yavdr/templates/

Your own customized templates will go below the directory:

/etc/yavdr/templates_custom/

The script process-template will generate the configuration file accordingly

Before overwriting any configuration files with new versions, process-template will put a copy of old configuration files below:

/var/cache/yavdr/process-template-backup

Some files need special rights or security settings. These can be set by:

$ sudo process-template -owner=vdr -group=vdr /var/lib/vdr/setup.conf
$ sudo process-template -mode 755 /usr/bin/start-xine

Acknowledgements

We would like to thank Marcus Zurhorst for translating this tutorial to English language and creating the nice diagram for the summary.


Copyright © 2010 yaVDR. This page was last updated on 2011-04-15.