From 4137072731c36a3db3af8e0bd6f718b64d439d8b Mon Sep 17 00:00:00 2001 From: Nikolay Govorov Date: Mon, 12 Jan 2026 22:51:15 +0000 Subject: Fix packages for usage in containers without systemd --- pkg/scripts/postinstall.sh | 17 ++++++++++++----- pkg/scripts/preremove.sh | 6 ++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/pkg/scripts/postinstall.sh b/pkg/scripts/postinstall.sh index f6f2c15..2373a73 100644 --- a/pkg/scripts/postinstall.sh +++ b/pkg/scripts/postinstall.sh @@ -4,12 +4,19 @@ set -e -if ! getent group zorian >/dev/null; then - groupadd --system zorian +PROGRAM=zorian +ZORIAN_USER=${ZORIAN_USER:-zorian} +ZORIAN_GROUP=${ZORIAN_GROUP:-${ZORIAN_USER}} + +if ! getent group $ZORIAN_GROUP >/dev/null; then + groupadd --system $ZORIAN_GROUP fi -if ! getent passwd zorian >/dev/null; then - useradd --system --gid zorian --no-create-home --shell /usr/sbin/nologin zorian +if ! getent passwd $ZORIAN_USER >/dev/null; then + useradd --system --gid $ZORIAN_GROUP --no-create-home --shell /usr/sbin/nologin $ZORIAN_USER fi -systemctl daemon-reload +if [ -x "/bin/systemctl" ] && [ -d /run/systemd/system ] && [ -f /usr/lib/systemd/system/zorian.service ]; then + /bin/systemctl daemon-reload + /bin/systemctl enable zorian +fi diff --git a/pkg/scripts/preremove.sh b/pkg/scripts/preremove.sh index 9236820..87c062a 100644 --- a/pkg/scripts/preremove.sh +++ b/pkg/scripts/preremove.sh @@ -4,5 +4,7 @@ set -e -systemctl stop zorian.service || true -systemctl disable zorian.service || true +if [ -x "/bin/systemctl" ] && [ -d /run/systemd/system ] && [ -f /usr/lib/systemd/system/zorian.service ]; then + /bin/systemctl stop zorian.service || true + /bin/systemctl disable zorian.service || true +fi -- Gilti