ungleich-tools/openwrt-add-camera.sh

74 lines
1.1 KiB
Bash
Raw Normal View History

2020-10-12 21:06:24 +00:00
#!/bin/sh
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
uci commit
/etc/init.d/mjpg-streamer restart
EOF
exit 0
# This is old code / when we used motion
cat <<EOF | ssh -t "root@${openwrt_ip}"
set -x
opkg update
2020-10-12 21:06:24 +00:00
opkg install motion kmod-video-uvc
uci set motion.general.enabled=1
cat > /etc/motion.conf <<COF
2020-10-12 21:06:24 +00:00
ipv6_enabled on
2020-10-12 21:06:24 +00:00
daemon off
process_id_file /var/run/motion/motion.pid
setup_mode off
webcontrol_port 8080
webcontrol_localhost on
videodevice /dev/video0
v4l2_palette 8
width 1280
height 720
videodevice /dev/video0
input -1
stream_port 8081
stream_localhost off
COF
2020-10-12 21:06:24 +00:00
/etc/init.d/motion restart
2020-10-12 21:06:24 +00:00
EOF