diff options
| author | Igor Soarez <igor@soarez.org> | 2026-09-21 14:09:58 +0300 |
|---|---|---|
| committer | Igor Soarez <igor@soarez.org> | 2026-09-21 14:09:58 +0300 |
| commit | dec2702337924b9a004acf2afa7574f95d349077 (patch) | |
| tree | 69321537c360da8d739bdade0ecb379f49c13976 /link/lib.sh | |
| parent | fec40208281589b70228802914e98b3b4823924b (diff) | |
link: a part named in ~/.config/dot/skip does nothing on that machine
A machine may need one of the parts left out: on a laptop it does not own,
~/.claude/settings.json is the owner's, holding their environment and plugins,
and linking this account's over it is wrong in both directions -- theirs is
lost, and anything of theirs worth keeping would have to be carried here, in
the repo every machine shares.
The file is hand-written and in no repo, like ~/.localenv, so the exception
stays on the machine that needs it. The check is in link/lib.sh, as each part
starts, rather than in link.sh's loop, so `link/claude.sh yes` obeys it too;
link.sh and other repos' link.sh source that file as well, and sit outside
link/, so their names can never be read as a part's.
Diffstat (limited to 'link/lib.sh')
| -rw-r--r-- | link/lib.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/link/lib.sh b/link/lib.sh index 1899f00..67b358e 100644 --- a/link/lib.sh +++ b/link/lib.sh @@ -120,3 +120,29 @@ xdg_config_dir="${XDG_CONFIG_HOME:-$HOME/.config}" # iCloud Drive, on a Mac signed into it; absent everywhere else. icloud_dir="$HOME/Library/Mobile Documents/com~apple~CloudDocs" + +# Machine-local opt-out: the name of a part, one per line, in +# ~/.config/dot/skip. For a machine where a part would do the wrong thing -- +# one whose ~/.claude/settings.json is its owner's rather than this account's, +# say -- without editing this repo, which every machine shares. Hand-written +# and in no repo, like ~/.localenv. +skip_file="$xdg_config_dir/dot/skip" + +part_skipped() { + # Whole-line match, so a blank or commented line cannot name a part. + [[ -r "$skip_file" ]] && grep -qxF "$1" "$skip_file" +} + +# A part skips itself here rather than in link.sh's loop, so that running one +# on its own (`link/claude.sh yes`) obeys the file too. Parts only: link.sh and +# other repos' link.sh source this as well, and sit outside link/, so their own +# names can never be read as a part's. +if [[ "$(basename "$(dirname "$(realpath "$0")")")" == "link" ]] +then + part_name="$(basename "$0" .sh)" + if part_skipped "$part_name" + then + yellow "link/$part_name.sh skipped by $skip_file" + exit 0 + fi +fi |
