aboutsummaryrefslogtreecommitdiffstats
path: root/misc/dnetc/pkg-deinstall
blob: a575f5a3887938155028bafc69198b4a568fba74 (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
#!/bin/sh

if [ "$2" != "POST-DEINSTALL" ]; then
    exit 0
fi

CLIENTUSER=%%CLIENTUSER%%
CLIENTGROUP=%%CLIENTGROUP%%

if /usr/sbin/pw usershow "$CLIENTUSER" 2>/dev/null 1>&2; then
        if /usr/sbin/pw userdel -n $CLIENTUSER; then
                echo "=> Removed user \"$CLIENTUSER\"."
        else
                echo "=> Removing user \"$CLIENTUSER\" failed..."
                exit 1
        fi
fi

if /usr/sbin/pw groupshow "$CLIENTGROUP" 2>/dev/null 1>&2; then
    if /usr/sbin/pw groupdel -n $CLIENTGROUP; then
        echo "=> Removed group \"$CLIENTGROUP\"."
    else
                echo "=> Removing group \"$CLIENTGROUP\" failed..."
                exit 1
        fi
fi

exit 0