misc small fixes
[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 # note on an ubuntu 16.04 system, these caps were set without this script
8 # running. I wonder if it is actually needed on a debian 8 system.
9
10 set -e
11
12 if [ ! -x $target/sbin/setcap ] ; then
13 exit 0
14 fi
15
16 for FILE in /bin/ping /bin/ping6 /usr/bin/fping /usr/bin/fping6; do
17 if [ -x $target/$FILE ] ; then
18 if $ROOTCMD /sbin/setcap cap_net_raw+ep $FILE; then
19 echo "Setcap worked! $FILE is not suid!"
20 fi
21 fi
22 done
23 if [ -x $target/usr/bin/systemd-detect-virt ] ; then
24 $ROOTCMD /sbin/setcap cap_dac_override,cap_sys_ptrace+ep /usr/bin/systemd-detect-virt
25 fi