Configure the guest init based on whether the PID 1 process is systemd
or not.

In the template for Fedora, currently the guest is configured based on
whether the /bin/systemd exists in the host or not. This doesn't work
correctly because the /usr/bin/systemd symlink has been removed from the
systemd package in Fedora 20 (Rawhide) and Arch Linux.

Signed-off-by: Satoshi Matsumoto <kaorim...@gmail.com>
---
I've proposed this patch as a pull request on the github [1], and got a
comment that the original code may not make sense. In
configure_fedora_systemd() and configure_fedora_init(), we are
configuring the guest init not the host init, so it seems to be correct
to configure the guest init based on whether the guest is based on
systemd or not. In that case, I think the code should look like this:

if [ $release -gt 14 ]; then
  configure_fedora_systemd
else
  configure_fedora_init
fi

[1] https://github.com/lxc/lxc/pull/29

 templates/lxc-fedora.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
index 23728c6..36c3d21 100644
--- a/templates/lxc-fedora.in
+++ b/templates/lxc-fedora.in
@@ -567,7 +567,7 @@ if [ $? -ne 0 ]; then
     exit 1
 fi
 
-type /bin/systemd >/dev/null 2>&1
+test $(ps --no-headers -o comm 1) = 'systemd'
 if [ $? -ne 0 ]; then
     configure_fedora_init
 else
-- 
1.8.3.1


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to