Debian Codegraph @

debian/oping.postinst

raw
1 #!/bin/sh
2
3 set -e
4
5 case "$1" in
6 configure)
7 # If we have setcap installed, try setting cap_net_raw+ep,
8 # which allows us to install our binaries without the setuid
9 # bit.
10 for p in /usr/bin/oping /usr/bin/noping; do
11 PROGRAM=$(dpkg-divert --truename $p)
12 if command -v setcap > /dev/null; then
13 if setcap cap_net_raw+ep $PROGRAM; then
14 chmod u-s $PROGRAM
15 else
16 echo "Setcap failed on $PROGRAM, falling back to setuid" >&2
17 chmod u+s $PROGRAM
18 fi
19 else
20 echo "Setcap is not installed, falling back to setuid" >&2
21 chmod u+s $PROGRAM
22 fi
23 done
24 ;;
25 esac
26
27 #DEBHELPER#