From 2a7da4fabb2e1f801599b3c72305c94be393079b Mon Sep 17 00:00:00 2001 From: MichaIng Date: Mon, 17 Jun 2024 14:30:26 +0200 Subject: [PATCH] init: adjust meyectl path if needed 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