diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-10-04 18:40:35 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-10-04 18:51:30 +0200 |
commit | 1c544a116091153e318bded35d840617ca7208f0 (patch) | |
tree | a777caebf53f0f5448f8305045ce99d8043149f9 /c | |
parent | chore(build): Regenerate (diff) | |
download | flake-templates-1c544a116091153e318bded35d840617ca7208f0.tar.gz flake-templates-1c544a116091153e318bded35d840617ca7208f0.zip |
fix(common/init): Ignore the init script itself, when looking for leftover `%INIT_`s
Diffstat (limited to '')
-rw-r--r-- | common/init | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/common/init b/common/init index b645441..8d8a2d0 100644 --- a/common/init +++ b/common/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)" @@ -181,9 +184,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 |