From 0b9cae5ceb57c22cc3fea3abba334a2bf58c8301 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 4 May 2024 13:35:35 +0200 Subject: [PATCH] wip/version --- cd.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cd.sh b/cd.sh index a9abcce..2235040 100644 --- a/cd.sh +++ b/cd.sh @@ -47,7 +47,13 @@ cd_set_environment_variables () { case "$(cd_grep_os ID)" in "almalinux") CD_OS_ID="${CD_OS_ALMA}" - CD_OS_VERSION="$(cd_grep_os VERSION_ID)" + CD_OS_VERSION=$(cd_grep_os VERSION_ID \ + | sed "s|^\([0-9]\+\)\..*|\1|" ) + ;; + "alpine") + CD_OS_ID="${CD_OS_ALPINE}" + CD_OS_VERSION=$(cd_grep_os VERSION_ID \ + | sed "s|^\([0-9]\+\.[0-9]\+\)\..*|\1|" ) ;; "debian") CD_OS_ID="${CD_OS_DEBIAN}" @@ -402,8 +408,7 @@ local variable="${1}" if [ "${variable}" ] ; then grep "^${variable}=" "/etc/os-release" \ | sed "s|^${variable}=||" \ - | sed "s|^\"\(.*\)\"$|\1|" \ - | sed "s|^\([0-9]\+\)\..*|\1|" + | sed "s|^\"\(.*\)\"$|\1|" fi }