aboutsummaryrefslogtreecommitdiffstats
path: root/debian/wireshark-common.postinst
blob: 21d40f57414c34c065cfcd00a7c4284feb59aecc (plain)
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
#!/bin/sh

set -e

. /usr/share/debconf/confmodule
PROGRAM=/usr/bin/dumpcap
GROUP=wireshark

if ! dpkg-statoverride --list $PROGRAM > /dev/null; then
    db_get wireshark-common/install-setuid
    if [ -e "$PROGRAM" ]; then
	if [ "$RET" = "false" ] ; then
	    chown root:root $PROGRAM
	    chmod u=rwx,go=rx $PROGRAM
	else
	    if ! addgroup --quiet --system $GROUP; then
	        if ! getent group wireshark > /dev/null; then
                    db_input high wireshark-common/addgroup-failed || true
                    db_go
                    exit 1
                else
                    db_input high wireshark-common/group-is-user-group || true
                    db_go
                fi
	    fi
	    chown root:$GROUP $PROGRAM
	    if which setcap > /dev/null ; then
                chmod u=rwx,g=rx,o=r $PROGRAM
                if ! setcap cap_net_raw,cap_net_admin=eip $PROGRAM; then
                    db_input high wireshark-common/setcap-failed || true
                    db_go
		    chmod u=rwxs,g=rx,o=r $PROGRAM
                fi
	    else
                chmod u=rwxs,g=rx,o=r $PROGRAM
	    fi
        fi
    fi
else
    dpkg-statoverride --list $PROGRAM
fi

#DEBHELPER#