From 38f0b95ff7d89d51687018d37de106fabc49fdb6 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Mon, 1 Apr 2024 12:46:23 +0200 Subject: refactor(treewide): Add a script to instantiate symlinks --- update_common_files.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 update_common_files.sh (limited to 'update_common_files.sh') diff --git a/update_common_files.sh b/update_common_files.sh new file mode 100755 index 0000000..f342850 --- /dev/null +++ b/update_common_files.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env sh + +ROOT="$(git rev-parse --show-toplevel)"; + +# This results in fd returning relative paths +cd "$ROOT/common" || echo "BUG, no root dir!" + +fd . "." --type file --hidden | while read -r file; do + echo "Instantiating '$file'..." + fd . "../templates" --type directory --max-depth 1 | while read -r template; do + echo " done in '$template'." + echo " " cp "$file" "$template$file" + rm "$template$file" + cp "$file" "$template$file" + done +done + + +# vim: ft=sh -- cgit 1.4.1