OS Builder/Edit a config file: Difference between revisions

From OLPC
Jump to navigation Jump to search
(Created page with 'This recipe will show you how to apply a change to a config file on the resulting XO image. Note that a very small config file change may break the OS, sometimes spectacularly, …')
 
 
(2 intermediate revisions by one other user not shown)
Line 2: Line 2:


Note that a very small config file change may break the OS, sometimes spectacularly, sometimes in subtle ways. Make sure you test your changes in depth, no matter how simple they may appear.
Note that a very small config file change may break the OS, sometimes spectacularly, sometimes in subtle ways. Make sure you test your changes in depth, no matter how simple they may appear.

=Simple edit using sed=

For this configuration change, we will use a regular expression, with the tool sed.

* Add the "custom_scripts" module to the modules list
* At the end of your config file, add this section:
[custom_scripts]
custom_script_0=%(oob_config_dir)s/config_edit.sh
* In the same directory as your config file, create a file called "config_edit.sh", containing:
#!/bin/bash -x
set -e
echo 'VOIDS YOUR WARRANTY!'
sed -i 's/CONFIG_VALUE="yes"/CONFIG_VALUE="no"/' $INSTALL_ROOT/etc/sometool/sometool.conf

=Example uses=

Note that using these example changes can affect your build significantly.
* Edit /usr/share/olpc-utils/xorg.conf.d/xo1.75.conf to change DontZap from true to false, or to enable RenderAccel

=Hints=

* Test your sed replacements manually, on an installed image, until you have them right.
* Remember to test the resulting build for subtle problems.

Latest revision as of 04:02, 20 December 2011

This recipe will show you how to apply a change to a config file on the resulting XO image.

Note that a very small config file change may break the OS, sometimes spectacularly, sometimes in subtle ways. Make sure you test your changes in depth, no matter how simple they may appear.

Simple edit using sed

For this configuration change, we will use a regular expression, with the tool sed.

  • Add the "custom_scripts" module to the modules list
  • At the end of your config file, add this section:
[custom_scripts]
custom_script_0=%(oob_config_dir)s/config_edit.sh
  • In the same directory as your config file, create a file called "config_edit.sh", containing:
#!/bin/bash -x 
set -e
echo 'VOIDS YOUR WARRANTY!'
sed -i 's/CONFIG_VALUE="yes"/CONFIG_VALUE="no"/' $INSTALL_ROOT/etc/sometool/sometool.conf

Example uses

Note that using these example changes can affect your build significantly.

  • Edit /usr/share/olpc-utils/xorg.conf.d/xo1.75.conf to change DontZap from true to false, or to enable RenderAccel

Hints

  • Test your sed replacements manually, on an installed image, until you have them right.
  • Remember to test the resulting build for subtle problems.