jam-cloud/web/script/package/pre-install.sh

37 lines
673 B
Bash
Raw Permalink Normal View History

2012-12-29 16:12:05 +00:00
#!/bin/sh
NAME="jam-web"
set -eu
HOME="/var/lib/$NAME"
USER="$NAME"
GROUP="$NAME"
# if NIS is used, then errors can occur but be non-fatal
if which ypwhich >/dev/null 2>&1 && ypwhich >/dev/null 2>&1
then
set +e
fi
if ! getent group "$GROUP" >/dev/null
then
addgroup --system "$GROUP" >/dev/null
fi
# creating user if it isn't already there
if ! getent passwd "$USER" >/dev/null
then
adduser \
--system \
--home $HOME \
--shell /bin/false \
--disabled-login \
--ingroup "$GROUP" \
--gecos "$USER" \
"$USER" >/dev/null
fi
# NIS no longer a possible problem; stop ignoring errors
2014-01-14 15:47:30 +00:00
set -e