about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-04 18:41:22 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-04 18:51:32 +0200
commit45d41c233e951c993745e3d11a0410202a64fed8 (patch)
treedc3c4f4677edcfe60a6bb65b35040d54c4b40ac9
parentfix(common/init): Ignore the init script itself, when looking for leftover `%... (diff)
downloadflake-templates-45d41c233e951c993745e3d11a0410202a64fed8.tar.gz
flake-templates-45d41c233e951c993745e3d11a0410202a64fed8.zip
fix(common/init): Correctly handle quoted values in the `replacement_file`
-rw-r--r--common/init5
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"