[lxc-devel] [PATCH] oracle template: fix chcon warning when selinux disabled
Stéphane Graber
stgraber at ubuntu.com
Fri Dec 6 20:35:23 UTC 2013
On Fri, Dec 06, 2013 at 09:46:19AM -0500, Dwight Engen wrote:
> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
Acked-by: Stéphane Graber <stgraber at ubuntu.com>
> ---
> templates/lxc-oracle.in | 13 +++++++++++--
> 1 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/templates/lxc-oracle.in b/templates/lxc-oracle.in
> index 67e46ab..1338f34 100644
> --- a/templates/lxc-oracle.in
> +++ b/templates/lxc-oracle.in
> @@ -46,6 +46,15 @@ is_btrfs_subvolume()
> return 1
> }
>
> +can_chcon()
> +{
> + if which chcon >/dev/null 2>&1; then
> + selinuxenabled >/dev/null 2>&1
> + return $?
> + fi
> + return 1
> +}
> +
> # fix up the container_rootfs
> container_rootfs_configure()
> {
> @@ -312,7 +321,7 @@ EOF
> if [ $container_rootfs != "/" -a -d $dev_path ]; then
> rm -rf $dev_path
> mkdir -p $dev_path
> - if which chcon >/dev/null 2>&1 ; then
> + if can_chcon; then
> # ensure symlinks created in /dev have the right context
> chcon -t device_t $dev_path
> fi
> @@ -333,7 +342,7 @@ EOF
> mknod -m 600 $dev_path/initctl p
>
> # set selinux labels same as host
> - if which chcon >/dev/null 2>&1 ; then
> + if can_chcon; then
> for node in null zero random urandom pts shm \
> tty tty0 tty1 tty2 tty3 tty4 full ;
> do
> --
> 1.7.1
>
>
> ------------------------------------------------------------------------------
> Sponsored by Intel(R) XDK
> Develop, test and display web and hybrid apps with a single code base.
> Download it for free now!
> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel
--
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20131206/ed9d2891/attachment.pgp>
More information about the lxc-devel
mailing list