summaryrefslogtreecommitdiffstats
path: root/debian/tcpdump.postinst
diff options
context:
space:
mode:
Diffstat (limited to 'debian/tcpdump.postinst')
-rwxr-xr-xdebian/tcpdump.postinst26
1 files changed, 26 insertions, 0 deletions
diff --git a/debian/tcpdump.postinst b/debian/tcpdump.postinst
new file mode 100755
index 0000000..a9d1909
--- /dev/null
+++ b/debian/tcpdump.postinst
@@ -0,0 +1,26 @@
+#!/bin/sh -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#