making init script smarter to figure out what interface to use

This commit is contained in:
Strhuan Blomquist 2013-07-17 16:47:58 +02:00
parent d17e3100c7
commit 2b7bc37755

View file

@ -1,9 +1,9 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2012 Inteno
include /lib/network
. /usr/share/libubox/jshn.sh
START=99
START=60
STOP=40
EXTRA_HELP=" start [GetRPCMethods] Start cwmpd service and send GetRPCMethods"
@ -23,7 +23,7 @@ check_url_format() {
}
check_acs_url() {
default_acs="http://192.168.1.1:8080/openacs/acs"
default_acs="http://10.10.1.6:8000/openacs/acs"
acs_dhcp_discovery=`uci -q get cwmp.acs.dhcp_discovery`
url=`uci -q get cwmp.acs.url`
dhcp_url_path=`uci -q get cwmp.acs.dhcp_url_path`
@ -66,12 +66,25 @@ check_dhcp() {
done
fi
}
set_wan_interface()
{
local device=""
local default_wan_interface=""
config_load cwmp
config_get default_wan_interface cpe default_wan_interface
json_load "$(ifstatus $default_wan_interface)"
json_get_var device device
uci_set cwmp cpe interface "$device"
uci_commit
}
start_msg="Start cwmpd ..."
stop_msg="Stop cwmpd ..."
run() {
echo $start_msg;printf "\033[A" ;sleep 1
set_wan_interface
check_dhcp
check_acs_url
if [ "_$1" = "_boot" ];then