Skip to content

Commit 86fbd1d

Browse files
authored
Merge pull request #71 from sanketsudake/fix-managed-targets
Derive managed $HOME targets from HOME_PACKAGES only
2 parents acc2e2d + 87b66ff commit 86fbd1d

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

scripts/managed-targets.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
#!/usr/bin/env bash
2-
# Print every $HOME-relative path managed by the stow packages, derived from
3-
# packages/ itself so the list can never drift from reality.
2+
# Print every $HOME-relative path managed by the HOME stow packages, derived
3+
# from packages/ itself so the list can never drift from reality. The harness
4+
# packages (claude, pi) are excluded — they stow into the profiles and ~/.pi
5+
# via harness-link, never into $HOME. The package set comes from the
6+
# Makefile's HOME_PACKAGES so the two can't diverge.
47
# Mapping mirrors stow --dotfiles: a leading "dot-" on any path component -> ".".
58
set -euo pipefail
6-
cd "$(dirname "${BASH_SOURCE[0]}")/../packages"
7-
find . -mindepth 2 \( -type f -o -type l \) \
8-
| sed -E 's#^\./[^/]+/##' \
9+
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
10+
home_packages="$(sed -n 's/^HOME_PACKAGES := //p' "$repo_root/Makefile")"
11+
[ -n "$home_packages" ] || { echo "managed-targets: HOME_PACKAGES not found in Makefile" >&2; exit 1; }
12+
cd "$repo_root/packages"
13+
# shellcheck disable=SC2086
14+
find $home_packages -mindepth 1 \( -type f -o -type l \) \
15+
| sed -E 's#^[^/]+/##' \
916
| sed -E 's#(^|/)dot-#\1.#g' \
1017
| sort -u

0 commit comments

Comments
 (0)