-
Notifications
You must be signed in to change notification settings - Fork 0
docs: standardize install order for tccutil-rs #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9cf7459
docs: standardize install order in README
glitch418x 34b38b5
docs: standardize install flow with release installer script
glitch418x 4274486
docs: use script-first direct install command
glitch418x 12117e8
docs: use main branch for remote install script URL
glitch418x faff743
docs: make install options concise and script-backed
glitch418x 2b00f98
chore: remove duplicate root install script
glitch418x File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| #!/bin/sh | ||
| set -eu | ||
|
|
||
| REPO="uinaf/tccutil" | ||
| BINARY_NAME="tccutil-rs" | ||
| INSTALL_PATH="/usr/local/bin/${BINARY_NAME}" | ||
|
|
||
| usage() { | ||
| cat <<'USAGE' | ||
| Install tccutil-rs from GitHub Releases. | ||
|
|
||
| Usage: | ||
| scripts/install.sh [VERSION] | ||
|
|
||
| Examples: | ||
| scripts/install.sh # install latest release | ||
| scripts/install.sh v0.1.1 # install a specific release | ||
|
|
||
| Notes: | ||
| - macOS only | ||
| - installs to /usr/local/bin/tccutil-rs | ||
| USAGE | ||
| } | ||
|
|
||
| error() { | ||
| printf 'error: %s\n' "$1" >&2 | ||
| exit 1 | ||
| } | ||
|
|
||
| if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then | ||
| usage | ||
| exit 0 | ||
| fi | ||
|
|
||
| if [ "$(uname -s)" != "Darwin" ]; then | ||
| error "tccutil-rs is macOS-only" | ||
| fi | ||
|
|
||
| arch="$(uname -m)" | ||
| case "$arch" in | ||
| arm64) platform="darwin-arm64" ;; | ||
| x86_64) platform="darwin-amd64" ;; | ||
| *) error "unsupported architecture: $arch" ;; | ||
| esac | ||
|
|
||
| command -v curl >/dev/null 2>&1 || error "curl is required" | ||
| command -v shasum >/dev/null 2>&1 || error "shasum is required" | ||
| command -v tar >/dev/null 2>&1 || error "tar is required" | ||
|
|
||
| version_arg="${1:-}" | ||
| if [ -z "$version_arg" ]; then | ||
| version="$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n1)" | ||
| [ -n "$version" ] || error "failed to resolve latest release version" | ||
| else | ||
| case "$version_arg" in | ||
| v*) version="$version_arg" ;; | ||
| *) version="v$version_arg" ;; | ||
| esac | ||
| fi | ||
|
|
||
| asset="${BINARY_NAME}_${version}_${platform}.tar.gz" | ||
| base_url="https://github.com/${REPO}/releases/download/${version}" | ||
| asset_url="${base_url}/${asset}" | ||
| checksums_url="${base_url}/checksums.txt" | ||
|
|
||
| tmp_dir="$(mktemp -d)" | ||
| cleanup() { | ||
| rm -rf "$tmp_dir" | ||
| } | ||
| trap cleanup EXIT INT TERM | ||
|
|
||
| printf 'Installing %s (%s) from %s\n' "$BINARY_NAME" "$platform" "$version" | ||
|
|
||
| curl -fsSL "$asset_url" -o "$tmp_dir/$asset" || error "failed to download asset: $asset_url" | ||
| curl -fsSL "$checksums_url" -o "$tmp_dir/checksums.txt" || error "failed to download checksums: $checksums_url" | ||
|
|
||
| ( | ||
| cd "$tmp_dir" | ||
| grep " ${asset}$" checksums.txt | shasum -a 256 -c - >/dev/null | ||
| ) || error "checksum verification failed" | ||
|
|
||
| ( | ||
| cd "$tmp_dir" | ||
| tar -xzf "$asset" | ||
| ) | ||
|
|
||
| [ -f "$tmp_dir/$BINARY_NAME" ] || error "binary not found in archive" | ||
|
|
||
| install_dir="$(dirname "$INSTALL_PATH")" | ||
| if [ -w "$install_dir" ]; then | ||
| install -m 0755 "$tmp_dir/$BINARY_NAME" "$INSTALL_PATH" | ||
| else | ||
| command -v sudo >/dev/null 2>&1 || error "sudo is required to install to $INSTALL_PATH" | ||
| sudo install -m 0755 "$tmp_dir/$BINARY_NAME" "$INSTALL_PATH" | ||
| fi | ||
|
|
||
| printf 'Installed %s to %s\n' "$BINARY_NAME" "$INSTALL_PATH" | ||
| "$INSTALL_PATH" --version | ||
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.
Uh oh!
There was an error while loading. Please reload this page.