aboutsummaryrefslogtreecommitdiff
path: root/tmuxrdr/scripts/install
diff options
context:
space:
mode:
Diffstat (limited to 'tmuxrdr/scripts/install')
-rwxr-xr-xtmuxrdr/scripts/install28
1 files changed, 18 insertions, 10 deletions
diff --git a/tmuxrdr/scripts/install b/tmuxrdr/scripts/install
index f4c0f1ea..e125a29e 100755
--- a/tmuxrdr/scripts/install
+++ b/tmuxrdr/scripts/install
@@ -1,27 +1,30 @@
#!/bin/bash
-# Put this machine on tmuxrdr's config and plugin. Dry run by default; pass
-# `yes` to apply -- the same interface as dot's link.sh.
+# Put this machine's tmuxrdr on the checkout's config and plugin. Dry run by
+# default; pass `yes` to apply -- the same interface as dot's link.sh. Only
+# tmuxrdr is touched: stock herdr keeps its own config and plugins in
+# ~/.config/herdr.
#
# ~/.local/share/tmuxrdr/plugin -> <repo>/tmuxrdr/plugin
# the stable path config.toml's popups run from, whatever the checkout
-# is called; registered with `herdr plugin link`
-# ~/.config/herdr/config.toml -> <repo>/tmuxrdr/config/config.toml
+# is called; registered with `tmuxrdr plugin link`
+# ~/.config/tmuxrdr/config.toml -> <repo>/tmuxrdr/config/config.toml
# herdr saves its settings with an in-place write (src/config/write.rs),
# so the link survives and every change lands here, under git. A real
# file already there is kept beside it as config.toml.pre-tmuxrdr.
#
-# Run it again after moving the checkout. Uses whichever herdr is first on
-# PATH, or $HERDR.
+# Run it again after moving the checkout. Needs the tmuxrdr binary
+# (scripts/build), or $HERDR pointing at another tmuxrdr build; it refuses a
+# binary that reads its config from anywhere else, such as stock herdr.
set -euo pipefail
repo="$(cd "$(dirname "$0")/../.." && pwd -P)"
-herdr="${HERDR:-herdr}"
+herdr="${HERDR:-tmuxrdr}"
apply="${1:-}"
plugin_id="tmuxrdr.tmux-mode"
plugin_link="${XDG_DATA_HOME:-$HOME/.local/share}/tmuxrdr/plugin"
-config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/herdr"
+config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/tmuxrdr"
config_link="$config_dir/config.toml"
run() {
@@ -54,7 +57,12 @@ link() {
return 0
}
-command -v "$herdr" >/dev/null || { >&2 echo "ERROR: no $herdr on PATH"; exit 1; }
+command -v "$herdr" >/dev/null || { >&2 echo "ERROR: no $herdr; build it: tmuxrdr/scripts/build"; exit 1; }
+reads="$("$herdr" --help 2>/dev/null | sed -n 's/^Config: *//p')"
+[[ "$reads" == "$config_link" ]] || {
+ >&2 echo "ERROR: $herdr reads its config from ${reads:-?}, not $config_link: not a tmuxrdr build"
+ exit 1
+}
command -v jq >/dev/null || { >&2 echo "ERROR: the plugin needs jq"; exit 1; }
link "$repo/tmuxrdr/plugin" "$plugin_link"
@@ -78,7 +86,7 @@ fi
if [[ "$apply" == "yes" ]]; then
"$herdr" config check
- echo "Running herdr picks this up on prefix+r."
+ echo "A running tmuxrdr picks this up on prefix+r."
else
echo "Execute with: $0 yes"
fi