forked from osmocom/wireshark
2d1bf738d7
Failing postinst has been reported several times under LP#1447893 Change-Id: I196f246b34aa3be9d53f02b4e0092c802effc42a Reviewed-on: https://code.wireshark.org/review/11693 Reviewed-by: Balint Reczey <balint@balintreczey.hu>
44 lines
1.6 KiB
Bash
44 lines
1.6 KiB
Bash
#!/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
|
|
echo "Error: $GROUP group does not exist and executing \"addgroup --quiet --system $GROUP\" failed which prevents configuring Wireshark for capturing traffic as an unprivileged user."
|
|
echo "Please create the $GROUP system (or user) group and try configuring wireshark-common again."
|
|
exit 1
|
|
else
|
|
echo "Note: $GROUP is a user group, but the preferred configuration is setting it up as a system group. Purging wireshark-common will not remove the $GROUP group as a result, but otherwise everything should work properly."
|
|
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
|
|
echo "Error: Setting capabilities for dumpcap using Linux Capabilities failed."
|
|
echo "Falling back to setting set-user-id bit."
|
|
chmod u=rwxs,g=rx,o=r $PROGRAM
|
|
fi
|
|
else
|
|
chmod u=rwxs,g=rx,o=r $PROGRAM
|
|
fi
|
|
fi
|
|
fi
|
|
else
|
|
echo "Preserving owner and mode for $PROGRAM set by dpkg-statoverride:"
|
|
dpkg-statoverride --list $PROGRAM
|
|
fi
|
|
|
|
#DEBHELPER#
|