favoritter/dist/postinstall.sh

21 lines
751 B
Bash
Raw Normal View History

#!/bin/sh
# Post-install script for Favoritter .deb/.rpm package.
# Creates the system user and sets directory permissions.
set -e
# Create system user if it doesn't exist.
if ! getent passwd favoritter >/dev/null 2>&1; then
useradd -r -s /usr/sbin/nologin -d /var/lib/favoritter favoritter
fi
# Ensure data directories exist with correct ownership.
install -d -o favoritter -g favoritter -m 0750 /var/lib/favoritter
install -d -o favoritter -g favoritter -m 0750 /var/lib/favoritter/uploads
# Reload systemd to pick up the service file.
if command -v systemctl >/dev/null 2>&1; then
systemctl daemon-reload
fi
echo "Favoritter installed. Configure /etc/favoritter/favoritter.env then run:"
echo " sudo systemctl enable --now favoritter"