Skip to content

fix: clearer reinstall message, clean up failed installs, use $SHELL for PATH, check disk space - #39

Merged
eseidel merged 2 commits into
mainfrom
install-fixes
Nov 2, 2026
Merged

eseidel merged 2 commits into
mainfrom
install-fixes

Conversation

@eseidel

@eseidel eseidel commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Why

Four install-script reports, all about a first install going wrong with no clear way forward:

What changes

bash (install.sh) PowerShell (install.ps1)
Failed install (including Ctrl-C) EXIT trap removes the partial ~/.shorebird and says to rerun try/finally (checking $LASTEXITCODE of git and shorebird.ps1) removes it and says to rerun; finally because Ctrl-C skips catch
Already installed Says where. A complete install (has bin/cache/shorebird.snapshot) gets shorebird upgrade plus the reinstall command; an incomplete one (left by the old installer) gets only the reinstall command, curl ... -sSfL https://shorebird.dev/install.sh | bash -s -- --force Same, with Remove-Item "<dir>" then irm ... | iex (iex can't pass --force). Still returns without error, as before: setup-shorebird reruns it on persistent runners and uses the existing install
PATH Picks the rc file from $SHELL: zsh ${ZDOTDIR:-$HOME}/.zshrc, bash .bashrc (on macOS, where Terminal starts bash as a login shell, the first of .bash_profile, .bash_login, .profile that exists, else a new .bash_profile); creates it if missing; skips if the line is already there. Other shells get the manual line, as before unchanged
Disk space Fails up front with under 3GB free (a fresh install, Shorebird + Flutter + Dart SDK, measured at about 2.2GB) Same, via IO.DriveInfo; skipped when the profile isn't on a local drive (UNC)

PowerShell's git checks now throw instead of exit 1. The documented command is irm ... | iex, where exit closes the user's PowerShell window before they can read the error; throw stops the script, leaves the window open, and still exits nonzero under ./install.ps1 in CI.

Standard way: rustup, Homebrew and nvm installers pick the profile from $SHELL and dedupe the line the same way; removing a partial install on failure is the usual alternative to resumable installs, and much simpler since the install is a fresh clone either way.

The new messages use https://shorebird.dev/install.sh / .ps1, which redirect here (https://github.com/shorebirdtech/_shorebird/issues/2832, already closed) and are what the docs show.

Not done: fish ($SHELL = fish still gets the manual instruction; it needs fish syntax, not export).

What could go wrong

  • Disk check false positive on a disk with 2.2-3GB free: the user sees a clear error and must free space. They'd likely hit a full disk on their first build anyway.
  • macOS bash users now get their login profile instead of .bashrc. Previously the .bashrc line didn't take effect in Terminal for them, so this should only fix things.
  • APFS df excludes purgeable space, so a Mac near 3GB free may be refused while Finder shows more; the error says how much is free.
  • A failure after the clone (e.g. Flutter download) now deletes the Shorebird clone too, so the rerun re-clones it (about 150MB).

CI now reruns each installer after the install and checks the already-installed message. Tested locally on macOS: complete and incomplete existing-install messages; the printed reinstall command fetches a script that parses; a failing git clone (fake git) removes the partial dir and exits 128; rc-file selection for zsh/bash/fish/unset and the macOS profile order, file creation and dedupe; df -Pk parse. PowerShell isn't installed here; CI's Windows e2e job runs the success path.

Screenshots

No visible change: shell scripts only.

Landing

Once approved and green.

Fixes #27
Fixes #29
Fixes #31
Fixes shorebirdtech/shorebird#1942

🤖 Generated with Claude Code

…for PATH, check disk space

Fixes #27, #29, #31, shorebirdtech/shorebird#1942.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eseidel

eseidel commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

Adversarial review (separate agent, no context from the author; bash findings verified locally on macOS bash 3.2, PowerShell findings from reading the code and docs)

  1. Blocking install.sh:127: the printed --force command has no -L, and https://shorebird.dev/install.sh is a 302, so bash runs the redirect body: bash: line 1: Redirecting: command not found, exit 127.
  2. Blocking install.sh:119-127, install.ps1:71-82: people hitting shorebird#1942 have a broken ~/.shorebird from the old installer and no PATH entry, so shorebird upgrade is "command not found" and the --force command fails as in 1. Distinguish a working install from a partial one.
  3. Blocking install.sh:16-17,41: creating ~/.bash_profile on macOS stops bash login shells reading ~/.profile/~/.bash_login. Verified: with only .profile present, after install bash -l -c 'echo $FOO' prints nothing. Use the first of .bash_profile, .bash_login, .profile that exists.
  4. Should-fix install.ps1:71: setup-shorebird runs install.ps1 | iex without --force; the old already-installed path returned success, now it throws, so persistent self-hosted Windows runners fail on their second run.
  5. Should-fix install.ps1:98-120: Ctrl-C skips catch (only finally runs), so Windows still leaves the partial install. Do the cleanup in finally behind a completion flag.
  6. Should-fix install.ps1:80: printed Remove-Item path is unquoted; breaks for C:\Users\John Smith\.shorebird.
  7. Should-fix install.ps1:88: IO.DriveInfo throws for UNC roots, aborting the install; bash skips the check when df gives nothing. Skip on failure.
  8. Should-fix install.ps1:112-114: if Remove-Item fails in catch (locked file), its error replaces the real cause.
  9. Nit install.sh:136: APFS df excludes purgeable space; no override. Non-numeric df output gives "integer expression expected".
  10. Nit: size numbers disagree (comments 2.5GB, description 2.2GB, threshold 3GB).
  11. Nit: cleanup message says "Fix the error above" after Ctrl-C, where there's none; throw under iex adds "At line:N char:M" noise.
  12. Nit: throw keeps the window open under irm | iex was never run; no CI covers a failure or rerun path. A rerun step would have caught 1.

Checked and fine: bash EXIT trap with set -e, including failure inside the (cd ... && shorebird --version) subshell, --force + failure, INT/TERM/HUP all clean up, success leaves the install, XDG_CONFIG_HOME in the disk check, $LASTEXITCODE after shorebird.ps1.

- Printed reinstall command follows the shorebird.dev redirect (-L).
- Tell a complete install (upgrade) from an incomplete one (reinstall).
- macOS bash: write to the first of .bash_profile/.bash_login/.profile.
- Windows: already-installed returns without error again (setup-shorebird
  reruns it); quote the printed path; clean up in finally so Ctrl-C is
  covered; skip the disk check off local drives; keep the real error if
  removal fails.
- CI reruns each installer and checks the already-installed message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eseidel

eseidel commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

Addressed in f186c52:

  1. Fixed: the printed command uses -sSfL. Checked: it fetches the script through the redirect and it parses.
  2. Fixed: a complete install (bin/cache/shorebird.snapshot present) gets shorebird upgrade plus the reinstall command. An incomplete one gets "A previous Shorebird install ... is incomplete" and only the reinstall command. Same on Windows.
  3. Fixed: on macOS, bash writes to the first of .bash_profile, .bash_login, .profile that exists, and creates .bash_profile only when none do.
  4. Fixed: already-installed on Windows prints the message and returns without error, as before.
  5. Fixed: cleanup moved to finally behind $installComplete, so Ctrl-C is covered. The original exception still propagates, so the run exits nonzero.
  6. Fixed: the printed path is quoted.
  7. Fixed: DriveInfo failure skips the check.
  8. Fixed: Remove-Item -ErrorAction SilentlyContinue, then Test-Path. If removal fails it says "Delete , then run the installer again", and the real error still surfaces.
  9. Non-numeric df output now skips the check. No override added: the error already says how much is free, and someone that close to 3GB would run out on their first build anyway. The PR description lists this under what could go wrong.
  10. Fixed: comments say "measured about 2.2GB" and the threshold is 3GB for headroom.
  11. Fixed: the message is now "did not finish ... Run the installer again (after fixing any error above)". On Windows it is Write-Host red. Early git and disk errors still throw so CI exits nonzero.
  12. Added CI steps that rerun each installer after the install and check the already-installed message (and, on bash, exit 1). The throw-under-iex behavior wasn't run locally because pwsh isn't installed here.

@eseidel

eseidel commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

lgtm

@eseidel
eseidel enabled auto-merge (squash) November 2, 2026 04:06
@eseidel
eseidel requested a review from easymac November 2, 2026 04:07
@eseidel
eseidel merged commit 240e4cd into main Nov 2, 2026
3 checks passed
@eseidel
eseidel deleted the install-fixes branch November 2, 2026 16:25
@eseidel
eseidel removed the request for review from easymac November 2, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant