diff --git a/functions-debian.sh b/functions-debian.sh index 07610f609f3b332cb039ed402e8b98433d2479ac..35780adb4cc9325fe7ce8bf44a3f1085c4c44364 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