summaryrefslogtreecommitdiff
path: root/link/pi.sh
diff options
context:
space:
mode:
Diffstat (limited to 'link/pi.sh')
-rwxr-xr-xlink/pi.sh33
1 files changed, 32 insertions, 1 deletions
diff --git a/link/pi.sh b/link/pi.sh
index 0fde248..5aec48f 100755
--- a/link/pi.sh
+++ b/link/pi.sh
@@ -1,6 +1,7 @@
#!/bin/bash
-# pi's settings.json, generated. Dry run by default; pass `yes` to apply.
+# pi's extensions directory, and its settings.json and models.json, generated.
+# Dry run by default; pass `yes` to apply.
set -euo pipefail
@@ -40,6 +41,36 @@ then
exit 0
fi
+# pi's extensions: a real directory, with this repo's tracked extensions linked
+# in one by one, so an extension only one machine has -- herdr's pi integration
+# writes herdr-agent-state.ts here -- sits beside them instead of landing in this
+# checkout. pi loads every *.ts and *.js there and follows links, and it skips a
+# dangling one silently (resource-loader.js, pi 1.0.0), so the link left behind
+# by an extension deleted from the repo does no harm.
+#
+# Machines used to link the whole directory to the repo. That link goes first:
+# linking into it would write through to the repo and turn its files into links
+# to themselves. Tracked files only, so nothing a machine left in the repo's
+# directory is linked back in.
+pi_extensions="$pi_dir/extensions"
+if [[ -L "$pi_extensions" ]]
+then
+ if [[ -n "${is_dry_run}" ]]
+ then
+ yellow "$pi_extensions is a link to the repo; will become a directory of links to its tracked files"
+ else
+ rm "$pi_extensions"
+ fi
+fi
+if [[ ! -L "$pi_extensions" ]]
+then
+ [[ -n "${is_dry_run}" ]] || mkdir -p "$pi_extensions"
+ while IFS= read -r -d '' f
+ do
+ link "$dotfiles_dir/$f" "$pi_extensions/$(basename "$f")"
+ done < <(git -C "$dotfiles_dir" ls-files -z -- config/pi/extensions)
+fi
+
pi_status="$(DRY_RUN="$is_dry_run" python3 "$dotfiles_dir/link/pi-settings.py" \
"$config_dir/pi/settings.json" \
"$xdg_config_dir/pi/settings.d" \