You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
875 B
Plaintext

1 year ago
#!/bin/sh
run_config(){
# get cellular wwan iface name
SECTIONS=$(uci show modemconfig | awk -F [\]\[\@=] '/=modem/{print $3}')
# get device path
DEV=$(uci show network | awk -F [=] '/device/{gsub("'\''",""); print $2}')
for n in $SECTIONS; do
SLOT=$(uci -q get modemconfig.@modem[$n].device)
NETMODE=$(uci -q get modemconfig.@modem[$n].mode)
GET_GSM=$(uci -q get modemconfig.@modem[$n].gsm_band)
GET_3G=$(uci -q get modemconfig.@modem[$n].3g_band)
GET_LTE=$(uci -q get modemconfig.@modem[$n].lte_band)
export SLOT NETMODE GET_GSM GET_3G GET_LTE
for d in $DEV; do
if [ $SLOT = $d ]; then
WWIFACE=$(uci -q show network | grep $d | awk -F [=.] '{print $2}')
fi
done
/usr/share/modeminfo/scripts/modemconfig && \
sleep 1 && ifdown $WWIFACE && \
sleep 1 && ifup $WWIFACE &
done
}
sleep 10 && run_config &