From 5bbd0366f3caa6281fbafb49882a226453371b6a Mon Sep 17 00:00:00 2001 From: Antoine Martin (ayakael) Date: Wed, 10 Aug 2022 00:57:30 +0000 Subject: [PATCH 1/1] fix-runtme-id General fix for RID normalisation in testing suite --- runtime-id | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/runtime-id b/runtime-id index 5673bba..7369776 100755 --- a/runtime-id +++ b/runtime-id @@ -44,12 +44,15 @@ if [[ ${portable_rid} == 1 ]]; then echo "linux-${arch}" fi else - case "${ID}" in - # Remove the minor version - alpine|ol|rhel|rocky) rid_version=${VERSION_ID%.*} ;; - - *) rid_version=${VERSION_ID} ;; - esac - - echo "${ID}.${rid_version}-${arch}" + VERSION_ID_DOT="${VERSION_ID//[^.]}" + while [[ ${#VERSION_ID_DOT} -gt 1 ]]; do + VERSION_ID="${VERSION_ID%.*}" + VERSION_ID_DOT="${VERSION_ID//[^.]}" + done + VERSION_ID_DASH="${VERSION_ID//[^_]}" + while [[ ${#VERSION_ID_DASH} -ge 1 ]]; do + VERSION_ID="${VERSION_ID%_*}" + VERSION_ID_DASH="${VERSION_ID//[^_]}" + done + echo "${ID}.${VERSION_ID}-${arch}" fi -- 2.37.1