ungleich-tools/openwrt/openwrt-add-qmi-lte.sh

43 lines
939 B
Bash
Executable File

#!/bin/sh
# Based on work of Samuel Hailu, 2020-09-10
if [ $# -ne 1 ]; then
echo "$0 ip-address interface"
echo " ip-address: where to find the OpenWRT device"
exit 1
fi
my_ip=$1; shift
cat <<EOF | ssh -t "root@${my_ip}"
set -x
opkg update
opkg install libustream-openssl ca-bundle ca-certificates
opkg install kmod-usb-net-qmi-wwan uqmi luci-proto-qmi
# Create interface
uci set network.lte=interface
uci set network.lte.device='/dev/cdc-wdm0'
uci set network.lte.proto='qmi'
uci set network.lte.apn='internet'
uci set network.lte.auth='both'
uci set network.lte.modes='lte'
uci set network.lte.pdptype='ipv4'
uci set network.lte.username='any'
uci set network.lte.password='any'
# add to correct firewall zone
current_networks=\$(uci get firewall.@zone[1].network)
if ! echo \$current_networks | grep -q lte; then
uci set firewall.@zone[1].network="\${current_networks} lte"
fi
# commit
uci commit
reboot
EOF