Make sure selinuxenabled exists before executing it
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
0c7f83dd1f
commit
488216f57b
1 changed files with 1 additions and 1 deletions
|
@ -22,7 +22,7 @@ RUNC_PATH=$(command -v runc || true)
|
||||||
RUNC_BINARY=${RUNC_PATH:-/usr/local/sbin/runc}
|
RUNC_BINARY=${RUNC_PATH:-/usr/local/sbin/runc}
|
||||||
|
|
||||||
TESTDIR=$(mktemp -d)
|
TESTDIR=$(mktemp -d)
|
||||||
if selinuxenabled; then
|
if [ -e /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
|
||||||
. /etc/selinux/config
|
. /etc/selinux/config
|
||||||
filelabel=$(awk -F'"' '/^file.*=.*/ {print $2}' /etc/selinux/${SELINUXTYPE}/contexts/lxc_contexts)
|
filelabel=$(awk -F'"' '/^file.*=.*/ {print $2}' /etc/selinux/${SELINUXTYPE}/contexts/lxc_contexts)
|
||||||
chcon -R ${filelabel} $TESTDIR
|
chcon -R ${filelabel} $TESTDIR
|
||||||
|
|
Loading…
Reference in a new issue