From: Paul Moore <pmoore@redhat.com>
To: selinux@tycho.nsa.gov
Subject: [PATCH 1/4] selinux-testsuite: add improved OS detection
Date: Mon, 09 Feb 2015 18:06:29 -0500 [thread overview]
Message-ID: <20150209230629.2579.64390.stgit@localhost> (raw)
In-Reply-To: <20150209230426.2579.84520.stgit@localhost>
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@redhat.com>
---
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
next prev parent reply other threads:[~2015-02-09 23:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-09 23:06 [PATCH 0/4] Fix the selinux-testsuite for RHEL5,6,7 and Rawhide Paul Moore
2015-02-09 23:06 ` Paul Moore [this message]
2015-02-09 23:06 ` [PATCH 2/4] selinux-testsuite: allow the file test to work with all coreutils versions Paul Moore
2015-02-09 23:06 ` [PATCH 3/4] selinux-testsuite: enable task_setscheduler to work with cgroups Paul Moore
2015-02-09 23:06 ` [PATCH 4/4] selinux-testsuite: allow unconfined_t entrypoint to test_nnp_bounded_exec_t Paul Moore
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150209230629.2579.64390.stgit@localhost \
--to=pmoore@redhat.com \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.