Skip to content

Commit 6d0a759

Browse files
committed
build: improve the selinux error mgmt
1 parent 72d4dab commit 6d0a759

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

GNUmakefile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,16 @@ TOYBOX_ROOT := $(BASEDIR)/tmp
5757
TOYBOX_VER := 0.8.8
5858
TOYBOX_SRC := $(TOYBOX_ROOT)/toybox-$(TOYBOX_VER)
5959

60-
ifeq ($(SELINUX_ENABLED),)
61-
SELINUX_ENABLED := 0
60+
61+
ifdef SELINUX_ENABLED
62+
override SELINUX_ENABLED := 0
63+
# Now check if we should enable it (only on non-Windows)
6264
ifneq ($(OS),Windows_NT)
63-
ifeq ($(shell /sbin/selinuxenabled 2>/dev/null ; echo $$?),0)
64-
SELINUX_ENABLED := 1
65+
ifeq ($(shell if [ -x /sbin/selinuxenabled ] && /sbin/selinuxenabled 2>/dev/null; then echo 0; else echo 1; fi),0)
66+
override SELINUX_ENABLED := 1
67+
$(info /sbin/selinuxenabled successful)
68+
else
69+
$(info SELINUX_ENABLED=1 but /sbin/selinuxenabled failed)
6570
endif
6671
endif
6772
endif

0 commit comments

Comments
 (0)