mirror of
https://github.com/openwrt/packages.git
synced 2026-06-17 17:00:28 +04:00
bsbf-autoconf-cellular: set device option for network
Set the device option for the network. This is solely for the ease of matching the network to the corresponding network interface. Signed-off-by: Chester A. Unal <chester.a.unal@arinc9.com>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bsbf-openwrt-resources
|
||||
PKG_VERSION:=1
|
||||
PKG_VERSION:=2
|
||||
|
||||
PKG_LICENSE:=AGPL-3.0-or-later
|
||||
PKG_MAINTAINER:=Chester A. Unal <chester.a.unal@arinc9.com>
|
||||
|
||||
@@ -14,11 +14,22 @@ else
|
||||
devpath=/sys"${DEVPATH%/*/*/*/*}"
|
||||
fi
|
||||
|
||||
# If a network with the device path already exists, set control model to the
|
||||
# current detected one and exit.
|
||||
uci_network=$(uci show network)
|
||||
|
||||
# Delete the interface name if it's already set somewhere.
|
||||
device_section=$(echo "$uci_network" | grep ".device='$DEVICENAME'" | cut -d. -f2)
|
||||
if [ -n "$device_section" ]; then
|
||||
uci delete network.$device_section.device
|
||||
uci commit network
|
||||
fi
|
||||
|
||||
# If a network with the device path already exists, set the interface name and
|
||||
# control model to the current detected one, bring up the network, and exit.
|
||||
# Setting the interface name is solely for the ease of matching the network to
|
||||
# the corresponding interface.
|
||||
section=$(echo "$uci_network" | grep ".devpath='$devpath'" | cut -d. -f2)
|
||||
if [ -n "$section" ]; then
|
||||
uci set network.$section.device="$DEVICENAME"
|
||||
uci set network.$section.proto="$cur_proto"
|
||||
uci commit network
|
||||
ifup $section
|
||||
@@ -44,6 +55,7 @@ while echo "$uci_network" | grep -q "wwan$index"; do
|
||||
done
|
||||
|
||||
uci set network.wwan$index=interface
|
||||
uci set network.wwan$index.device="$DEVICENAME"
|
||||
uci set network.wwan$index.devpath="$devpath"
|
||||
uci set network.wwan$index.proto="$cur_proto"
|
||||
uci set network.wwan$index.apn='internet'
|
||||
|
||||
Reference in New Issue
Block a user