| Sergey Budnevitch | fbfb387 | 2014-06-18 09:53:43 +0000 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | # preinst script for nginx |
| 3 | |
| 4 | set -e |
| 5 | |
| 6 | addnginxuser() { |
| 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 | |
| 26 | case "$1" in |
| 27 | install) |
| 28 | addnginxuser |
| 29 | cat <<BANNER |
| 30 | ---------------------------------------------------------------------- |
| 31 | |
| 32 | Thanks for using nginx! |
| 33 | |
| 34 | Please find the official documentation for nginx here: |
| 35 | * http://nginx.org/en/docs/ |
| 36 | |
| 37 | Commercial subscriptions for nginx are available on: |
| 38 | * http://nginx.com/products/ |
| 39 | |
| 40 | ---------------------------------------------------------------------- |
| 41 | BANNER |
| 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 | ;; |
| 54 | esac |
| 55 | |
| 56 | #DEBHELPER# |
| 57 | |
| 58 | exit 0 |