From 23463b606d886d72ebf458bd5afd368a5878ccec Mon Sep 17 00:00:00 2001 From: Lloyd Date: Tue, 10 Mar 2026 16:46:13 +0000 Subject: [PATCH] Fix WorkingDirectory in service files to prevent shadowing of pip-installed package --- manage.sh | 14 ++++++++++++++ pymc-repeater.service | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/manage.sh b/manage.sh index db119ae..f0aab6b 100755 --- a/manage.sh +++ b/manage.sh @@ -372,6 +372,13 @@ if grep -q 'PYTHONPATH' "$SVC_UNIT" 2>/dev/null; then sed -i '/^Environment=.*PYTHONPATH/d' "$SVC_UNIT" systemctl daemon-reload fi +# Migration: fix WorkingDirectory if it still points at the old source checkout. +# /opt/pymc_repeater contains a repeater/ subdirectory which shadows the +# pip-installed package, causing updates to have no effect on the running process. +if grep -q 'WorkingDirectory=/opt/pymc_repeater' "$SVC_UNIT" 2>/dev/null; then + sed -i 's|WorkingDirectory=/opt/pymc_repeater|WorkingDirectory=/var/lib/pymc_repeater|' "$SVC_UNIT" + systemctl daemon-reload +fi exec python3 -m pip install \ --break-system-packages \ --no-cache-dir \ @@ -691,6 +698,13 @@ if grep -q 'PYTHONPATH' "$SVC_UNIT" 2>/dev/null; then sed -i '/^Environment=.*PYTHONPATH/d' "$SVC_UNIT" systemctl daemon-reload fi +# Migration: fix WorkingDirectory if it still points at the old source checkout. +# /opt/pymc_repeater contains a repeater/ subdirectory which shadows the +# pip-installed package, causing updates to have no effect on the running process. +if grep -q 'WorkingDirectory=/opt/pymc_repeater' "$SVC_UNIT" 2>/dev/null; then + sed -i 's|WorkingDirectory=/opt/pymc_repeater|WorkingDirectory=/var/lib/pymc_repeater|' "$SVC_UNIT" + systemctl daemon-reload +fi exec python3 -m pip install \ --break-system-packages \ --no-cache-dir \ diff --git a/pymc-repeater.service b/pymc-repeater.service index 8ae844a..7384859 100644 --- a/pymc-repeater.service +++ b/pymc-repeater.service @@ -10,7 +10,7 @@ Wants=network-online.target Type=simple User=repeater Group=repeater -WorkingDirectory=/opt/pymc_repeater +WorkingDirectory=/var/lib/pymc_repeater # Start command - use python module directly with proper path ExecStart=/usr/bin/python3 -m repeater.main --config /etc/pymc_repeater/config.yaml