diff options
Diffstat (limited to 'packaging/scripts/preinstall.sh')
| -rw-r--r-- | packaging/scripts/preinstall.sh | 20 | +16 −4 |
1 files changed, 16 insertions, 4 deletions
diff --git a/packaging/scripts/preinstall.sh b/packaging/scripts/preinstall.sh index 15f9f40..160d0be 100644 --- a/packaging/scripts/preinstall.sh +++ b/packaging/scripts/preinstall.sh @@ -4,11 +4,23 @@ set -e +nologin=/usr/sbin/nologin +[ -x "$nologin" ] || nologin=/sbin/nologin +[ -x "$nologin" ] || nologin=/bin/false + for svc in mirum-server mirum-worker; do - if ! getent group $svc >/dev/null; then - groupadd --system $svc + if ! getent group "$svc" >/dev/null; then + if command -v groupadd >/dev/null; then + groupadd --system "$svc" + else + addgroup -S "$svc" + fi fi - if ! getent passwd $svc >/dev/null; then - useradd --system --gid $svc --no-create-home --shell /usr/sbin/nologin $svc + if ! getent passwd "$svc" >/dev/null; then + if command -v useradd >/dev/null; then + useradd --system --gid "$svc" --no-create-home --shell "$nologin" "$svc" + else + adduser -S -H -G "$svc" -s "$nologin" "$svc" + fi fi done |
