The service was failing with 'Read-only file system' when trying to create discovered_sensors.json in the /etc/sensorpajen config directory. Changes: - config.py: Add STATE_DIR for runtime state - System mode: /var/lib/sensorpajen (writable at runtime) - Dev mode: config/ (same as config directory) - config.py: Use STATE_DIR for discovered_sensors.json path - debian/postinst: Create and own /var/lib/sensorpajen - debian/sensorpajen.service: Add /var/lib/sensorpajen to ReadWritePaths - debian/postinst: Remove discovered_sensors.json.example copy (created at runtime) This separates: - Config: /etc/sensorpajen (static, not updated by service) - State: /var/lib/sensorpajen (dynamic, updated by service at runtime)
33 lines
792 B
Desktop File
33 lines
792 B
Desktop File
[Unit]
|
|
Description=Sensorpajen - Bluetooth Temperature Sensor Monitor
|
|
Documentation=https://github.com/yourusername/sensorpajen
|
|
After=network.target bluetooth.target
|
|
Wants=bluetooth.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=sensorpajen
|
|
Group=sensorpajen
|
|
WorkingDirectory=/opt/sensorpajen
|
|
EnvironmentFile=/etc/sensorpajen/sensorpajen.env
|
|
ExecStart=/opt/sensorpajen/venv/bin/python -m sensorpajen.main
|
|
Restart=always
|
|
RestartSec=10
|
|
|
|
# Bluetooth capabilities require this to be false
|
|
NoNewPrivileges=false
|
|
|
|
# Logging
|
|
StandardOutput=journal
|
|
StandardError=journal
|
|
SyslogIdentifier=sensorpajen
|
|
|
|
# Security hardening (where possible with Bluetooth requirements)
|
|
PrivateTmp=true
|
|
ProtectSystem=strict
|
|
ProtectHome=true
|
|
ReadWritePaths=/etc/sensorpajen /var/lib/sensorpajen
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|