Merge pull request #154 from rhatdan/selinux

Make sure selinuxenabled exists before executing it
This commit is contained in:
Antonio Murdaca 2016-10-17 17:24:38 +02:00 committed by GitHub
commit 63614ff690

View file

@ -22,7 +22,7 @@ RUNC_PATH=$(command -v runc || true)
RUNC_BINARY=${RUNC_PATH:-/usr/local/sbin/runc}
TESTDIR=$(mktemp -d)
if selinuxenabled; then
if [ -e /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
. /etc/selinux/config
filelabel=$(awk -F'"' '/^file.*=.*/ {print $2}' /etc/selinux/${SELINUXTYPE}/contexts/lxc_contexts)
chcon -R ${filelabel} $TESTDIR