Add widget config from community profile to meshwizard
This commit is contained in:
parent
613de9b48f
commit
05c04b22fa
3 changed files with 28 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
||||||
# This reads the settings we need to have to configure everything
|
# This reads the settings we need to have to configure everything
|
||||||
# Argument $1: community
|
# Argument $1: community
|
||||||
|
|
||||||
|
. /lib/functions.sh
|
||||||
community="$1"
|
community="$1"
|
||||||
|
|
||||||
# reads variables from uci files, parameter $1 is the section
|
# reads variables from uci files, parameter $1 is the section
|
||||||
|
@ -9,13 +10,22 @@ get_var() {
|
||||||
uci -q show $1 | cut -d "." -f 2-100 |grep "\." | sed -e 's/^\([A-Za-z0-9_]*\)\./\1_/g' -e 's/=\(.*\)$/="\1"/g'
|
uci -q show $1 | cut -d "." -f 2-100 |grep "\." | sed -e 's/^\([A-Za-z0-9_]*\)\./\1_/g' -e 's/=\(.*\)$/="\1"/g'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handle_widgets() {
|
||||||
|
widgets="$1 $widgets"
|
||||||
|
}
|
||||||
|
config_load freifunk
|
||||||
|
config_foreach handle_widgets widget
|
||||||
|
config_load profile_$community
|
||||||
|
config_foreach handle_widgets widget
|
||||||
|
echo "widgets=$widgets"
|
||||||
|
|
||||||
# read default values from /etc/config/freifunk
|
# read default values from /etc/config/freifunk
|
||||||
for v in system wifi_device wifi_iface interface alias dhcp olsr_interface olsr_interfacedefaults zone_freifunk include; do
|
for v in system wifi_device wifi_iface interface alias dhcp olsr_interface olsr_interfacedefaults zone_freifunk include $widgets; do
|
||||||
get_var freifunk.$v
|
get_var freifunk.$v
|
||||||
done
|
done
|
||||||
|
|
||||||
# now read all values from the selected community profile, will override some values from the defaults before
|
# now read all values from the selected community profile, will override some values from the defaults before
|
||||||
for v in system wifi_device wifi_iface interface alias dhcp olsr_interface olsr_interfacedefaults profile zone_freifunk include luci_splash ipv6; do
|
for v in system wifi_device wifi_iface interface alias dhcp olsr_interface olsr_interfacedefaults profile zone_freifunk include luci_splash ipv6 $widgets; do
|
||||||
get_var profile_$community.$v
|
get_var profile_$community.$v
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
14
contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_widgets.sh
Executable file
14
contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_widgets.sh
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/sh
|
||||||
|
. /lib/functions.sh
|
||||||
|
. $dir/functions.sh
|
||||||
|
|
||||||
|
if [ -n "$widgets" ]; then
|
||||||
|
[ ! -f "/etc/config/freifunk-widgets" ] && touch /etc/config/freifunk-widgets
|
||||||
|
for w in $widgets; do
|
||||||
|
uci set freifunk-widgets.${w}=widget
|
||||||
|
set_defaults "${w}_" freifunk-widgets.${w}
|
||||||
|
uci delete profile_$community.${w}
|
||||||
|
done
|
||||||
|
uci commit profile_$community
|
||||||
|
uci_commitverbose "Added widget config." freifunk-widgets
|
||||||
|
fi
|
|
@ -61,6 +61,7 @@ $dir/helpers/setup_olsrd.sh
|
||||||
$dir/helpers/setup_firewall.sh
|
$dir/helpers/setup_firewall.sh
|
||||||
$dir/helpers/setup_ssh.sh
|
$dir/helpers/setup_ssh.sh
|
||||||
$dir/helpers/setup_uhttpd.sh
|
$dir/helpers/setup_uhttpd.sh
|
||||||
|
$dir/helpers/setup_widgets.sh
|
||||||
|
|
||||||
if [ "$wan_proto" == "static" ] && [ -n "$wan_ip4addr" ] && [ -n "$wan_netmask" ]; then
|
if [ "$wan_proto" == "static" ] && [ -n "$wan_ip4addr" ] && [ -n "$wan_netmask" ]; then
|
||||||
$dir/helpers/setup_wan_static.sh
|
$dir/helpers/setup_wan_static.sh
|
||||||
|
@ -117,4 +118,4 @@ done
|
||||||
|
|
||||||
echo "+ The wizard has finished and the router will reboot now."
|
echo "+ The wizard has finished and the router will reboot now."
|
||||||
|
|
||||||
reboot
|
#reboot
|
||||||
|
|
Loading…
Reference in a new issue