2020-10-12 21:06:24 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2020-10-26 10:52:49 +00:00
|
|
|
if [ $# -lt 1 ]; then
|
|
|
|
echo "$0 ip-address"
|
|
|
|
echo " ip-address: where to find the device"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2020-11-19 18:49:24 +00:00
|
|
|
opkg update
|
|
|
|
opkg install mjpg-streamer kmod-video-uvc
|
|
|
|
|
|
|
|
uci set mjpg-streamer.core.enabled=1
|
|
|
|
uci set mjpg-streamer.core.resolution="1920x1080"
|
|
|
|
uci delete mjpg-streamer.core.username
|
|
|
|
uci delete mjpg-streamer.core.password
|
2020-10-12 21:06:24 +00:00
|
|
|
|
2021-07-19 19:53:26 +00:00
|
|
|
if ! uci show firewall | grep "name='Allow-Camera'"; then
|
|
|
|
uci add firewall rule
|
|
|
|
uci set firewall.@rule[-1].name='Allow-HTTP'
|
|
|
|
uci set firewall.@rule[-1].src='wan'
|
|
|
|
uci set firewall.@rule[-1].proto='tcp'
|
|
|
|
uci set firewall.@rule[-1].dest_port='8080'
|
|
|
|
uci set firewall.@rule[-1].target='ACCEPT'
|
|
|
|
fi
|
2020-10-12 21:06:24 +00:00
|
|
|
|
2021-07-19 19:53:26 +00:00
|
|
|
uci commit
|
2020-10-12 21:06:24 +00:00
|
|
|
|
2020-10-26 10:52:49 +00:00
|
|
|
|
2021-07-19 19:53:26 +00:00
|
|
|
/etc/init.d/mjpg-streamer restart
|
2020-10-12 21:06:24 +00:00
|
|
|
|
|
|
|
EOF
|