summaryrefslogtreecommitdiffstats
path: root/debian/tcpdump.postinst
blob: a3a5f95bc562a91adeb7d31dd8060adba6aed48f (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
#!/bin/sh

set -e

if ! getent group tcpdump >/dev/null 2>&1; then
    addgroup --system --quiet tcpdump
fi
if ! getent passwd tcpdump >/dev/null 2>&1; then
    adduser --system --quiet --ingroup tcpdump		\
	    --no-create-home --home /nonexistent	\
	    tcpdump
fi

# dh_apparmor leaves behind the local profile for the old binary
# location (/usr/sbin/tcpdump), we need to clean it up (#990554).
#
# Only remove it if it's empty, meaning that the system doesn't have
# local configuration.
if dpkg --compare-versions "$2" lt-nl "4.99.1-3~"; then
    OLD_LOCAL_APP_PROFILE="/etc/apparmor.d/local/usr.sbin.tcpdump"
    if [ -e "$OLD_LOCAL_APP_PROFILE" ]; then
	if [ ! -s "$OLD_LOCAL_APP_PROFILE" ]; then
	    rm -f "$OLD_LOCAL_APP_PROFILE"
	fi
    fi
fi

#DEBHELPER#