contrib/meshwizard: Fix setting of values which contain spaces & cleanups
[project/luci.git] / contrib / package / meshwizard / files / usr / bin / meshwizard / helpers / initial_config.sh
1 #!/bin/sh
2 # This is only run once (usually after flashing an image from the imagebuilder)
3 # It sets up the initial config for this node.
4
5
6 . /etc/functions.sh
7 . $dir/functions.sh
8
9 ### System config
10
11 config_load system
12
13 # Rename system config
14 handle_system() {
15         if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
16                 section_rename system $1 system
17         fi
18 }
19 config_foreach handle_system system
20
21 if [ -n "$(uci -q get meshwizard.community)" ]; then
22         echo "    + Setup community"
23         set_defaults "community_" freifunk.community
24         uci -q delete meshwizard.community
25         uci_commitverbose freifunk
26 fi
27
28 if [ -n "$(uci -q get meshwizard.contact)" ]; then
29         echo "    + Setup contact"
30         set_defaults "contact_" freifunk.contact
31         uci -q delete meshwizard.contact && uci_commitverbose freifunk
32 fi
33
34 if [ "$has_luci" == TRUE ]; then
35         echo "    + Setup luci"
36         set_defaults "luci_main_" luci.main
37         uci -q delete meshwizard.luci_main && uci_commitverbose luci
38 fi
39
40 uci commit
41
42