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

Pass classes as separate arguments to template_default

To work around problem with passing newlines in variable with awk on
darwin. This fixes #437.
This commit is contained in:
Erik Flodin 2024-11-08 19:51:25 +01:00
parent d74a41b1b4
commit 8e5d4b1578
No known key found for this signature in database
GPG key ID: 420A7C865EE3F85F

7
yadm
View file

@ -369,6 +369,10 @@ function template_default() {
# all versions of awk seem to support the POSIX character classes [[:blank:]] # all versions of awk seem to support the POSIX character classes [[:blank:]]
read -r -d '' awk_pgm << "EOF" read -r -d '' awk_pgm << "EOF"
BEGIN { BEGIN {
classes = ARGV[2]
for (i = 3; i < ARGC; ++i) {
classes = classes "\n" ARGV[i]
}
yadm["class"] = class yadm["class"] = class
yadm["classes"] = classes yadm["classes"] = classes
yadm["arch"] = arch yadm["arch"] = arch
@ -485,9 +489,8 @@ EOF
-v distro_family="$local_distro_family" \ -v distro_family="$local_distro_family" \
-v source="$input" \ -v source="$input" \
-v source_dir="$(dirname "$input")" \ -v source_dir="$(dirname "$input")" \
-v classes="$(join_string $'\n' "${local_classes[@]}")" \
"$awk_pgm" \ "$awk_pgm" \
"$input" > "$temp_file" || rm -f "$temp_file" "$input" "${local_classes[@]}" > "$temp_file" || rm -f "$temp_file"
move_file "$input" "$output" "$temp_file" move_file "$input" "$output" "$temp_file"
} }