OS Builder/Edit a config file: Difference between revisions
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, …') |
No edit summary |
||
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 |
|||
sed -i 's/CONFIG_VALUE="yes"/CONFIG_VALUE="no"/' $INSTALL_ROOT/etc/sometool/sometool.conf |
Revision as of 18:18, 19 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 sed -i 's/CONFIG_VALUE="yes"/CONFIG_VALUE="no"/' $INSTALL_ROOT/etc/sometool/sometool.conf