From 39c6fee693cf4829c3a976055f0053318d1f133e Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 22 Aug 2011 11:50:44 +0000 Subject: [PATCH] add isSELINUX routine git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10335 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Utils.pm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 7d7e08196..0b833ea87 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -6604,5 +6604,37 @@ sub runcmd_S } +#------------------------------------------------------------------------------- + +=head3 isSELINUX + Returns: + returns 0 if SELINUX is enabled + returns 1 if SELINUX is not enabled + Globals: + none + Error: + none + Example: + if (xCAT::Utils->isSELINUX()) { blah; } + Comments: + This is tested on Redhat, may need more for SLES +=cut + +#------------------------------------------------------------------------------- +sub isSELINUX +{ + if (-e "/usr/sbin/selinuxenabled") { + `/usr/sbin/selinuxenabled`; + if ($? == 0) { + return 0; + } else { + return 1; + } + } else { + return 1; + } +} + +#------------------------------------------------------------------------------- 1;