Skip to content

Commit

Permalink
Pass classes as separate arguments to template_default
Browse files Browse the repository at this point in the history
To work around problem with passing newlines in variable with awk on
darwin. This fixes #437.
  • Loading branch information
erijo committed Nov 8, 2024
1 parent d74a41b commit 8e5d4b1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions yadm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
}
Expand Down

0 comments on commit 8e5d4b1

Please # to comment.