2012-12-29 16:12:05 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NAME="jam-web"
|
|
|
|
|
|
2014-01-11 04:57:07 +00:00
|
|
|
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
|