Skip to content

Commit

Permalink
Fixed issue TheLocehiliosan#455-lowercasing checks on both sides - Mo…
Browse files Browse the repository at this point in the history
…re POSIX friendly 2
  • Loading branch information
erenfro committed May 30, 2023
1 parent 630b677 commit a72c566
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions yadm
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,15 @@ 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
score=0
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
Expand Down Expand Up @@ -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() {
Expand All @@ -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() {
Expand Down

0 comments on commit a72c566

Please sign in to comment.