This repository was archived by the owner on Aug 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,95 @@ | ||
| #!/bin/bash | ||
|
|
||
| echo "Downloading Rollkit source code..." | ||
| # Define colors for output | ||
| RED="\033[31m" | ||
| GREEN="\033[32m" | ||
| YELLOW="\033[33m" | ||
| CYAN="\033[36m" | ||
| BOLD="\033[1m" | ||
| RESET="\033[0m" | ||
|
|
||
| # Function to print headers | ||
| print_header() { | ||
| echo -e "${CYAN}${BOLD}--> $1${RESET}" | ||
| } | ||
|
|
||
| # Function to print success messages | ||
| print_success() { | ||
| echo -e "${GREEN}${BOLD}$1${RESET}" | ||
| } | ||
|
|
||
| # Function to print warnings | ||
| print_warning() { | ||
| echo -e "${YELLOW}${BOLD}$1${RESET}" | ||
| } | ||
|
|
||
| # Function to print errors | ||
| print_error() { | ||
| echo -e "${RED}${BOLD}$1${RESET}" | ||
| } | ||
|
|
||
| # Function to compare versions | ||
| compare_versions() { | ||
| if [ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$1" ]; then | ||
| if [ "$1" = "$2" ]; then | ||
| return 0 # Equal | ||
| else | ||
| return 1 # First is less | ||
| fi | ||
| else | ||
| return 2 # First is greater | ||
| fi | ||
| } | ||
|
|
||
| print_header "Downloading Rollkit source code..." | ||
| git clone https://github.com/rollkit/rollkit.git | ||
| echo "" | ||
|
|
||
| cd rollkit || { print_error "Failed to find the downloaded repository."; exit 1; } | ||
|
|
||
| print_header "Extracting Go version from go.mod..." | ||
| go_mod_version=$(grep "^go " go.mod | cut -d' ' -f2) | ||
|
|
||
| if [ -z "$go_mod_version" ]; then | ||
| print_error "Error: Could not find a Go version in go.mod." | ||
| exit 1 | ||
| fi | ||
| formatted_go_version="go${go_mod_version}" | ||
| echo -e " Required Go version: ${BOLD}${formatted_go_version}${RESET}\n" | ||
|
|
||
| print_header "Checking if Go is installed..." | ||
| if ! which go > /dev/null; then | ||
| echo "Go is not installed. Attempting to install Go..." | ||
| curl -sL "https://rollkit.dev/install-go.sh" | sh -s "go1.22.2" | ||
| print_warning "Go is not installed. Attempting to install Go..." | ||
| curl -sL "https://rollkit.dev/install-go.sh" | sh -s "$formatted_go_version" | ||
| fi | ||
|
|
||
| installed_version=$(go version | awk '{print $3}' | sed 's/go//') | ||
| echo -e " Installed Go version: ${BOLD}${installed_version}${RESET}\n" | ||
|
|
||
| print_header "Validating installed Go version..." | ||
| compare_versions "$installed_version" "$go_mod_version" | ||
| comparison_result=$? | ||
|
|
||
| if [ $comparison_result -eq 1 ]; then | ||
| print_error "ERROR: The installed Go version ($installed_version) is less than the required version ($go_mod_version)." | ||
| echo " Please upgrade your version of Go." | ||
| exit 1 | ||
| elif [ $comparison_result -eq 2 ]; then | ||
| print_warning "INFO: The installed Go version ($installed_version) is greater than the required version ($go_mod_version)." | ||
| echo " If you run into issues, try downgrading your version of Go." | ||
| fi | ||
| echo "" | ||
|
|
||
| cd rollkit || { echo "Failed to find the downloaded repository."; exit 1; } | ||
| git fetch && git checkout $1 | ||
| echo "Building and installing Rollkit..." | ||
| print_header "Fetching and checking out the specified branch or tag..." | ||
| git fetch && git checkout "$1" | ||
MSevey marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| echo "" | ||
|
|
||
| print_header "Building and installing Rollkit..." | ||
| make install | ||
| print_success "Rollkit CLI installed successfully!" | ||
MSevey marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| cd .. | ||
| echo "Installation completed successfully." | ||
| print_header "Cleaning up downloads..." | ||
| rm -rf rollkit | ||
MSevey marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| print_success "Installation completed successfully." | ||
Oops, something went wrong.
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.