From e2ef080da9ecaf87ca7e4e12ec87dba0daf93a77 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 29 Oct 2024 13:05:54 +0100 Subject: [PATCH] init: adjust meyectl path if needed (#3011) On Arch Linux, pip seems to not install Python modules/executables to /usr/local/bin but /usr/bin instead. In such cases, search the meyectl path in PATH and adjust the systemd service. Print an error if it could not be found at all. Fixes: https://github.com/motioneye-project/motioneye/issues/3005 Signed-off-by: MichaIng --- motioneye/extra/linux_init | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/motioneye/extra/linux_init b/motioneye/extra/linux_init index f8e1c5fc1..348acbb9f 100755 --- a/motioneye/extra/linux_init +++ b/motioneye/extra/linux_init @@ -78,5 +78,17 @@ chown -R motion:motion /etc/motioneye # Install service cp extra/motioneye.systemd /etc/systemd/system/motioneye.service +# - Update meyectl path if expected /usr/local/bin/meyectl does not exist, found on Arch Linux: https://github.com/motioneye-project/motioneye/issues/3005 +if [[ ! -f '/usr/local/bin/meyectl' ]] +then + meyectl_path=$(command -v meyectl) + if [[ $meyectl_path ]] + then + echo "Using $meyectl_path for systemd service" + sed -i "s|^ExecStart=/usr/local/bin/meyectl|ExecStart=$meyectl_path|" /etc/systemd/system/motioneye.service + else + echo 'ERROR: meyectl executable has not been found. systemd service will fail to start. Please check your motionEye installation.' + fi +fi systemctl daemon-reload systemctl enable --now motioneye