#!/bin/sh
. ./defs || exit 1

# Skip the test if we can't find getcap
PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
getcap 2>/dev/null
res=$?
test "$res" -le 1 || exit 77

mkdir $tmp
touch $tmp/foo
# fakeroot mangles spaces unless the getopt utility is the GNU version
echo "setcap cap_net_raw+ep $tmp/foo; getcap $tmp/foo" >$tmp/sh
run_fakeroot -- \
  ${posixshell} $tmp/sh >$tmp/out
cat $tmp/out
grep "^$tmp/foo =\? \?cap_net_raw[+=]ep" $tmp/out
