From a72c566da8eaf53d9ce232772405a9ec1474d1fa Mon Sep 17 00:00:00 2001 From: Eric Renfro Date: Tue, 30 May 2023 16:50:47 -0400 Subject: [PATCH] Fixed issue #455-lowercasing checks on both sides - More POSIX friendly 2 --- yadm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/yadm b/yadm index fca257e..faa4080 100755 --- a/yadm +++ b/yadm @@ -204,7 +204,7 @@ function score_file() { return fi elif [[ "$label" =~ ^(d|distro)$ ]]; then - value="$(echo $value | tr '[:upper:]' '[:lower:]')" + value=$(echo "$value" | "${AWK_PROGRAM[0]}" '{print tolower($0)}') if [ "${value/\ /_}" = "${local_distro/\ /_}" ]; then score=$((score + 4)) else @@ -212,7 +212,7 @@ function score_file() { return fi elif [[ "$label" =~ ^(f|distro_family)$ ]]; then - value="$(echo $value | tr '[:upper:]' '[:lower:]')" + value=$(echo "$value" | "${AWK_PROGRAM[0]}" '{print tolower($0)}') if [ "${value/\ /_}" = "${local_distro_family/\ /_}" ]; then score=$((score + 8)) else @@ -1524,7 +1524,7 @@ function query_distro() { fi done < "$OS_RELEASE" fi - echo "$distro" | tr '[:upper:]' '[:lower:]' + echo "$distro" | "${AWK_PROGRAM[0]}" '{print tolower($0)}' } function query_distro_family() { @@ -1535,10 +1535,13 @@ function query_distro_family() { family="${line#ID_LIKE=}" family="${family//\"}" break + elif [[ -z "$family" && "$line" = ID=* ]]; then + family="${line#ID=}" + family="${family//\"}" fi done < "$OS_RELEASE" fi - echo "$family" | tr '[:upper:]' '[:lower:]' + echo "$distro" | "${AWK_PROGRAM[0]}" '{print tolower($0)}' } function process_global_args() {