Skip to content

Instantly share code, notes, and snippets.

@jorrinpollard
Created July 3, 2019 10:42
Show Gist options
  • Save jorrinpollard/4fdf7cbe5f46c201ec719232e706fa7b to your computer and use it in GitHub Desktop.
Save jorrinpollard/4fdf7cbe5f46c201ec719232e706fa7b to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
# Install the dependencies from the repositories:
apt-get update && apt-get install -y \
ffmpeg \
libcurl4-openssl-dev \
libjpeg-dev \
libmariadbclient-dev \
libpq5 \
libssl-dev \
libz-dev \
python-dev \
python-pip \
v4l-utils \
;
# Install motion:
wget -O /tmp/motion.deb \
https://github.com/Motion-Project/motion/releases/download/release-4.1.1/pi_stretch_motion_4.1.1-1_armhf.deb && \
dpkg --force-confold -i /tmp/motion.deb && \
rm /tmp/motion.deb
# Fix possible broken libavcodec dependencies
apt-get -y --fix-broken install motion
# Install motioneye, which will automatically pull Python dependencies (tornado, jinja2, pillow and pycurl):
# note: If pillow installation fails, you can try installing it from official repos using apt-get install python-pillow.
pip install --upgrade motioneye
# Prepare the configuration and media directory:
mkdir -p /etc/motioneye /var/lib/motioneye && \
cp /usr/local/share/motioneye/extra/motioneye.conf.sample /etc/motioneye/motioneye.conf
# Add an init script, configure it to run at startup and start the motionEye server:
cp /usr/local/share/motioneye/extra/motioneye.systemd-unit-local /etc/systemd/system/motioneye.service && \
systemctl daemon-reload && \
systemctl enable motioneye && \
systemctl start motioneye
# To upgrade to the newest version of motionEye, just issue:
# pip install motioneye --upgrade && systemctl restart motioneye
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment