Add a script which will handle OS/distribution detection. The initial version of the script is very basic, handling only different RHEL versions, but it is easily expanded as needed. Signed-off-by: Paul Moore <pmoore@xxxxxxxxxx> --- 0 files changed diff --git a/tests/Makefile b/tests/Makefile index 7c27787..e9d4646 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,19 +1,18 @@ -RHEL_VER=$(shell cat /etc/redhat-release) -RHEL_VER_PREFIX=Red Hat Enterprise Linux Server release +DISTRO=$(shell ./os_detect) 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 ($(RHEL_VER_PREFIX)4, $(findstring $(RHEL_VER_PREFIX)4, $(RHEL_VER))) +ifeq ($(DISTRO),RHEL4) SUBDIRS:=$(SUBDIRS_COMMON) endif -ifeq ($(RHEL_VER_PREFIX)5, $(findstring $(RHEL_VER_PREFIX)5, $(RHEL_VER))) +ifeq ($(DISTRO),RHEL5) SUBDIRS:=$(SUBDIRS_COMMON) dyntrace dyntrans endif -ifeq ($(RHEL_VER_PREFIX)6, $(findstring $(RHEL_VER_PREFIX)6, $(RHEL_VER))) +ifeq ($(DISTRO),RHEL6) SUBDIRS:=$(SUBDIRS_COMMON) dyntrace dyntrans bounds endif diff --git a/tests/os_detect b/tests/os_detect new file mode 100755 index 0000000..cddcb85 --- /dev/null +++ b/tests/os_detect @@ -0,0 +1,9 @@ +#!/bin/bash + +if [[ -r /etc/redhat-release ]]; then + ver=$(cat /etc/redhat-release | sed -ne '/^Red Hat Enterprise Linux/p') + if [[ -n $ver ]]; then + echo "$ver" | \ + sed -e 's/Red Hat Enterprise Linux[ \ta-zA-Z]*\([0-9]\+\).*/RHEL\1/' + fi +fi _______________________________________________ Selinux mailing list Selinux@xxxxxxxxxxxxx To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx. To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.