Files
2026-11-04 04:58:48 -08:00

28 lines
855 B
Bash

#!/bin/sh
set -e
if ! getent group luphoto >/dev/null; then
groupadd --system luphoto
fi
if ! getent passwd luphoto >/dev/null; then
useradd --system --gid luphoto --home-dir /var/lib/luphoto --no-create-home --shell /usr/sbin/nologin --comment "LuPhoto" luphoto
fi
if ! getent group luphoto-upload >/dev/null; then
groupadd --system luphoto-upload
fi
usermod -a -G luphoto-upload luphoto
if [ ! -d /srv/luphoto/albums ]; then
install -d -m 0755 -o root -g root /srv/luphoto
install -d -m 2775 -o root -g luphoto-upload /srv/luphoto/albums
fi
install -d -m 0755 -o luphoto -g luphoto /var/lib/luphoto /var/cache/luphoto
if [ -d /run/systemd/system ]; then
systemctl daemon-reload >/dev/null 2>&1 || true
if systemctl is-active --quiet luphoto.service; then
systemctl try-restart luphoto.service >/dev/null 2>&1 || true
fi
fi
exit 0