feat: add curl installer with checksum verification#114
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a curl-pipeable installer script for macOS/Linux that downloads cloudstic from GitHub Releases and verifies SHA256 checksums by default, plus documents this installation path in user-facing docs.
Changes:
- Introduce
scripts/install.shto detect OS/arch, download release archives, and verify againstchecksums.txt(optional--no-verify). - Document curl-based installation in
docs/user-guide.md. - Add a curl installer snippet to
README.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| scripts/install.sh | New cross-platform (darwin/linux) installer that downloads release assets and verifies checksums. |
| docs/user-guide.md | Adds a dedicated “Curl installer” section to the installation guide. |
| README.md | Adds a quick “Curl installer” option in the main install section. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| exit 1 | ||
| fi | ||
|
|
||
| mkdir -p "$INSTALL_DIR" |
| } | ||
|
|
||
| main() { | ||
| need_cmd curl |
Comment on lines
+116
to
+132
| if [ "$VERSION" = "latest" ]; then | ||
| tag="latest" | ||
| else | ||
| tag="$VERSION" | ||
| fi | ||
|
|
||
| if [ "$tag" = "latest" ]; then | ||
| base_url="https://github.com/$REPO/releases/latest/download" | ||
| version_for_name="$(curl -fsSL "https://api.github.com/repos/$REPO/releases/latest" | awk -F '"' '/tag_name/{gsub(/^v/,"",$4); print $4; exit}')" | ||
| if [ -z "$version_for_name" ]; then | ||
| echo "Error: failed to resolve latest release version." >&2 | ||
| exit 1 | ||
| fi | ||
| else | ||
| base_url="https://github.com/$REPO/releases/download/$tag" | ||
| version_for_name="${tag#v}" | ||
| fi |
Comment on lines
+115
to
+116
| The installer verifies release checksums by default. | ||
|
|
Comment on lines
+102
to
+113
| ### Curl installer (macOS / Linux) | ||
|
|
||
| ```bash | ||
| # Install latest | ||
| curl -fsSL https://raw.githubusercontent.com/Cloudstic/cli/main/scripts/install.sh | sh | ||
|
|
||
| # Install a specific version | ||
| curl -fsSL https://raw.githubusercontent.com/Cloudstic/cli/main/scripts/install.sh | sh -s -- --version v1.2.3 | ||
|
|
||
| # Install to a user-writable directory | ||
| curl -fsSL https://raw.githubusercontent.com/Cloudstic/cli/main/scripts/install.sh | sh -s -- --install-dir "$HOME/.local/bin" | ||
| ``` |
Comment on lines
+171
to
+175
| if cp "$tmpdir/$BIN_NAME" "$target" 2>/dev/null; then | ||
| chmod +x "$target" | ||
| else | ||
| echo "Permission denied writing to $INSTALL_DIR." >&2 | ||
| echo "Try running with sudo or choose a user-writable directory:" >&2 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/install.shinstaller for macOS/Linux that auto-detects platform, downloads release archives, and installscloudstic.checksums.txtby default, with optional--no-verifyescape hatch.README.mdanddocs/user-guide.md.Usage
Validation
sh -n scripts/install.sh./scripts/install.sh --help