libguestfs/0015-build-Pick-first-field...

43 lines
1.5 KiB
Diff

From ad24b9f4d6950dd681e65ea9d1de334119ec9ec7 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 26 May 2022 14:02:58 +0100
Subject: [PATCH] build: Pick first field in ID_LIKE
CentOS Stream has:
ID_LIKE="rhel fedora"
which confused the existing script. If there are multiple "likes"
arbitrarily pick the first one in the list.
Fixes: commit 63b722b6c094f3a35a5e72f0ae3236a58ddda110
(cherry picked from commit 7afbf5ee4415f6fa2553898d3af238e794062096)
---
m4/guestfs-appliance.m4 | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/m4/guestfs-appliance.m4 b/m4/guestfs-appliance.m4
index 4e63ef435..19db4fc7e 100644
--- a/m4/guestfs-appliance.m4
+++ b/m4/guestfs-appliance.m4
@@ -106,11 +106,11 @@ AC_ARG_WITH([distro],
cat /etc/os-release >&AS_MESSAGE_LOG_FD
DISTRO="$(
. /etc/os-release
- if test -n "$ID_LIKE"; then
- echo $ID_LIKE | tr '@<:@:lower:@:>@' '@<:@:upper:@:>@'
- else
- echo $ID | tr '@<:@:lower:@:>@' '@<:@:upper:@:>@'
- fi
+ ( if test -n "$ID_LIKE"; then
+ echo $ID_LIKE | $AWK '{print $1}'
+ else
+ echo $ID
+ fi ) | tr '@<:@:lower:@:>@' '@<:@:upper:@:>@'
)"
AS_CASE([$DISTRO],
[FEDORA | RHEL | CENTOS | ALMALINUX | CLOUDLINUX | ROCKY],
--
2.31.1