diff --git a/test/test_unit_template_default.py b/test/test_unit_template_default.py index aaae0fe..8b0544b 100644 --- a/test/test_unit_template_default.py +++ b/test/test_unit_template_default.py @@ -86,7 +86,7 @@ wrong user 2 {{% if yadm.distro == "wrongdistro1" %}} wrong distro 1 {{% endif %}} -{{% if yadm.distro == "{LOCAL_DISTRO}" %}} +{{% if yadm.distro == "{LOCAL_DISTRO.upper()}" %}} Included section for distro = {{{{yadm.distro}}}} ({{{{yadm.distro}}}} again) {{% endif %}} {{% if yadm.distro == "wrongdistro2" %}} @@ -95,7 +95,7 @@ wrong distro 2 {{% if yadm.distro_family == "wrongfamily1" %}} wrong family 1 {{% endif %}} -{{% if yadm.distro_family == "{LOCAL_DISTRO_FAMILY}" %}} +{{% if yadm.distro_family == "{LOCAL_DISTRO_FAMILY.upper()}" %}} Included section for distro_family = \ {{{{yadm.distro_family}}}} ({{{{yadm.distro_family}}}} again) {{% endif %}} diff --git a/yadm b/yadm index 51ed02e..0d7dd98 100755 --- a/yadm +++ b/yadm @@ -363,6 +363,10 @@ BEGIN { if (rhs == cls_array[idx]) { lhs = rhs; break } } } + else if (lhs == "yadm.distro" || lhs == "yadm.distro_family") { + lhs = tolower(replace_vars("{{" lhs "}}")) + rhs = tolower(rhs) + } else { lhs = replace_vars("{{" lhs "}}") } diff --git a/yadm.1 b/yadm.1 index b430c4f..dcd3bd1 100644 --- a/yadm.1 +++ b/yadm.1 @@ -502,14 +502,14 @@ See the CONFIGURATION section for more details about setting .BR local.class . .TP .BR distro , " d -Valid if the value matches the distro. +Valid if the value matches the distro (ignoring case). Distro is calculated by running .B "lsb_release -si" or by inspecting the ID from .BR "/etc/os-release" . .TP .BR distro_family , " f -Valid if the value matches the distro family. +Valid if the value matches the distro family (ignoring case). Distro family is calculated by inspecting the ID_LIKE line from .BR "/etc/os-release" . .TP