Add detection for LXC + tests
[virt-what.git] / virt-what.in
index 297956d..7cc4853 100644 (file)
@@ -135,6 +135,15 @@ if [ -d $root/proc/vz -a ! -d $root/proc/bc ]; then
     echo openvz
 fi
 
+# Check for LXC containers
+# http://www.freedesktop.org/wiki/Software/systemd/ContainerInterface
+# Added by Marc Fournier
+
+if [ -e $root/proc/1/environ ] &&
+    cat $root/proc/1/environ | tr '\000' '\n' | grep -Eiq '^container='; then
+    echo lxc
+fi
+
 # Check for Linux-VServer
 if cat $root/proc/self/status | grep -q "VxID: [0-9]*"; then
     echo linux_vserver