aboutsummaryrefslogtreecommitdiffstats
path: root/audio/pulseaudio/pkg-install
blob: 2c316a5e65144482e76672ea6ce20c7e5e7ab928 (plain) (blame)
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
55
56
57
58
59
60
61
62
63
#!/bin/sh

case $2 in
POST-INSTALL)
    RGROUP=pulse-rt
    SUSER=pulse
    SGROUP=${SUSER}
    AGROUP=pulse-access
    SUID=563
    RGID=557
    SGID=${SUID}
    AGID=564
    PW=/usr/sbin/pw

    if ${PW} group show "${RGROUP}" 2>/dev/null; then
        echo "You already have a group \"${RGROUP}\", so I will use it."
    else
        if ${PW} groupadd ${RGROUP} -g ${RGID}; then
            echo "Added group \"${RGROUP}\"."
        else
            echo "Adding group \"${RGROUP}\" failed..."
            exit 1
        fi
    fi

    if ${PW} group show "${SGROUP}" 2>/dev/null; then
        echo "You already have a group \"${SGROUP}\", so I will use it."
    else
        if ${PW} groupadd ${SGROUP} -g ${SGID}; then
            echo "Added group \"${SGROUP}\"."
        else
            echo "Adding group \"${SGROUP}\" failed..."
            exit 1
        fi
    fi

    if ${PW} group show "${AGROUP}" 2>/dev/null; then
        echo "You already have a group \"${AGROUP}\", so I will use it."
    else
        if ${PW} groupadd ${AGROUP} -g ${AGID}; then
            echo "Added group \"${AGROUP}\"."
        else
            echo "Adding group \"${AGROUP}\" failed..."
            exit 1
        fi
    fi

    if ${PW} user show "${SUSER}" 2>/dev/null; then
        echo "You already have a user \"${SUSER}\", so I will use it."
    else
        if ${PW} useradd ${SUSER} -u ${SUID} -g ${SGROUP} -h - \
        -d "/nonexistent" -s /sbin/nologin -c "PulseAudio System User"
        then
        echo "Added user \"${SUSER}\"."
        else
        echo "Adding user \"${SUSER}\" failed..."
        exit 1
        fi
    fi

    exit 0
    ;;
esac