This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
documentation:configuration:uci [2015/05/09 14:54] admin created |
documentation:configuration:uci [2018/05/24 09:05] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | UCI | + | ====== UCI ====== |
| + | |||
| + | The //__U__nified __C__onfig __S__ystem// is the central pivot when it comes the routers configuration settings. | ||
| + | |||
| + | All maintained configuration files are stored in ///etc/config/// and can either be edited with a text-editor or by using the //uci// command-line interface. \\ | ||
| + | After altering the routers configuration files, affected system services needs to be restarted. | ||
| + | |||
| + | ===== Configuration Files ===== | ||
| + | |||
| + | A List of maintained configuration files: | ||
| + | [[documentation:configuration:config_files|Configuration Files]] | ||
| + | |||
| + | ===== File Syntax / Basic principle ===== | ||
| + | |||
| + | Usually the configuration files or //'packages'// consists of various blocks, so called //'sections'//. | ||
| + | Each section starts with the //'config'//-statement and can imply multiple settings. | ||
| + | |||
| + | Below is an simple example of such a section block: | ||
| + | |||
| + | <code> | ||
| + | config 'example' 'test' | ||
| + | option 'test_option1' 'some value' | ||
| + | option 'test_option2' '1' | ||
| + | list 'collection' 'first item' | ||
| + | list 'collection' 'second item' | ||
| + | </code> | ||
| + | |||
| + | The first line defines a section and follows the syntax: //config '<type>' '<name>'//. So in this example the section-type would be 'example' and its name would be 'test'. | ||
| + | |||
| + | Followed by two //'option'//-statements which defines simple values. Each option needs a name and a value. | ||
| + | |||
| + | Finally the example section ends with two //'list'//-statements. Lists are special options which can combine multiple list-entries to one singe object. | ||
| + | Like //options//, each list needs a name. If several list-statements with the same name are present in one section, each entry will be added to the list. | ||
| + | In our example, a single list named 'collection' will be generated, containing the entries 'first item' and 'second item'. | ||
| + | |||
| + | |||
| + | ====== Command line utility ====== | ||
| + | |||
| + | <code> | ||
| + | Usage | ||
| + | |||
| + | # uci | ||
| + | |||
| + | Usage: uci [<options>] <command> [<arguments>] | ||
| + | |||
| + | Commands: | ||
| + | batch | ||
| + | export [<config>] | ||
| + | import [<config>] | ||
| + | changes [<config>] | ||
| + | commit [<config>] | ||
| + | add <config> <section-type> | ||
| + | add_list <config>.<section>.<option>=<string> | ||
| + | show [<config>[.<section>[.<option>]]] | ||
| + | get <config>.<section>[.<option>] | ||
| + | set <config>.<section>[.<option>]=<value> | ||
| + | delete <config>[.<section[.<option>]] | ||
| + | rename <config>.<section>[.<option>]=<name> | ||
| + | revert <config>[.<section>[.<option>]] | ||
| + | |||
| + | Options: | ||
| + | -c <path> set the search path for config files (default: /etc/config) | ||
| + | -d <str> set the delimiter for list values in uci show | ||
| + | -f <file> use <file> as input instead of stdin | ||
| + | -m when importing, merge data into an existing package | ||
| + | -n name unnamed sections on export (default) | ||
| + | -N don't name unnamed sections | ||
| + | -p <path> add a search path for config change files | ||
| + | -P <path> add a search path for config change files and use as default | ||
| + | -q quiet mode (don't print error messages) | ||
| + | -s force strict mode (stop on parser errors, default) | ||
| + | -S disable strict mode | ||
| + | -X do not use extended syntax on 'show' | ||
| + | </code> | ||
| + | |||
| + | If you want to look up your changes use the following command: | ||
| + | <code> | ||
| + | uci changes | ||
| + | </code> | ||
| + | |||
| + | In case you alter the UCI configuration using the command-line interface, the config needs to be written to the configuration files by commiting them using: | ||
| + | <code> | ||
| + | uci commit | ||
| + | </code> | ||
| + | before any service restarts will take effect of the configuration | ||