1
0
Fork 0
mirror of synced 2024-12-04 14:45:36 -05:00

Fixed issue #455-lowercasing checks on both sides - More POSIX friendly 2

This commit is contained in:
Eric Renfro 2023-05-30 16:50:47 -04:00
parent 630b677269
commit a72c566da8
Signed by: psi-jack
GPG key ID: 14977F3A50D9A5BF

11
yadm
View file

@ -204,7 +204,7 @@ function score_file() {
return return
fi fi
elif [[ "$label" =~ ^(d|distro)$ ]]; then 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 if [ "${value/\ /_}" = "${local_distro/\ /_}" ]; then
score=$((score + 4)) score=$((score + 4))
else else
@ -212,7 +212,7 @@ function score_file() {
return return
fi fi
elif [[ "$label" =~ ^(f|distro_family)$ ]]; then 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 if [ "${value/\ /_}" = "${local_distro_family/\ /_}" ]; then
score=$((score + 8)) score=$((score + 8))
else else
@ -1524,7 +1524,7 @@ function query_distro() {
fi fi
done < "$OS_RELEASE" done < "$OS_RELEASE"
fi fi
echo "$distro" | tr '[:upper:]' '[:lower:]' echo "$distro" | "${AWK_PROGRAM[0]}" '{print tolower($0)}'
} }
function query_distro_family() { function query_distro_family() {
@ -1535,10 +1535,13 @@ function query_distro_family() {
family="${line#ID_LIKE=}" family="${line#ID_LIKE=}"
family="${family//\"}" family="${family//\"}"
break break
elif [[ -z "$family" && "$line" = ID=* ]]; then
family="${line#ID=}"
family="${family//\"}"
fi fi
done < "$OS_RELEASE" done < "$OS_RELEASE"
fi fi
echo "$family" | tr '[:upper:]' '[:lower:]' echo "$distro" | "${AWK_PROGRAM[0]}" '{print tolower($0)}'
} }
function process_global_args() { function process_global_args() {