Add widget config from community profile to meshwizard
[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 . /lib/functions.sh
6 . $dir/functions.sh
7
8 config_load system
9
10 # Rename system config
11 handle_system() {
12 if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
13 section_rename system $1 system
14 fi
15 }
16 config_foreach handle_system system
17
18 if [ -n "$(uci -q get meshwizard.community)" ]; then
19 set_defaults "community_" freifunk.community
20 uci -q delete meshwizard.community
21 fi
22 [ -n "$profile_homepage" ] && uci set freifunk.community.homepage="$profile_homepage"
23 uci_commitverbose "Setup community" freifunk
24
25 if [ -n "$(uci -q get meshwizard.contact)" ]; then
26 set_defaults "contact_" freifunk.contact
27 uci -q delete meshwizard.contact && uci_commitverbose "Setup contact" freifunk
28 fi
29
30 if [ "$has_luci" == TRUE ]; then
31 set_defaults "luci_main_" luci.main
32 uci -q delete meshwizard.luci_main && uci_commitverbose "Setup luci" luci
33 fi