diff options
| author | Craig Jennings <c@cjennings.net> | 2026-08-21 02:09:35 -0700 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-08-21 02:09:35 -0700 |
| commit | 7ed8e5701c83c5e26c2416b9a0365c12f801f7ed (patch) | |
| tree | 227e267e2de9d60e013b7d580b71ff6a57e74592 /scripts/cmail-setup-finish.sh | |
| parent | 27d1a2c00c6c4dd918b2dad8585b65b0b4e9eb81 (diff) | |
| download | archsetup-7ed8e5701c83c5e26c2416b9a0365c12f801f7ed.tar.gz archsetup-7ed8e5701c83c5e26c2416b9a0365c12f801f7ed.zip | |
fix(cmail): let Bridge setup finish without cmail-action
I moved the cmail-action install out of cmail-setup-finish.sh and left behind a guard that aborts when the tool is missing. The script mentions cmail-action five times and invokes it zero — every hit is a comment or that check. So a Bridge provisioning script hard-failed over a mail client it never touches, and a fresh machine got Bridge ready, the cert exportable, the service startable, and a script that refused to configure any of it.
It warns with the same remedy and carries on now. That also drops an ordering neither repo needs: Bridge setup no longer requires rulesets cloned and installed first.
The sequence around it hadn't caught up either. Both the checklist and the installer's completion message still opened with "clone claude-templates to ~/projects/claude-templates", the same dead path that broke the script, and neither mentioned rulesets at all. So the documented order was: clone a stale repo to a path that doesn't exist, log into Bridge, then run a script that aborts pointing at a directory nothing created. Both now run Bridge first and name rulesets as what it is — not a prerequisite for those steps, but the thing mbsync wants.
I also rephrased the header claim that the symlink "arrives on its own". True on a machine that runs agent sessions, since session start runs make install, and false on one that doesn't. It states the condition now instead of the consequence.
Diffstat (limited to 'scripts/cmail-setup-finish.sh')
| -rwxr-xr-x | scripts/cmail-setup-finish.sh | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/scripts/cmail-setup-finish.sh b/scripts/cmail-setup-finish.sh index bd72499..8c27eda 100755 --- a/scripts/cmail-setup-finish.sh +++ b/scripts/cmail-setup-finish.sh @@ -7,10 +7,13 @@ # - protonmail-bridge installed (archsetup handles it) # - You have run 'protonmail-bridge --cli', logged in, and quit at least once # (the script looks for state at ~/.config/protonmail/bridge-v3/) -# - cmail-action on PATH (rulesets' `make install` links it; session start -# runs that, so it arrives on its own) # - dotfiles stowed (~/.config/.cmailpass.gpg present) # +# Not a pre-req, but checked and warned about: cmail-action on PATH. rulesets' +# `make install` links it, and session start runs that, so on a machine that +# runs agent sessions it arrives without anyone asking. On one that doesn't, +# it needs the command by hand. The script never invokes it either way. +# # What it does: # 1. Decrypts ~/.config/.cmailpass.gpg → ~/.config/.cmailpass (mode 0600) # 2. Copies Bridge's self-signed cert → ~/.config/protonbridge.pem @@ -28,6 +31,7 @@ set -euo pipefail err() { printf 'error: %s\n' "$*" >&2; exit 1; } +warn() { printf 'warning: %s\n' "$*" >&2; } info() { printf '==> %s\n' "$*"; } ok() { printf ' %s\n' "$*"; } @@ -50,10 +54,18 @@ bridge_state="$HOME/.config/protonmail/bridge-v3" # cmail-action is no longer this script's to install. It lives in rulesets at # claude-templates/bin/, and rulesets' `make install` links everything there -# into ~/.local/bin — which every session start runs, so the symlink reaches -# each machine on its own. Check that it arrived rather than placing it. +# into ~/.local/bin. Session start runs that, so on a machine that runs agent +# sessions the symlink arrives on its own; on one that doesn't, it needs the +# command below. +# +# A warning rather than an abort, because this script never invokes the tool. +# Its job is to leave Bridge working, and it can finish that whether or not a +# mail client has been linked yet. Aborting here would make Bridge setup +# depend on rulesets being cloned and installed first, an ordering neither +# repo otherwise needs, and would strand a fresh machine with Bridge ready and +# the script refusing to configure it. command -v cmail-action >/dev/null 2>&1 \ - || err "cmail-action not on PATH — run 'make -C ~/code/rulesets install'" + || warn "cmail-action not on PATH — run 'make -C ~/code/rulesets install' before sending mail" cmailpass_enc="$HOME/.config/.cmailpass.gpg" [ -f "$cmailpass_enc" ] \ |
