- Fix database update service to include config path parameter - Move ConditionACPower from [Timer] to [Unit] section in timer config - Add database directory to ReadWritePaths in main service - Set explicit database path in Debian package config template - Simplify postinst script to be quiet and use consistent skyview-adsb user - Update README.Debian with comprehensive systemd service documentation - Remove confusing dual-user setup in favor of single skyview-adsb user SystemD Configuration Summary: - Main service: skyview-adsb.service with database pre-update - Database service: skyview-database-update.service (oneshot) - Weekly timer: skyview-database-update.timer (Sunday 3AM with randomization) - All services use skyview-adsb user consistently - Database path: /var/lib/skyview-adsb/skyview.db - Config path: /etc/skyview-adsb/config.json 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
50 lines
No EOL
2 KiB
Bash
Executable file
50 lines
No EOL
2 KiB
Bash
Executable file
#!/bin/bash
|
|
set -e
|
|
|
|
case "$1" in
|
|
configure)
|
|
# Create skyview-adsb user and group if they don't exist
|
|
if ! getent group skyview-adsb >/dev/null 2>&1; then
|
|
addgroup --system --quiet skyview-adsb
|
|
fi
|
|
|
|
if ! getent passwd skyview-adsb >/dev/null 2>&1; then
|
|
adduser --system --ingroup skyview-adsb --home /var/lib/skyview-adsb \
|
|
--no-create-home --disabled-password --quiet skyview-adsb
|
|
fi
|
|
|
|
# Create directories with proper permissions
|
|
mkdir -p /var/lib/skyview-adsb /var/log/skyview-adsb >/dev/null 2>&1 || true
|
|
chown skyview-adsb:skyview-adsb /var/lib/skyview-adsb /var/log/skyview-adsb >/dev/null 2>&1 || true
|
|
chmod 755 /var/lib/skyview-adsb /var/log/skyview-adsb >/dev/null 2>&1 || true
|
|
|
|
# Database directory is managed by skyview-adsb user
|
|
# (Database path configured in /etc/skyview-adsb/config.json)
|
|
|
|
# Set permissions on config files
|
|
if [ -f /etc/skyview-adsb/config.json ]; then
|
|
chown root:skyview-adsb /etc/skyview-adsb/config.json >/dev/null 2>&1 || true
|
|
chmod 640 /etc/skyview-adsb/config.json >/dev/null 2>&1 || true
|
|
fi
|
|
|
|
|
|
# Handle systemd services
|
|
systemctl daemon-reload >/dev/null 2>&1 || true
|
|
|
|
# Check if main service was previously enabled
|
|
if systemctl is-enabled skyview-adsb >/dev/null 2>&1; then
|
|
# Service was enabled, restart it
|
|
systemctl restart skyview-adsb >/dev/null 2>&1 || true
|
|
fi
|
|
|
|
# Only restart database timer if it was already enabled
|
|
if systemctl is-enabled skyview-database-update.timer >/dev/null 2>&1; then
|
|
systemctl restart skyview-database-update.timer >/dev/null 2>&1 || true
|
|
fi
|
|
|
|
# Initialize database on first install (but don't auto-enable timer)
|
|
sudo -u skyview-adsb /usr/bin/skyview-data -config /etc/skyview-adsb/config.json update >/dev/null 2>&1 || true
|
|
;;
|
|
esac
|
|
|
|
exit 0 |