From 8e5d4b1578d4a93d45972575a10daa49d4f07eea Mon Sep 17 00:00:00 2001 From: Erik Flodin Date: Fri, 8 Nov 2024 19:51:25 +0100 Subject: [PATCH] Pass classes as separate arguments to template_default To work around problem with passing newlines in variable with awk on darwin. This fixes #437. --- yadm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/yadm b/yadm index 9dc9240..2afbe65 100755 --- a/yadm +++ b/yadm @@ -369,6 +369,10 @@ function template_default() { # all versions of awk seem to support the POSIX character classes [[:blank:]] read -r -d '' awk_pgm << "EOF" BEGIN { + classes = ARGV[2] + for (i = 3; i < ARGC; ++i) { + classes = classes "\n" ARGV[i] + } yadm["class"] = class yadm["classes"] = classes yadm["arch"] = arch @@ -485,9 +489,8 @@ EOF -v distro_family="$local_distro_family" \ -v source="$input" \ -v source_dir="$(dirname "$input")" \ - -v classes="$(join_string $'\n' "${local_classes[@]}")" \ "$awk_pgm" \ - "$input" > "$temp_file" || rm -f "$temp_file" + "$input" "${local_classes[@]}" > "$temp_file" || rm -f "$temp_file" move_file "$input" "$output" "$temp_file" }