Fix system installation state directory
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)
This commit is contained in:
7
debian/postinst
vendored
7
debian/postinst
vendored
@@ -14,8 +14,13 @@ case "$1" in
|
||||
chown sensorpajen:sensorpajen /etc/sensorpajen
|
||||
chmod 750 /etc/sensorpajen
|
||||
|
||||
# Create state directory with proper permissions (writable at runtime)
|
||||
mkdir -p /var/lib/sensorpajen
|
||||
chown sensorpajen:sensorpajen /var/lib/sensorpajen
|
||||
chmod 750 /var/lib/sensorpajen
|
||||
|
||||
# Copy example configs to /etc/sensorpajen if they don't exist
|
||||
for sample in sensorpajen.env.example sensors.json.example discovered_sensors.json.example; do
|
||||
for sample in sensorpajen.env.example sensors.json.example; do
|
||||
source_file="/usr/share/doc/sensorpajen/examples/$sample"
|
||||
target_file="/etc/sensorpajen/${sample%.example}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user