ungleich-tools/openwrt/openwrt-add-gps.sh

32 lines
476 B
Bash
Raw Normal View History

2020-10-12 20:02:32 +00:00
#!/bin/sh
2020-11-19 18:49:40 +00:00
if [ $# -lt 1 ]; then
echo "$0 ip-address"
echo " ip-address: where to find the device"
exit 1
fi
2020-10-12 20:02:32 +00:00
2020-11-19 18:49:40 +00:00
set -x
openwrt_ip=$1; shift
ping -c3 ${openwrt_ip}
if [ $? -ne 0 ]; then
echo "Cannot reach ${openwrt_ip}, aborting"
exit 1
fi
cat <<EOF | ssh -t "root@${openwrt_ip}"
set -x
opkg update
opkg install kmod-usb-acm gpsd
uci set gpsd.core.enabled=1
uci set gpsd.core.listen_globally=1
uci set gpsd.core.device="/dev/ttyACM0"
uci commit
EOF