port_management: populate ports config if it has invalid config

This commit is contained in:
Sukru Senli 2016-04-19 15:29:34 +02:00
parent 39733b6227
commit a2220489b3

View file

@ -12,14 +12,14 @@ check_for_config(){
if [ -s "/etc/config/ports" ] if [ -s "/etc/config/ports" ]
then then
debug_print "file exists and has content" debug_print "file exists and has content"
if uci -q show ports >/dev/null #are there any valid content then continue if uci -q get ports.@ethport[0] >/dev/null #are there any valid content then continue
then then
return 0 return 0
else else
rm -f /etc/config/ports rm -f /etc/config/ports
fi fi
fi fi
debug_print "file doesent exsists or is empty" debug_print "ports config file doesn't exsist or is empty"
touch /etc/config/ports touch /etc/config/ports
local portnames="$(db get hw.board.ethernetPortNames)" local portnames="$(db get hw.board.ethernetPortNames)"
local portorder="$(db get hw.board.ethernetPortOrder)" local portorder="$(db get hw.board.ethernetPortOrder)"