summaryrefslogtreecommitdiff
path: root/net-im/openfire-devel/pkg-install
blob: b3f53f44b88fd8d1d1ef8611843cab0e49693d5e (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
#!/bin/sh

case $2 in
POST-INSTALL)
        PUSER=openfire
        PGROUP=${PUSER}
        PUID=342
        PGID=${PUID}

        if ! pw group show "${PGROUP}" > /dev/null; then
                if pw groupadd ${PGROUP} -g ${PGID}; then
                        echo "Added group \"${PGROUP}\"."
                else
                        echo "Adding group \"${PGROUP}\" failed..."
                        exit 1
                fi
        fi

        if ! pw user show "${PUSER}" > /dev/null; then
                if pw useradd ${PUSER} -u ${PUID} -g ${PGROUP} -h - \
                        -d /nonexistent -s /sbin/nologin -c "Openfire Daemon"
                then
                        echo "Added user \"${PUSER}\"."
                else
                        echo "Adding user \"${PUSER}\" failed..."
                        exit 1
                fi
        fi
        ;;
esac