summary refs log tree commit diff
diff options
context:
space:
mode:
authorCameron Nemo <camerontnorman@gmail.com>2018-09-28 11:23:01 -0700
committerMichael Aldridge <aldridge.mac@gmail.com>2022-03-29 21:38:01 -0500
commitf1a3950c9728dee890703c0a8a0cbd4328ba8035 (patch)
treed141e0df922fc1c5ba1b3a4e19bad2a4b3675252
parentad47d4f190175a5690f275175f3b3cd4ed35a095 (diff)
downloadrunit-void-20220329.tar.gz
runit-void-20220329.tar.xz
runit-void-20220329.zip
functions/detect_virt: use container env variable 20220329
Fixes #6
-rw-r--r--functions7
1 files changed, 2 insertions, 5 deletions
diff --git a/functions b/functions
index 17850e2..037cd08 100644
--- a/functions
+++ b/functions
@@ -28,11 +28,8 @@ emergency_shell() {
 }
 
 detect_virt() {
-   # Detect LXC containers
-   [ ! -e /proc/self/environ ] && return
-   if grep -q lxc /proc/self/environ >/dev/null; then
-       export VIRTUALIZATION=1
-   fi
+   # Detect LXC (and other) containers
+   [ -z "${container+x}" ] || export VIRTUALIZATION=1
 }
 
 deactivate_vgs() {