Blame SOURCES/0002-Move-docker-and-podman-tests-up-add-comments.patch

4244f0
From 57966df6adddbebc4f4a6b9db7680d99344b0b1c Mon Sep 17 00:00:00 2001
4244f0
From: "Richard W.M. Jones" <rjones@redhat.com>
4244f0
Date: Thu, 22 Dec 2022 10:34:03 +0000
4244f0
Subject: [PATCH] Move docker and podman tests up, add comments
4244f0
4244f0
Refactor to bring related tests closer together and make the comments
4244f0
more uniform.
4244f0
---
4244f0
 virt-what.in | 31 +++++++++++++++----------------
4244f0
 1 file changed, 15 insertions(+), 16 deletions(-)
4244f0
4244f0
diff --git a/virt-what.in b/virt-what.in
4244f0
index 170bc24ab..c6e4a1e00 100644
4244f0
--- a/virt-what.in
4244f0
+++ b/virt-what.in
4244f0
@@ -165,7 +165,6 @@ fi
4244f0
 # /proc/vz - always exists if OpenVZ kernel is running (inside and outside
4244f0
 # container)
4244f0
 # /proc/bc - exists on node, but not inside container.
4244f0
-
4244f0
 if [ -d "${root}/proc/vz" -a ! -d "${root}/proc/bc" ]; then
4244f0
     echo openvz
4244f0
 fi
4244f0
@@ -173,13 +172,13 @@ fi
4244f0
 # Check for LXC containers
4244f0
 # http://www.freedesktop.org/wiki/Software/systemd/ContainerInterface
4244f0
 # Added by Marc Fournier
4244f0
-
4244f0
 if [ -e "${root}/proc/1/environ" ] &&
4244f0
     tr '\000' '\n' < "${root}/proc/1/environ" |
4244f0
         grep -Eiq '^container=lxc'; then
4244f0
     echo lxc
4244f0
 fi
4244f0
 
4244f0
+# Check for Illumos LX
4244f0
 if [ -e "${root}/proc/1/environ" ] &&
4244f0
     tr '\0' '\n' < "${root}/proc/1/environ" | grep -q '^container=zone$' &&
4244f0
     [ -e "${root}/proc/version" ] &&
4244f0
@@ -187,6 +186,20 @@ if [ -e "${root}/proc/1/environ" ] &&
4244f0
     echo illumos-lx
4244f0
 fi
4244f0
 
4244f0
+# Check for Docker.
4244f0
+if [ -f "${root}/.dockerenv" ] || [ -f "${root}/.dockerinit" ] || \
4244f0
+   grep -qF /docker/ "${root}/proc/self/cgroup" 2>/dev/null; then
4244f0
+    echo docker
4244f0
+fi
4244f0
+
4244f0
+# Check for Podman.
4244f0
+if [ -e "${root}/proc/1/environ" ] &&
4244f0
+    cat "${root}/proc/1/environ" | tr '\000' '\n' | grep -Eiq '^container=podman'; then
4244f0
+    echo podman
4244f0
+elif grep -qF /libpod- "${root}/proc/self/cgroup" 2>/dev/null; then
4244f0
+    echo podman
4244f0
+fi
4244f0
+
4244f0
 # Check for Linux-VServer
4244f0
 if test -e "${root}/proc/self/status" \
4244f0
    && cat "${root}/proc/self/status" | grep -q "VxID: [0-9]*"; then
4244f0
@@ -381,20 +394,6 @@ if ! "$skip_lkvm"; then
4244f0
     fi
4244f0
 fi
4244f0
 
4244f0
-# Check for Docker.
4244f0
-if [ -f "${root}/.dockerenv" ] || [ -f "${root}/.dockerinit" ] || \
4244f0
-   grep -qF /docker/ "${root}/proc/self/cgroup" 2>/dev/null; then
4244f0
-    echo docker
4244f0
-fi
4244f0
-
4244f0
-# Check for Podman.
4244f0
-if [ -e "${root}/proc/1/environ" ] &&
4244f0
-    cat "${root}/proc/1/environ" | tr '\000' '\n' | grep -Eiq '^container=podman'; then
4244f0
-    echo podman
4244f0
-elif grep -qF /libpod- "${root}/proc/self/cgroup" 2>/dev/null; then
4244f0
-    echo podman
4244f0
-fi
4244f0
-
4244f0
 # Check ppc64 lpar, kvm or powerkvm
4244f0
 
4244f0
 # example /proc/cpuinfo line indicating 'not baremetal'
4244f0
-- 
4244f0
2.31.1
4244f0