diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-10-04 18:41:22 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-10-04 18:51:32 +0200 |
commit | 45d41c233e951c993745e3d11a0410202a64fed8 (patch) | |
tree | dc3c4f4677edcfe60a6bb65b35040d54c4b40ac9 | |
parent | fix(common/init): Ignore the init script itself, when looking for leftover `%... (diff) | |
download | flake-templates-45d41c233e951c993745e3d11a0410202a64fed8.tar.gz flake-templates-45d41c233e951c993745e3d11a0410202a64fed8.zip |
fix(common/init): Correctly handle quoted values in the `replacement_file`
-rw-r--r-- | common/init | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/common/init b/common/init index 8d8a2d0..d2eb028 100644 --- a/common/init +++ b/common/init @@ -172,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" |