Skip to contentSkip to conversation

selinux-testsuite: fix RHEL detection

PATCH In review Paul Moore 2 participants 3 messages Feb 6, 2015 – Feb 9, 2015 SELinux security module

lore
Share & tools
lore

Paul Moore

author
#0 lore raw

PATCH 1/1 selinux-testsuite: fix RHEL detection

The redhat-release package is not consistently named across RHEL releases, use the /etc/redhat-release instead to detect the RHEL version.

---
 tests/Makefile |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
tests/Makefile +5 -4
index 3838e14..7c27787 100644
@@ -1,18 +1,19 @@
-REDHAT_RELEASE=$(shell rpm -q redhat-release)
+RHEL_VER=$(shell cat /etc/redhat-release)
+RHEL_VER_PREFIX=Red Hat Enterprise Linux Server release 
 
 SUBDIRS_COMMON:=domain_trans entrypoint execshare exectrace execute_no_trans fdreceive inherit link mkdir msg open ptrace readlink relabel rename rxdir sem setattr setnice shm sigkill stat sysctl task_create task_setnice task_setscheduler task_getscheduler task_getsid task_getpgid task_setpgid wait file ioctl capable_file capable_net capable_sys
 
 SUBDIRS:= $(SUBDIRS_COMMON) dyntrans dyntrace bounds nnp
 
-ifeq (redhat-release-4, $(findstring redhat-release-4, $(REDHAT_RELEASE)))
+ifeq ($(RHEL_VER_PREFIX)4, $(findstring $(RHEL_VER_PREFIX)4, $(RHEL_VER)))
     SUBDIRS:=$(SUBDIRS_COMMON)
 endif
 
-ifeq (redhat-release-5, $(findstring redhat-release-5, $(REDHAT_RELEASE)))
+ifeq ($(RHEL_VER_PREFIX)5, $(findstring $(RHEL_VER_PREFIX)5, $(RHEL_VER)))
     SUBDIRS:=$(SUBDIRS_COMMON) dyntrace dyntrans
 endif
 
-ifeq (redhat-release-6, $(findstring redhat-release-6, $(REDHAT_RELEASE)))
+ifeq ($(RHEL_VER_PREFIX)6, $(findstring $(RHEL_VER_PREFIX)6, $(RHEL_VER)))
     SUBDIRS:=$(SUBDIRS_COMMON) dyntrace dyntrans bounds
 endif
 
#1 lore raw

Doesn't RHEL have variants other than Server?

Quoted 43 lines · Paul Moore

The redhat-release package is not consistently named across RHEL releases, use the /etc/redhat-release instead to detect the RHEL version.

---
 tests/Makefile |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
tests/Makefile +5 -4
index 3838e14..7c27787 100644
@@ -1,18 +1,19 @@
-REDHAT_RELEASE=$(shell rpm -q redhat-release)
+RHEL_VER=$(shell cat /etc/redhat-release)
+RHEL_VER_PREFIX=Red Hat Enterprise Linux Server release
 
 SUBDIRS_COMMON:=domain_trans entrypoint execshare exectrace execute_no_trans fdreceive inherit link mkdir msg open ptrace readlink relabel rename rxdir sem setattr setnice shm sigkill stat sysctl task_create task_setnice task_setscheduler task_getscheduler task_getsid task_getpgid task_setpgid wait file ioctl capable_file capable_net capable_sys
 
 SUBDIRS:= $(SUBDIRS_COMMON) dyntrans dyntrace bounds nnp
 
-ifeq (redhat-release-4, $(findstring redhat-release-4, $(REDHAT_RELEASE)))
+ifeq ($(RHEL_VER_PREFIX)4, $(findstring $(RHEL_VER_PREFIX)4, $(RHEL_VER)))
     SUBDIRS:=$(SUBDIRS_COMMON)
 endif
 
-ifeq (redhat-release-5, $(findstring redhat-release-5, $(REDHAT_RELEASE)))
+ifeq ($(RHEL_VER_PREFIX)5, $(findstring $(RHEL_VER_PREFIX)5, $(RHEL_VER)))
     SUBDIRS:=$(SUBDIRS_COMMON) dyntrace dyntrans
 endif
 
-ifeq (redhat-release-6, $(findstring redhat-release-6, $(REDHAT_RELEASE)))
+ifeq ($(RHEL_VER_PREFIX)6, $(findstring $(RHEL_VER_PREFIX)6, $(RHEL_VER)))
     SUBDIRS:=$(SUBDIRS_COMMON) dyntrace dyntrans bounds
 endif
 

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].

author
#2 lore raw
Quoted 1 line · Stephen Smalley

Doesn't RHEL have variants other than Server?

Good point. I'll look into the other variants.

Quoted 62 lines · Paul Moore
Quoted 61 lines

The redhat-release package is not consistently named across RHEL releases, use the /etc/redhat-release instead to detect the RHEL version.

---

 tests/Makefile |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
tests/Makefile +3 -3
index 3838e14..7c27787 100644
@@ -1,18 +1,19 @@
-REDHAT_RELEASE=$(shell rpm -q redhat-release)
+RHEL_VER=$(shell cat /etc/redhat-release)
+RHEL_VER_PREFIX=Red Hat Enterprise Linux Server release
 
 SUBDIRS_COMMON:=domain_trans entrypoint execshare exectrace
 execute_no_trans fdreceive inherit link mkdir msg open ptrace readlink
 relabel rename rxdir sem setattr setnice shm sigkill stat sysctl
 task_create task_setnice task_setscheduler task_getscheduler task_getsid
 task_getpgid task_setpgid wait file ioctl capable_file capable_net
 capable_sys
 
 SUBDIRS:= $(SUBDIRS_COMMON) dyntrans dyntrace bounds nnp
 
-ifeq (redhat-release-4, $(findstring redhat-release-4,
 $(REDHAT_RELEASE)))
+ifeq ($(RHEL_VER_PREFIX)4, $(findstring $(RHEL_VER_PREFIX)4,
 $(RHEL_VER)))
 
     SUBDIRS:=$(SUBDIRS_COMMON)
 
 endif
 
-ifeq (redhat-release-5, $(findstring redhat-release-5,

$(REDHAT_RELEASE)))
+ifeq ($(RHEL_VER_PREFIX)5, $(findstring $(RHEL_VER_PREFIX)5, $(RHEL_VER)))

     SUBDIRS:=$(SUBDIRS_COMMON) dyntrace dyntrans

endif

-ifeq (redhat-release-6, $(findstring redhat-release-6, $(REDHAT_RELEASE)))
+ifeq ($(RHEL_VER_PREFIX)6, $(findstring $(RHEL_VER_PREFIX)6, $(RHEL_VER)))

     SUBDIRS:=$(SUBDIRS_COMMON) dyntrace dyntrans bounds

endif

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected]. To get help, send an email containing "help" to [email protected].

Signature · 2 lines
paul moore
security @ redhat