[Libguestfs] [PATCH v2] appliance: use ID_LIKE as a fallback for SUSE distro detection

Cédric Bosdonnat cbosdonnat at suse.com
Fri Sep 1 09:25:17 UTC 2017


All SUSE distros have a ID_LIKE=suse, including the fake one used
for building that has a ID=Dummy value. Without reading ID_LIKE
on SUSE distros, the generated appliance packagelist is not correct.

This fix reads ID_LIKE as a fallback if ID contains nothing.
---
 m4/guestfs_appliance.m4 | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/m4/guestfs_appliance.m4 b/m4/guestfs_appliance.m4
index fbba3373f..788afbd36 100644
--- a/m4/guestfs_appliance.m4
+++ b/m4/guestfs_appliance.m4
@@ -99,8 +99,16 @@ if test -f /etc/os-release; then
     DISTRO="`. /etc/os-release && echo $ID | tr '@<:@:lower:@:>@' '@<:@:upper:@:>@'`"
     AS_CASE([$DISTRO],
             [FEDORA | RHEL | CENTOS],[DISTRO=REDHAT],
-            [OPENSUSE | SLED | SLES],[DISTRO=SUSE],
+            [OPENSUSE | SLED | SLES | SUSE],[DISTRO=SUSE],
             [ARCH],[DISTRO=ARCHLINUX])
+    dnl All SUSE-based distros have ID_LIKE containing 'suse', check for it if
+    dnl ID wasn't helpful.
+    if test -z "$DISTRO"; then
+        DISTRO_LIKE="`. /etc/os-release && echo $ID_LIKE`"
+        if echo $DISTRO_LIKE | tr " " "\n" | grep -i "^SUSE$"; then
+            DISTRO=SUSE
+        fi
+    fi
 elif test -f /etc/debian_version; then
     DISTRO=DEBIAN
     if grep -q 'DISTRIB_ID=Ubuntu' /etc/lsb-release 2>&AS_MESSAGE_LOG_FD; then
-- 
2.13.2




More information about the Libguestfs mailing list