summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStijn Segers2016-05-25 18:18:38 +0000
committerJo-Philipp Wich2016-05-26 11:02:52 +0000
commitf8a874053c57e65247ddf5fb338be79d9d53745c (patch)
tree5e3a2537f1e0f5474ed97322bf082a54098d7e11
parent7e097772398c781c96407750a83b80e4dd8f6667 (diff)
downloadweb-f8a874053c57e65247ddf5fb338be79d9d53745c.tar.gz
Add short page on UCI defaults
-rw-r--r--docs/uci_defaults.txt42
1 files changed, 42 insertions, 0 deletions
diff --git a/docs/uci_defaults.txt b/docs/uci_defaults.txt
new file mode 100644
index 0000000..3255550
--- /dev/null
+++ b/docs/uci_defaults.txt
@@ -0,0 +1,42 @@
+---
+---
+UCI defaults
+============
+
+== Integrating custom settings through UCI defaults
+
+LEDE allows you to add custom settings by adding scripts into the 'files/etc/uci-defaults/' directory, which
+will then be run after flashing. When keeping settings, this should mean the scripts are run *after* the upgrade
+process flashed the image and appended the saved settings to the JFFS partition (which will be mounted as
+'/overlay'). The path is identical for the buildroot and the image generator. Scripts should not be executable.
+To ensure your scripts are not interfering with any other scripts, make sure they get executed last by giving them
+a high prefix (e.g. 'zzzz_customisations'). A basic script could look like this:
+
+---
+$ cat zzzz_customisations
+#!/bin/sh
+
+uci -q batch <<-EOT
+ add dhcp host
+ set dchp.@host[0].name='bellerophon'
+ set network.@host[0].ip='192.168.2.100'
+ set network.@host[0].mac='a1:b2:c3:d4:e5:f6'
+ EOT
+---
+
+Once the script has run successfully and exited cleanly (exit status 0), it will be removed from '/etc/uci-defaults/'.
+You can still consult the original in '/rom/etc/uci-defaults/' if needed.
+
+
+== Ensuring scripts don't overwrite custom settings: implementing checks
+
+Scripts in '/etc/uci-defaults' will get executed at every first boot (ie after a clean install or an upgrade),
+possibly overwriting already existing values. If this behaviour is undesired, we recommend you implement
+a test at the top of your script - e.g. probe for a custom setting your script would normally configure:
+
+---
+[ "$(uci -q get system.@system[0].zonename)" = "America/New York" ] && exit 0
+---
+
+This will ensure, when the key has the correct value set, that the script exits cleanly and gets removed from
+'/etc/uci-defaults/' as explained above.