File: postinst

package info (click to toggle)
cado 0.9.5-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 276 kB
  • sloc: ansic: 1,459; sh: 54; makefile: 16
file content (54 lines) | stat: -rw-r--r-- 1,453 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash

set -eu

bindir=/usr/bin

if [ "$1" = "configure" ];
then
    # Create user and groups if they don't exist
    if ! getent group _cado > /dev/null 2>&1 && \
        ! getent passwd _cado > /dev/null 2>&1 ; then
        adduser --system \
            --home /nonexistent \
            --no-create-home \
            --quiet \
            --disabled-password \
            --shell /bin/false \
            --force-badname \
            --group _cado
    elif ! getent passwd _cado > /dev/null 2>&1 ; then
        adduser --system \
            --home /nonexistent \
            --no-create-home \
            --quiet \
            --disabled-password \
            --shell /bin/false \
            --force-badname \
            --ingroup _cado _cado
    else
        addgroup --system \
        --quiet \
        --force-badname _cado
        adduser _cado _cado
    fi

    mkdir -p /var/spool/cado
    if ! dpkg-statoverride --list /var/spool/cado ; then
        chown root:_cado /var/spool/cado
        chmod 4770 /var/spool/cado
    fi
    if ! dpkg-statoverride --list $bindir/scado ; then
        chown :_cado ${bindir}/scado
        chmod g+s ${bindir}/scado
    fi
    if ! dpkg-statoverride --list $bindir/cado ; then
        chown _cado: ${bindir}/cado
        chmod u+s ${bindir}/cado
    fi
    # configure the minimal set of capabilities for cado itself to run
    ${bindir}/cado --setcap > /dev/null 2>&1
fi

#DEBHELPER#
exit 0