Skip to content

feat(cli): add update command to self-upgrade from GitHub releases#438

Merged
Ehco1996 merged 1 commit into
masterfrom
feat/update-cmd
May 1, 2026
Merged

feat(cli): add update command to self-upgrade from GitHub releases#438
Ehco1996 merged 1 commit into
masterfrom
feat/update-cmd

Conversation

@Ehco1996
Copy link
Copy Markdown
Owner

@Ehco1996 Ehco1996 commented May 1, 2026

Summary

  • New `ehco update` subcommand that pulls the latest release from GitHub, replaces the running binary in place, and restarts the systemd unit.
  • Uses `rename(2)` over the running ELF (safe on linux: kernel keeps the old inode mmapped for the running service while new invocations resolve to the new file), so the swap is atomic.
  • Flags: `--force` reinstalls the same version, `--no-restart` skips `systemctl restart` for ops who want to schedule the bounce themselves.
  • Linux-only by design (matches `ehco_linux_` assets produced by goreleaser; surfaces a clear error on other OSes).

How to Verify

  • `make build && ./dist/ehco update --help` — flags render.
  • `./dist/ehco update` on the same version → "already up to date".
  • `./dist/ehco update --force` on darwin → fails fast with the OS guard message (full download path only runs on linux).
  • On a linux box with the systemd unit installed: `sudo ehco update` should fetch, swap the binary, and `systemctl restart ehco.service`.

🤖 Generated with Claude Code

Fetches the latest release from the Ehco1996/ehco repo, downloads the
matching linux asset next to the current binary, atomically renames it
over the running ELF (safe via rename(2) on linux), and restarts the
ehco systemd unit. Supports --force and --no-restart flags.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Ehco1996 Ehco1996 merged commit b3473a5 into master May 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant