#!/bin/sh
#
# Copyright (C) 2014-2020, Lantronix, Inc. All Rights Reserved.
#           7535 Irvine Center Drive, Suite 100
#           Irvine, CA 92618 USA

# Permission to use, copy, modify this software for any
# purpose is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.

# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#

# Add usb0 entry to network
uci -q batch <<-EOF >/dev/null
	delete network.usb0
	set network.usb0=interface
	set network.usb0.proto='static'
	set network.usb0.device='usb0'
	set network.usb0.ipaddr='192.168.100.10'
	set network.usb0.netmask='255.255.255.0'
	set network.usb0.broadcast='192.168.100.255'
	set network.usb0.gateway='192.168.100.0'
	set network.usb0.force_link='1'
	set network.usb0.defaultroute='0'
	commit network
EOF

# Change Hostname entry to system as per board
uci -q batch <<-EOF >/dev/null
	set system.@system[0].hostname='Master'
	commit system
EOF

# remove LuCI cache
rm -rf /tmp/luci-indexcache /tmp/luci-modulecache

exit 0
