blob: 8d2fbe1de14c81c2261bae49e0f053ae52ec636e [file] [log] [blame]
#! /bin/sh
# preinst script for nginx
set -e
addnginxuser() {
# creating nginx group if he isn't already there
if ! getent group nginx >/dev/null; then
addgroup --system nginx >/dev/null
fi
# creating nginx user if he isn't already there
if ! getent passwd nginx >/dev/null; then
adduser \
--system \
--disabled-login \
--ingroup nginx \
--no-create-home \
--home /nonexistent \
--gecos "nginx user" \
--shell /bin/false \
nginx >/dev/null
fi
}
case "$1" in
install)
addnginxuser
cat <<BANNER
----------------------------------------------------------------------
Thanks for using nginx!
Please find the official documentation for nginx here:
* http://nginx.org/en/docs/
Commercial subscriptions for nginx are available on:
* http://nginx.com/products/
----------------------------------------------------------------------
BANNER
;;
upgrade)
addnginxuser
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 0
;;
esac
#DEBHELPER#
exit 0