MotionEye on Gentoo (in 2021)

say you want to run MotionEye (a python 2.7 project) on a current linux distro, like Gentoo, which only really supports python 3.

First make sure that you are up-to-date with gentoo.

if you have pip installed, check if it will run from python2.7

python2.7 -m pip install motioneye

If that worked, why are you here?

if not, then go to /usr/bin and rename pip to pip3, then install pip from python

emerge -a python:2.7
mv /usr/bin/pip /usr/bin/pip3
python2.7 -m ensurepip
mv /usr/bin/pip /usr/bin/pip2
mv /usr/bin/pip3 /usr/bin/pip

Now you have pip for python2.7 installed as „pip2“

now you can simply follow the installation instructions from motioneye, replacing every mention of pip with pip2

To run from OpenRC simply create the following initscript(s)

/etc/conf.d/motioneye :

# /etc/conf.d/motioneye: config file for /etc/init.d/motioneye

MOTIONEYE_BIN="/usr/local/bin/meyectl" # alternatively in /root/.local/bin/meyectl
MOTIONEYE_PIDFILE="/var/run/motioneye.pid"
PIDFILE="/var/run/motioneye.pid"
USER="root"
MOTIONEYE_OPTIONS="startserver -c /etc/motioneye/motioneye.conf -l -b"

/etc/init.d/motioneye :

#!/sbin/openrc-run
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the BSD License

depend() {
        use net
}

start() {
        ebegin "Starting MotionEye server"
        start-stop-daemon --start --exec ${MOTIONEYE_BIN} -- ${MOTIONEYE_OPTIONS}
        eend $?
}

stop() {
        ebegin "Stopping MotionEye server"
        ${MOTIONEYE_BIN} "stopserver"
        start-stop-daemon --stop --pidfile ${MOTIONEYE_PIDFILE} --retry 5
        eend $?
}

status() {
        test -e ${MOTIONEYE_PIDFILE}
        eend $?
}

Schreibe einen Kommentar