wip/version

This commit is contained in:
Marc Beninca 2024-05-04 13:35:35 +02:00
parent 1e0ddbe940
commit 0b9cae5ceb
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

11
cd.sh
View file

@ -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
}