File: spread.postinst

package info (click to toggle)
spread 3.17.4-2
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 1,800 kB
  • ctags: 2,322
  • sloc: ansic: 15,666; sh: 2,611; java: 2,291; perl: 556; yacc: 523; makefile: 255; lex: 204; xml: 77
file content (45 lines) | stat: -rw-r--r-- 1,638 bytes parent folder | download | duplicates (2)
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
#! /bin/sh -e

if [ "$1" = "configure" ]; then
    addgroup --system spread || {
        # addgroup failed. Why?
        if ! getent group spread >/dev/null ; then
            echo "Could not create system group spread." >&2
            if getent group spread >/dev/null ; then
	            echo "Non-system group spread found. I will not overwrite a non-system" >&2
	            echo "user.  Remove the group and reinstall spread." >&2
	        fi
            exit 1
        fi
        # well, the group is there, so just ignore the error
    }
    adduser --system --ingroup spread --home /var/run/spread \
            --gecos "Spread system user" --shell /bin/sh \
            --disabled-password spread || {
        echo "Could not create system user spread." >&2
        # adduser failed. Why?
        if getent passwd spread >/dev/null ; then
            echo "Non-system user spread found. I will not overwrite a non-system" >&2
            echo "user.  Remove the user and reinstall spread." >&2
            exit 1
        fi
        # unknown adduser error, simply exit
        exit 1
    }
    
    # Add overrides
    if ! dpkg-statoverride --list /etc/spread >/dev/null; then
        dpkg-statoverride --update --add spread spread 755 \
            /etc/spread
    fi
    if ! dpkg-statoverride --list /etc/spread/spread.conf >/dev/null; then
        dpkg-statoverride --update --add spread spread 644 \
            /etc/spread/spread.conf
    fi
    if ! dpkg-statoverride --list /var/run/spread >/dev/null; then
        dpkg-statoverride --update --add spread spread 755 \
            /var/run/spread
    fi
fi

#DEBHELPER#