xref: /unit/pkg/deb/debian/unit.postinst (revision 1753:7d8644d56ed5)
1373Sdefan@nginx.com#!/bin/sh
2373Sdefan@nginx.com
3373Sdefan@nginx.comset -e
4373Sdefan@nginx.com
5373Sdefan@nginx.comif [ "$1" != "configure" ]; then
6373Sdefan@nginx.com    exit 0
7373Sdefan@nginx.comfi
8373Sdefan@nginx.com
9*1753Sdefan@nginx.comif [ -n "$2" ]; then
10*1753Sdefan@nginx.com    if dpkg --compare-versions "${2%%-*}" le "1.21.0"; then
11*1753Sdefan@nginx.com      cat <<BANNER
12*1753Sdefan@nginx.com----------------------------------------------------------------------
13*1753Sdefan@nginx.com
14*1753Sdefan@nginx.comWARNING:
15*1753Sdefan@nginx.com
16*1753Sdefan@nginx.comSince version 1.22.0, Unit's non-privileged processes run as unit:unit by
17*1753Sdefan@nginx.comdefault.  Review your system permissions and Unit configuration so apps and
18*1753Sdefan@nginx.comroutes that relied on these processes running as nobody:nogroup stay working.
19*1753Sdefan@nginx.com
20*1753Sdefan@nginx.comMore info: https://unit.nginx.org/installation/#official-packages
21*1753Sdefan@nginx.com
22*1753Sdefan@nginx.com----------------------------------------------------------------------
23*1753Sdefan@nginx.comBANNER
24*1753Sdefan@nginx.com    fi
25*1753Sdefan@nginx.comfi
26*1753Sdefan@nginx.com
27*1753Sdefan@nginx.comif ! getent group unit >/dev/null; then
28*1753Sdefan@nginx.com    addgroup --system unit >/dev/null
29*1753Sdefan@nginx.comfi
30*1753Sdefan@nginx.com
31*1753Sdefan@nginx.comif ! getent passwd unit >/dev/null; then
32*1753Sdefan@nginx.com    adduser \
33*1753Sdefan@nginx.com      --system \
34*1753Sdefan@nginx.com      --disabled-login \
35*1753Sdefan@nginx.com      --ingroup unit \
36*1753Sdefan@nginx.com      --no-create-home \
37*1753Sdefan@nginx.com      --home /nonexistent \
38*1753Sdefan@nginx.com      --gecos "unit user" \
39*1753Sdefan@nginx.com      --shell /bin/false \
40*1753Sdefan@nginx.com      unit >/dev/null
41*1753Sdefan@nginx.comfi
42*1753Sdefan@nginx.com
43373Sdefan@nginx.com#DEBHELPER#
44373Sdefan@nginx.com
45373Sdefan@nginx.comexit 0
46