fix: Correct systemd configuration and Debian package setup

- 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>
This commit is contained in:
Ole-Morten Duesund 2025-08-31 19:59:29 +02:00
commit 779384b748
6 changed files with 169 additions and 123 deletions

View file

@ -18,20 +18,8 @@ case "$1" in
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
# Create database directory for skyview user (not skyview-adsb)
mkdir -p /var/lib/skyview >/dev/null 2>&1 || true
if getent passwd skyview >/dev/null 2>&1; then
chown skyview:skyview /var/lib/skyview >/dev/null 2>&1 || true
else
# Create skyview user for database management
if ! getent group skyview >/dev/null 2>&1; then
addgroup --system --quiet skyview
fi
adduser --system --ingroup skyview --home /var/lib/skyview \
--no-create-home --disabled-password --shell /bin/false --quiet skyview
chown skyview:skyview /var/lib/skyview >/dev/null 2>&1 || true
fi
chmod 755 /var/lib/skyview >/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
@ -55,18 +43,7 @@ case "$1" in
fi
# Initialize database on first install (but don't auto-enable timer)
if [ ! -f /var/lib/skyview/skyview.db ]; then
echo "Initializing SkyView database..."
sudo -u skyview /usr/bin/skyview-data update >/dev/null 2>&1 || true
echo "Database initialized with safe (public domain) data."
echo ""
echo "To enable automatic weekly updates:"
echo " systemctl enable --now skyview-database-update.timer"
echo ""
echo "To import additional data sources:"
echo " skyview-data list"
echo " skyview-data import <source>"
fi
sudo -u skyview-adsb /usr/bin/skyview-data -config /etc/skyview-adsb/config.json update >/dev/null 2>&1 || true
;;
esac