OS Builder/Edit a config file

From OLPC

< OS Builder
Revision as of 04:02, 20 December 2011 by Bernie (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.
Personal tools
  • Log in
  • Login with OpenID
About OLPC
About the laptop
About the tablet
Projects
OLPC wiki
Toolbox
In other languages