diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-10-04 18:42:32 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-10-04 18:51:33 +0200 |
commit | 034f615e05915cb59f62bd3a53273cf210e669d7 (patch) | |
tree | 25a7d9e95fb30485ac95b32351c4fa0470a07d20 | |
parent | fix(common/init): Correctly handle quoted values in the `replacement_file` (diff) | |
download | flake-templates-034f615e05915cb59f62bd3a53273cf210e669d7.tar.gz flake-templates-034f615e05915cb59f62bd3a53273cf210e669d7.zip |
chore(build): Regenerate
Diffstat (limited to '')
-rw-r--r-- | build/awk/init | 14 | ||||
-rw-r--r-- | build/c/init | 14 | ||||
-rw-r--r-- | build/latex/academia/init | 14 | ||||
-rw-r--r-- | build/latex/letter/init | 14 | ||||
-rw-r--r-- | build/latex/presentation/init | 14 | ||||
-rw-r--r-- | build/rust/init | 14 | ||||
-rw-r--r-- | build/shell/init | 14 |
7 files changed, 63 insertions, 35 deletions
diff --git a/build/awk/init b/build/awk/init index b645441..d2eb028 100644 --- a/build/awk/init +++ b/build/awk/init @@ -1,7 +1,10 @@ #!/usr/bin/env sh +self_dir="$(realpath "$(dirname "$0")")" +self="$(realpath "$0")" + # shellcheck source=/dev/null -. "$(realpath "$(dirname "$0")")/shell_line_editor.sh" +. "$self_dir/shell_line_editor.sh" replacement_file="$(mktemp)" @@ -169,8 +172,9 @@ rm --recursive ./git_template while read -r var; do var_name="${var%=*}" - var_value="${var#*=\"}" - var_value="${var_value%\"}" + var_value="${var#*=}" + # The `eval` _should_ be safe, as all values are quoted correctly. + var_value="$(eval echo "$var_value")" fd . --hidden --type file --exec sed --in-place "s|%\bINIT_$var_name\b|$var_value|g" @@ -181,9 +185,9 @@ while read -r var; do done done <"$replacement_file" -if [ "$(rg "%INIT_" --files-with-matches | wc -l)" -ne 0 ]; then +if [ "$(rg "%INIT_" --files-with-matches --glob="!/init" | wc -l)" -ne 0 ]; then echo "Following init variables were not replaced. This is a bug." - rg "%INIT_" + rg "%INIT_" --glob="!/init" fi # HACK: Re-add the executable permissions to files, which the nix template has somehow diff --git a/build/c/init b/build/c/init index b645441..d2eb028 100644 --- a/build/c/init +++ b/build/c/init @@ -1,7 +1,10 @@ #!/usr/bin/env sh +self_dir="$(realpath "$(dirname "$0")")" +self="$(realpath "$0")" + # shellcheck source=/dev/null -. "$(realpath "$(dirname "$0")")/shell_line_editor.sh" +. "$self_dir/shell_line_editor.sh" replacement_file="$(mktemp)" @@ -169,8 +172,9 @@ rm --recursive ./git_template while read -r var; do var_name="${var%=*}" - var_value="${var#*=\"}" - var_value="${var_value%\"}" + var_value="${var#*=}" + # The `eval` _should_ be safe, as all values are quoted correctly. + var_value="$(eval echo "$var_value")" fd . --hidden --type file --exec sed --in-place "s|%\bINIT_$var_name\b|$var_value|g" @@ -181,9 +185,9 @@ while read -r var; do done done <"$replacement_file" -if [ "$(rg "%INIT_" --files-with-matches | wc -l)" -ne 0 ]; then +if [ "$(rg "%INIT_" --files-with-matches --glob="!/init" | wc -l)" -ne 0 ]; then echo "Following init variables were not replaced. This is a bug." - rg "%INIT_" + rg "%INIT_" --glob="!/init" fi # HACK: Re-add the executable permissions to files, which the nix template has somehow diff --git a/build/latex/academia/init b/build/latex/academia/init index b645441..d2eb028 100644 --- a/build/latex/academia/init +++ b/build/latex/academia/init @@ -1,7 +1,10 @@ #!/usr/bin/env sh +self_dir="$(realpath "$(dirname "$0")")" +self="$(realpath "$0")" + # shellcheck source=/dev/null -. "$(realpath "$(dirname "$0")")/shell_line_editor.sh" +. "$self_dir/shell_line_editor.sh" replacement_file="$(mktemp)" @@ -169,8 +172,9 @@ rm --recursive ./git_template while read -r var; do var_name="${var%=*}" - var_value="${var#*=\"}" - var_value="${var_value%\"}" + var_value="${var#*=}" + # The `eval` _should_ be safe, as all values are quoted correctly. + var_value="$(eval echo "$var_value")" fd . --hidden --type file --exec sed --in-place "s|%\bINIT_$var_name\b|$var_value|g" @@ -181,9 +185,9 @@ while read -r var; do done done <"$replacement_file" -if [ "$(rg "%INIT_" --files-with-matches | wc -l)" -ne 0 ]; then +if [ "$(rg "%INIT_" --files-with-matches --glob="!/init" | wc -l)" -ne 0 ]; then echo "Following init variables were not replaced. This is a bug." - rg "%INIT_" + rg "%INIT_" --glob="!/init" fi # HACK: Re-add the executable permissions to files, which the nix template has somehow diff --git a/build/latex/letter/init b/build/latex/letter/init index b645441..d2eb028 100644 --- a/build/latex/letter/init +++ b/build/latex/letter/init @@ -1,7 +1,10 @@ #!/usr/bin/env sh +self_dir="$(realpath "$(dirname "$0")")" +self="$(realpath "$0")" + # shellcheck source=/dev/null -. "$(realpath "$(dirname "$0")")/shell_line_editor.sh" +. "$self_dir/shell_line_editor.sh" replacement_file="$(mktemp)" @@ -169,8 +172,9 @@ rm --recursive ./git_template while read -r var; do var_name="${var%=*}" - var_value="${var#*=\"}" - var_value="${var_value%\"}" + var_value="${var#*=}" + # The `eval` _should_ be safe, as all values are quoted correctly. + var_value="$(eval echo "$var_value")" fd . --hidden --type file --exec sed --in-place "s|%\bINIT_$var_name\b|$var_value|g" @@ -181,9 +185,9 @@ while read -r var; do done done <"$replacement_file" -if [ "$(rg "%INIT_" --files-with-matches | wc -l)" -ne 0 ]; then +if [ "$(rg "%INIT_" --files-with-matches --glob="!/init" | wc -l)" -ne 0 ]; then echo "Following init variables were not replaced. This is a bug." - rg "%INIT_" + rg "%INIT_" --glob="!/init" fi # HACK: Re-add the executable permissions to files, which the nix template has somehow diff --git a/build/latex/presentation/init b/build/latex/presentation/init index b645441..d2eb028 100644 --- a/build/latex/presentation/init +++ b/build/latex/presentation/init @@ -1,7 +1,10 @@ #!/usr/bin/env sh +self_dir="$(realpath "$(dirname "$0")")" +self="$(realpath "$0")" + # shellcheck source=/dev/null -. "$(realpath "$(dirname "$0")")/shell_line_editor.sh" +. "$self_dir/shell_line_editor.sh" replacement_file="$(mktemp)" @@ -169,8 +172,9 @@ rm --recursive ./git_template while read -r var; do var_name="${var%=*}" - var_value="${var#*=\"}" - var_value="${var_value%\"}" + var_value="${var#*=}" + # The `eval` _should_ be safe, as all values are quoted correctly. + var_value="$(eval echo "$var_value")" fd . --hidden --type file --exec sed --in-place "s|%\bINIT_$var_name\b|$var_value|g" @@ -181,9 +185,9 @@ while read -r var; do done done <"$replacement_file" -if [ "$(rg "%INIT_" --files-with-matches | wc -l)" -ne 0 ]; then +if [ "$(rg "%INIT_" --files-with-matches --glob="!/init" | wc -l)" -ne 0 ]; then echo "Following init variables were not replaced. This is a bug." - rg "%INIT_" + rg "%INIT_" --glob="!/init" fi # HACK: Re-add the executable permissions to files, which the nix template has somehow diff --git a/build/rust/init b/build/rust/init index b645441..d2eb028 100644 --- a/build/rust/init +++ b/build/rust/init @@ -1,7 +1,10 @@ #!/usr/bin/env sh +self_dir="$(realpath "$(dirname "$0")")" +self="$(realpath "$0")" + # shellcheck source=/dev/null -. "$(realpath "$(dirname "$0")")/shell_line_editor.sh" +. "$self_dir/shell_line_editor.sh" replacement_file="$(mktemp)" @@ -169,8 +172,9 @@ rm --recursive ./git_template while read -r var; do var_name="${var%=*}" - var_value="${var#*=\"}" - var_value="${var_value%\"}" + var_value="${var#*=}" + # The `eval` _should_ be safe, as all values are quoted correctly. + var_value="$(eval echo "$var_value")" fd . --hidden --type file --exec sed --in-place "s|%\bINIT_$var_name\b|$var_value|g" @@ -181,9 +185,9 @@ while read -r var; do done done <"$replacement_file" -if [ "$(rg "%INIT_" --files-with-matches | wc -l)" -ne 0 ]; then +if [ "$(rg "%INIT_" --files-with-matches --glob="!/init" | wc -l)" -ne 0 ]; then echo "Following init variables were not replaced. This is a bug." - rg "%INIT_" + rg "%INIT_" --glob="!/init" fi # HACK: Re-add the executable permissions to files, which the nix template has somehow diff --git a/build/shell/init b/build/shell/init index b645441..d2eb028 100644 --- a/build/shell/init +++ b/build/shell/init @@ -1,7 +1,10 @@ #!/usr/bin/env sh +self_dir="$(realpath "$(dirname "$0")")" +self="$(realpath "$0")" + # shellcheck source=/dev/null -. "$(realpath "$(dirname "$0")")/shell_line_editor.sh" +. "$self_dir/shell_line_editor.sh" replacement_file="$(mktemp)" @@ -169,8 +172,9 @@ rm --recursive ./git_template while read -r var; do var_name="${var%=*}" - var_value="${var#*=\"}" - var_value="${var_value%\"}" + var_value="${var#*=}" + # The `eval` _should_ be safe, as all values are quoted correctly. + var_value="$(eval echo "$var_value")" fd . --hidden --type file --exec sed --in-place "s|%\bINIT_$var_name\b|$var_value|g" @@ -181,9 +185,9 @@ while read -r var; do done done <"$replacement_file" -if [ "$(rg "%INIT_" --files-with-matches | wc -l)" -ne 0 ]; then +if [ "$(rg "%INIT_" --files-with-matches --glob="!/init" | wc -l)" -ne 0 ]; then echo "Following init variables were not replaced. This is a bug." - rg "%INIT_" + rg "%INIT_" --glob="!/init" fi # HACK: Re-add the executable permissions to files, which the nix template has somehow |