OS Builder/Edit a config file

From OLPC
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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 
sed -i 's/CONFIG_VALUE="yes"/CONFIG_VALUE="no"/' $INSTALL_ROOT/etc/sometool/sometool.conf