From 85af215d73ab84097c3cb35f913faf6c51a4a163 Mon Sep 17 00:00:00 2001 From: Fredrik Wahlberg Date: Sun, 28 Dec 2025 09:29:40 +0100 Subject: [PATCH] Fix postinst: Install sensorpajen package in venv The venv had dependencies installed but not the sensorpajen package itself, causing 'No module named sensorpajen' errors when running. Changes: - After installing dependencies from requirements.txt - Now also runs 'pip install --no-deps .' to install sensorpajen - Uses --no-deps to avoid re-installing already-installed dependencies - Installed in /opt/sensorpajen where pyproject.toml exists Fixes: ModuleNotFoundError: No module named 'sensorpajen' --- debian/postinst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/debian/postinst b/debian/postinst index 22f3432..4720978 100755 --- a/debian/postinst +++ b/debian/postinst @@ -48,7 +48,7 @@ case "$1" in venv/bin/pip install -r /opt/sensorpajen/requirements.txt else echo "Warning: requirements.txt not found, installing bluepy and paho-mqtt directly" - venv/bin/pip install bluepy paho-mqtt + venv/bin/pip install bluepy paho-mqtt pybluez fi if [ $? -ne 0 ]; then @@ -56,6 +56,15 @@ case "$1" in exit 1 fi + # Install sensorpajen package itself + echo "Installing sensorpajen application..." + cd /opt/sensorpajen + venv/bin/pip install --no-deps . || { + echo "Error: Failed to install sensorpajen package" + exit 1 + } + cd / + # Set ownership of application directory BEFORE setting capabilities chown -R sensorpajen:sensorpajen /opt/sensorpajen