From ac6e348c052820fafd569549622246b4d238a231 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 29 Jan 2023 09:41:46 -0700 Subject: hstow: use globs in .hstow-always-adopt & convert to EREs for awk --- bin/hstow | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'bin/hstow') diff --git a/bin/hstow b/bin/hstow index c7f783ed..b54b9c94 100755 --- a/bin/hstow +++ b/bin/hstow @@ -77,12 +77,6 @@ readlinks () { rm "$fields_temp" "$targets_temp" } -disjoin_file () { - while read -r line; do - [ -n "$line" ] && printf "|$2" "$line" - done <"$DIR/$1" | sed 's#^.##; s#/#\\/#g' -} - globs_to_find_args () { local file="$DIR/$1"; shift printf '%s\n' "$@" | cat - $([ -e "$file" ] && echo "$file") \ @@ -135,13 +129,14 @@ stow1 () { elif ! [ -e .hstow-always-adopt ]; then adoptp=0 else - # EREs matching files that (i) always/often have their symlinks + # Globs matching files that (i) always/often have their symlinks # replaced with regular files when applications access them; and # (ii) we don't ever want to edit the copy under $DIR directly, # but only via the link/copy under $HOME. - # We might list globs in this file & convert them to EREs here. - adoptp="$(printf 'rel ~ /^(%s)/' \ - "$(disjoin_file .hstow-always-adopt "%s")")" + adoptp="$(printf \ + 'rel ~ /%s/' \ + "$(awk -f ~/src/dotfiles/lib-src/globs2ere.awk \ + .hstow-always-adopt)")" fi find . $(globs_to_find_args .hstow-local-ignore ".git/*") \ ! -name . ! -type d ! -name "$cchars" ! -name .gitignore \ -- cgit v1.2.3