Add new meshwizard (WIP)
[project/luci.git] / contrib / package / meshwizard / files / usr / bin / meshwizard / helpers / read_defaults.sh
1 #!/bin/sh
2 # This reads the settings we need to have to configure everything
3 # Argument $1: community
4
5 community="$1"
6
7 # reads variables from uci files, parameter $1 is the section
8 get_var() {
9 uci -q show $1 | cut -d "." -f 2-100 |grep "\." | sed -e 's/^\([a-z_]*\)\./\1_/g' -e 's/=\(.*\)$/="\1"/g'
10 }
11
12 # read default values from /etc/config/freifunk
13 for v in system wifi_device wifi_iface interface alias dhcp olsr_interface olsr_interfacedefaults zone_freifunk include; do
14 get_var freifunk.$v
15 done
16
17 # now read all values from the selected community profile, will override some values from the defaults before
18 for v in system wifi_device wifi_iface interface alias dhcp olsr_interface olsr_interfacedefaults profile zone_freifunk include; do
19 get_var profile_$community.$v
20 done