Created
May 19, 2024 04:00
-
-
Save asheliahut/ecc31cf933bebe7b47ffe1ffc28e1dcd to your computer and use it in GitHub Desktop.
Installs brioche package manager for a specific architecture
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
| #!/bin/bash | |
| install_brioche() { | |
| local base_url="https://development-content.brioche.dev/github.com/brioche-dev/brioche/branches/main" | |
| local target_dir="$HOME/.local/bin" | |
| local target_file="$target_dir/brioche" | |
| mkdir -p "$target_dir" | |
| # Detect architecture | |
| local arch=$(uname -m) | |
| local platform=$(uname -s) | |
| case "$platform" in | |
| Linux) | |
| case "$arch" in | |
| x86_64) | |
| url="$base_url/x86_64-linux/brioche" | |
| ;; | |
| aarch64) | |
| # url="$base_url/arm64-linux/brioche" | |
| echo "Unsupported architecture: $arch on Linux." | |
| return 1 | |
| ;; | |
| *) | |
| echo "Unsupported architecture: $arch on Linux." | |
| return 1 | |
| ;; | |
| esac | |
| ;; | |
| Darwin) | |
| case "$arch" in | |
| x86_64) | |
| # url="$base_url/x86_64-macos/brioche" | |
| echo "Unsupported architecture: $arch on Linux." | |
| return 1 | |
| ;; | |
| arm64) | |
| # url="$base_url/arm64-macos/brioche" | |
| echo "Unsupported architecture: $arch on Linux." | |
| return 1 | |
| ;; | |
| *) | |
| echo "Unsupported architecture: $arch on macOS." | |
| return 1 | |
| ;; | |
| esac | |
| ;; | |
| *) | |
| echo "Unsupported platform: $platform." | |
| return 1 | |
| ;; | |
| esac | |
| # Download and install | |
| if curl -o "$target_file" -L "$url"; then | |
| chmod +x "$target_file" | |
| echo "Brioche installed successfully in $target_dir." | |
| else | |
| echo "Failed to download Brioche from $url." | |
| return 1 | |
| fi | |
| } | |
| # To use the function, simply call it | |
| install_brioche |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment