meshwizard: Fix olsrd plugin setup/renaming

This commit is contained in:
Manuel Munz 2012-08-02 18:32:41 +00:00
parent 6574b8147c
commit 0c4edd49b9
2 changed files with 8 additions and 7 deletions

View file

@ -35,7 +35,7 @@ set_defaults() {
# 3 arguements: 1=config name 2=oldname 3=newname
section_rename() {
uci -q rename $1.$2=$3 && msg_rename $1.$2 $1.$3 || msg_rename_error $1.2 $1.$3
uci -q rename $1.$2=$3 && msg_rename $1.$2 $1.$3 || msg_rename_error $1.$2 $1.$3
}
msg_missing_value() {

View file

@ -4,8 +4,7 @@
. /lib/functions.sh
. $dir/functions.sh
# Clean the config, remove httpinfo and interface wlan
uci -q delete olsrd.olsrd_httpinfo
# Clean the config, remove interface wlan
handle_interface() {
config_get interface "$1" interface
if [ "$interface" = "wlan" ]; then
@ -14,7 +13,6 @@ handle_interface() {
}
config_load olsrd
config_foreach handle_interface Interface
uci_commitverbose "Cleanup olsrd config" olsrd
#Rename olsrd basic settings
handle_olsrd() {
@ -36,13 +34,11 @@ config_foreach handle_interfacedefaults InterfaceDefaults
if [ "$profile_ipv6" = 1 ] && [ "$has_ipv6" == "1" ]; then
uci set olsrd.olsrd.IpVersion="6and4"
fi
uci_commitverbose "Setup olsr basic settings" olsrd
# Setup new InterfaceDefaults
uci set olsrd.InterfaceDefaults=InterfaceDefaults
set_defaults "olsr_interfacedefaults_" olsrd.InterfaceDefaults
uci_commitverbose "Setup olsr interface defaults" olsrd
# Rename nameservice, dyngw and httpinfo plugins
@ -50,10 +46,15 @@ handle_plugin() {
config_get library "$1" library
if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
new="$(echo $library | cut -d '.' -f 1)"
section_rename olsrd $1 $new
section_rename olsrd "$1" "$new"
fi
}
config_foreach handle_plugin LoadPlugin
uci -q delete olsrd.olsrd_httpinfo
uci -q delete olsrd.olsrd_dyn_gw
uci_commitverbose "Cleanup olsrd config" olsrd
# Setup nameservice plugin
if [ -n "$profile_suffix" ]; then