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'
This commit is contained in:
2025-12-28 09:29:40 +01:00
parent c5e6187523
commit 85af215d73

11
debian/postinst vendored
View File

@@ -48,7 +48,7 @@ case "$1" in
venv/bin/pip install -r /opt/sensorpajen/requirements.txt venv/bin/pip install -r /opt/sensorpajen/requirements.txt
else else
echo "Warning: requirements.txt not found, installing bluepy and paho-mqtt directly" 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 fi
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
@@ -56,6 +56,15 @@ case "$1" in
exit 1 exit 1
fi 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 # Set ownership of application directory BEFORE setting capabilities
chown -R sensorpajen:sensorpajen /opt/sensorpajen chown -R sensorpajen:sensorpajen /opt/sensorpajen