blob: 8d2fbe1de14c81c2261bae49e0f053ae52ec636e [file] [log] [blame]
Sergey Budnevitchfbfb3872014-06-18 09:53:43 +00001#! /bin/sh
2# preinst script for nginx
3
4set -e
5
6addnginxuser() {
7 # creating nginx group if he isn't already there
8 if ! getent group nginx >/dev/null; then
9 addgroup --system nginx >/dev/null
10 fi
11
12 # creating nginx user if he isn't already there
13 if ! getent passwd nginx >/dev/null; then
14 adduser \
15 --system \
16 --disabled-login \
17 --ingroup nginx \
18 --no-create-home \
19 --home /nonexistent \
20 --gecos "nginx user" \
21 --shell /bin/false \
22 nginx >/dev/null
23 fi
24}
25
26case "$1" in
27 install)
28 addnginxuser
29 cat <<BANNER
30----------------------------------------------------------------------
31
32Thanks for using nginx!
33
34Please find the official documentation for nginx here:
35* http://nginx.org/en/docs/
36
37Commercial subscriptions for nginx are available on:
38* http://nginx.com/products/
39
40----------------------------------------------------------------------
41BANNER
42 ;;
43 upgrade)
44 addnginxuser
45 ;;
46
47 abort-upgrade)
48 ;;
49
50 *)
51 echo "preinst called with unknown argument \`$1'" >&2
52 exit 0
53 ;;
54esac
55
56#DEBHELPER#
57
58exit 0