From facdede4a8bcfdd654a5c36038dc620142b85a54 Mon Sep 17 00:00:00 2001 From: Henrik Triem <henrik.triem@netways.de> Date: Thu, 18 Aug 2022 16:58:23 +0200 Subject: [PATCH] Change deb OS version naming conventions Instead of using the codename, this uses the actual OS name plus the version. --- functions-debian.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/functions-debian.sh b/functions-debian.sh index 07610f6..35780ad 100644 --- a/functions-debian.sh +++ b/functions-debian.sh @@ -30,7 +30,8 @@ detect_os() { detect_dist() { if [ -f /etc/lsb-release ]; then - dist=$(awk -F= '/^DISTRIB_CODENAME=/ {print $2}' /etc/lsb-release) + dist=$(awk -F= '/^DISTRIB_ID=/ {print tolower($2)}' /etc/lsb-release) + dist+=$(awk -F= '/^DISTRIB_RELEASE=/ {print $2}' /etc/lsb-release | sed 's/[^0-9]//g') if [ -z "$dist" ]; then echo "Could not detect dist (DISTRIB_CODENAME) from /etc/lsb-release" >&2 @@ -39,7 +40,8 @@ detect_dist() { echo "$dist" elif grep -q VERSION /etc/os-release; then - dist=$(awk -F"[)(]+" '/^VERSION=/ {print $2}' /etc/os-release) + dist=$(awk -F= '/^ID=/ {print $2}' /etc/os-release) + dist+=$(awk -F= '/^VERSION_ID=/ {print $2}' /etc/os-release | sed 's/[^0-9]//g') if [ -z "$dist" ]; then echo "Could not detect dist (VERSION name) from /etc/os-release" >&2 -- GitLab