Hi!
> > There are systems without selinux support that does not have this
> > command available. You should check if setenforce and getenforce is
> > present on the system first, then you can try to set the selinux to
> > permissive.
> Hmm, how about these two ways, which one is better?
> 1.
> if [ -x "/usr/sbin/getenforce" -a -x "/usr/sbin/setenforce" ]; then
>        SELINUX=`getenforce`
> else
>        SELINUX=""
> fi
> 
> 2.
> COMMAND=$(command -v "getenforce" "setenforce" |wc -l)
> if [ $COMMAND -eq 2 ]; then
>       SELINUX=$(getenforce)
> else
>       SELINUX=""
> fi

Both looks reasonably fine. The second may be a slightly better because
it does not expect the commands to live under /usr/sbin/, which may not
change, but it's more robust this way.

-- 
Cyril Hrubis
chru...@suse.cz

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to