2023-02-17 12:13:28 +00:00
|
|
|
#!/bin/sh
|
2021-12-07 13:23:57 +00:00
|
|
|
set -e
|
|
|
|
|
2023-02-06 10:43:24 +00:00
|
|
|
DISTRO="UNKNOWN"
|
2023-02-17 12:13:28 +00:00
|
|
|
if [ -r /etc/os-release ]; then
|
2023-02-17 13:26:23 +00:00
|
|
|
. /etc/os-release
|
2023-02-06 10:43:24 +00:00
|
|
|
DISTRO="${ID}"
|
|
|
|
fi
|
|
|
|
|
2021-12-07 13:23:57 +00:00
|
|
|
if ! id -u nimbus > /dev/null 2>&1; then
|
|
|
|
case $DISTRO in
|
2023-02-06 10:43:24 +00:00
|
|
|
Ubuntu|ubuntu|Debian|debian)
|
2022-08-17 10:26:31 +00:00
|
|
|
# Debian uses `adduser` to create user...
|
2021-12-07 13:23:57 +00:00
|
|
|
adduser --system --no-create-home --group nimbus
|
|
|
|
;;
|
2022-08-17 10:26:31 +00:00
|
|
|
*)
|
|
|
|
# ... while `useradd` is more standard
|
|
|
|
useradd --system --no-create-home --user-group nimbus
|
2021-12-07 13:23:57 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p /var/lib/nimbus
|
|
|
|
chown nimbus:nimbus /var/lib/nimbus
|
|
|
|
|
2023-02-06 10:01:57 +00:00
|
|
|
# Systems like docker containers do not have systemd.
|
|
|
|
systemctl daemon-reload || echo "notice: systemd daemon not reloaded" >&2
|