Make running_in_container work in more containers
Instead of grepping for 'lxc' in /proc/1/cgroup, use systemd's
features. This now at least also works in LXD containers.
Change-Id: I35e807c26f0b1fbba83ddbe04cfb4901a7a95cbe
diff --git a/functions b/functions
index 1aa7517..4435f2d 100644
--- a/functions
+++ b/functions
@@ -666,7 +666,7 @@
# running_in_container - Returns true otherwise false
function running_in_container {
- if grep -q lxc /proc/1/cgroup; then
+ if [[ $(systemd-detect-virt --container) == 'none' ]]; then
return 0
fi