6e63c92dade3f4cf0c054698eb1bf25c25247d71
[automated-distro-installer] / fai / config / scripts / DEBIAN / 20-capabilities
1 #!/bin/bash
2 #
3 # Capabilities get lost when creating the fai base.tar.xz image.
4 # Restore them here.
5 #
6
7 set -e
8
9 if [ ! -x $target/sbin/setcap ] ; then
10 exit 0
11 fi
12
13 for FILE in /bin/ping /bin/ping6 /usr/bin/fping /usr/bin/fping6; do
14 if [ -x $target/$FILE ] ; then
15 if $ROOTCMD /sbin/setcap cap_net_raw+ep $FILE; then
16 echo "Setcap worked! $FILE is not suid!"
17 fi
18 fi
19 done
20 if [ -x $target/usr/bin/systemd-detect-virt ] ; then
21 $ROOTCMD /sbin/setcap cap_dac_override,cap_sys_ptrace+ep /usr/bin/systemd-detect-virt
22 fi