From 268e1e138732b7bec8f9b89c624dee75c68a7028 Mon Sep 17 00:00:00 2001 From: "Leandro A. F. Pereira" Date: Sat, 22 Jun 2019 01:52:48 -0700 Subject: [PATCH] Fix generation of RID on distros that do not set VERSION_ID (#25034) Rolling-release distros do not set this variable, leading to invalid RIDs such as "gentoo.-x64", which causes build failures. Omit VERSION_ID (and the period preceding it) when unset, so it's consistent with host and PlatformAbstractions. Fixes #19769. --- init-distro-rid.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/init-distro-rid.sh b/init-distro-rid.sh index dc9bb04e363e..49d8981c4fd6 100755 --- a/init-distro-rid.sh +++ b/init-distro-rid.sh @@ -56,7 +56,13 @@ initNonPortableDistroRid() VERSION_ID=${VERSION_ID%.*} fi - nonPortableBuildID="${ID}.${VERSION_ID}-${buildArch}" + if [ -z ${VERSION_ID+x} ]; then + # Rolling release distros do not set VERSION_ID, so omit + # it here to be consistent with everything else. + nonPortableBuildID="${ID}-${buildArch}" + else + nonPortableBuildID="${ID}.${VERSION_ID}-${buildArch}" + fi fi elif [ -e "${rootfsDir}/etc/redhat-release" ]; then