URL: https://github.com/freeipa/freeipa/pull/5516
Author: tiran
 Title: #5516: configure: ipaplatform falls back to ID_LIKE
Action: opened

PR body:
"""
The auto-detection code for IPAPLATFORM now falls back to ID_LIKE.

CentOS platform will now be treated as rhel-like, Ubuntu platforms as
debian-like automatically.

Fixes: https://pagure.io/freeipa/issue/8689
Signed-off-by: Christian Heimes <chei...@redhat.com>
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/5516/head:pr5516
git checkout pr5516
From 3134276ebf6953a30c1b831476a0b8155cfcdbfd Mon Sep 17 00:00:00 2001
From: Christian Heimes <chei...@redhat.com>
Date: Wed, 3 Feb 2021 09:19:12 +0100
Subject: [PATCH] configure: ipaplatform falls back to ID_LIKE

The auto-detection code for IPAPLATFORM now falls back to ID_LIKE.

CentOS platform will now be treated as rhel-like, Ubuntu platforms as
debian-like automatically.

Fixes: https://pagure.io/freeipa/issue/8689
Signed-off-by: Christian Heimes <chei...@redhat.com>
---
 configure.ac | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 325079fcfe2..640fbb5e818 100644
--- a/configure.ac
+++ b/configure.ac
@@ -341,19 +341,33 @@ AC_ARG_WITH([ipaplatform],
 	    [IPAPLATFORM=""])
 AC_MSG_CHECKING([supported IPA platform])
 
-if test "x${IPAPLATFORM}" == "x"; then
+if test "x${IPAPLATFORM}" != "x"; then
+	if test ! -d "${srcdir}/ipaplatform/${IPAPLATFORM}"; then
+		AC_MSG_ERROR([IPA platform ${IPAPLATFORM} is not supported])
+	fi
+else
+	dnl auto-detect, read ID and ID_LIKE from /etc/os-release
 	if test -r "/etc/os-release"; then
-		IPAPLATFORM=$(. /etc/os-release; echo "$ID")
+		platform_ids=$(source /etc/os-release; echo "$ID $ID_LIKE")
 	else
 		AC_MSG_ERROR([unable to read /etc/os-release])
 	fi
-	if test "x${IPAPLATFORM}" == "x"; then
+	if test "x${platform_ids}" == "x"; then
 		AC_MSG_ERROR([unable to find ID variable in /etc/os-release])
 	fi
-fi
 
-if test ! -d "${srcdir}/ipaplatform/${IPAPLATFORM}"; then
-	AC_MSG_ERROR([IPA platform ${IPAPLATFORM} is not supported])
+	dnl find first available platform from ID and ID_LIKE
+	for platform in ${platform_ids}; do
+		if test -d "${srcdir}/ipaplatform/${platform}"; then
+			IPAPLATFORM=${platform}
+			break
+		fi
+	done
+
+	dnl Did we find a supported platform?
+	if test "x${IPAPLATFORM}" == "x"; then
+		AC_MSG_ERROR([IPA platforms ${platform_ids} are not supported])
+	fi
 fi
 
 AC_SUBST([IPAPLATFORM])
@@ -642,6 +656,7 @@ echo "
                     ========================
 
         vendor version:           ${VERSION}${VENDOR_SUFFIX}
+        ipaplatform:              ipaplatform.${IPAPLATFORM}
         prefix:                   ${prefix}
         exec_prefix:              ${exec_prefix}
         libdir:                   ${libdir}
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/freeipa-devel@lists.fedorahosted.org

Reply via email to