-
-
Notifications
You must be signed in to change notification settings - Fork 416
feat: lodestar script setup #7254
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 all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6599346
feat: lodestar_setup
varunguleriaCodes 5d32426
feat: script_updates + docs
varunguleriaCodes 9bdabc9
feat: script_addition_in_docs + command_update
varunguleriaCodes 2f9ac5b
Merge branch 'unstable' into setup_script
nflaig 8e2749d
Remove duplicate script from docs folder
nflaig f553537
Minor script updates
nflaig c1640ec
Update script to prepare docs and ignore copied file
nflaig 384e822
Update installation page
nflaig 169b512
Wording
nflaig 133ae08
Merge branch 'unstable' into setup_script
nflaig 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
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,91 @@ | ||
| #!/bin/bash | ||
|
|
||
| # ASCII art | ||
| echo " _ _ _ " | ||
| echo " | | | | | | " | ||
| echo " | | ___ __| | ___ ___| |_ __ _ _ __ " | ||
| echo " | |/ _ \ / _ |/ _ \/ __| __/ _ | __|" | ||
| echo " | | (_) | (_| | __/\__ \ || (_| | | " | ||
| echo " |_|\___/ \__ _|\___||___/\__\__ _|_| " | ||
| echo "" | ||
|
|
||
| # Declare directories | ||
| TEMP_DIR=$(mktemp -d) | ||
| LOCAL_BIN="$HOME/.local/bin" | ||
|
|
||
| # Ensure ~/.local/bin exists | ||
| mkdir -p "$LOCAL_BIN" | ||
|
|
||
| # Inform the user about temporary directory usage | ||
| echo "Using temporary directory: $TEMP_DIR" | ||
|
|
||
| # Fetch the latest release tag from GitHub | ||
| echo "Fetching the latest version information..." | ||
| VERSION=$(curl -s "https://api.github.com/repos/ChainSafe/lodestar/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | ||
|
|
||
| # Check if VERSION is empty | ||
| if [ -z "$VERSION" ]; then | ||
| echo "Failed to fetch the latest version. Exiting." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Latest version detected: $VERSION" | ||
|
|
||
| # Detect the operating system and architecture | ||
| OS=$(uname -s) | ||
| ARCH=$(uname -m) | ||
|
|
||
| # Translate architecture to expected format | ||
| case $ARCH in | ||
| x86_64) ARCH="amd64" ;; | ||
| aarch64|arm64) ARCH="arm64" ;; | ||
| *) | ||
| echo "Unsupported architecture: $ARCH. Exiting." | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| # Translate OS to expected format | ||
| case $OS in | ||
| Linux) PLATFORM="linux-$ARCH" ;; | ||
| *) | ||
| echo "Unsupported operating system: $OS. Exiting." | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| # Construct the download URL | ||
| URL="https://github.com/ChainSafe/lodestar/releases/download/$VERSION/lodestar-$VERSION-$PLATFORM.tar.gz" | ||
| echo "Downloading from: $URL" | ||
|
|
||
| # Download the tarball | ||
| if ! wget "$URL" -O "$TEMP_DIR/lodestar-$VERSION-$PLATFORM.tar.gz"; then | ||
| echo "Download failed. Exiting." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Extract the tarball | ||
| echo "Extracting the binary..." | ||
| if ! tar -xzf "$TEMP_DIR/lodestar-$VERSION-$PLATFORM.tar.gz" -C "$TEMP_DIR"; then | ||
| echo "Extraction failed. Exiting." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Move the binary to ~/.local/bin | ||
| echo "Moving the binary to $LOCAL_BIN..." | ||
| mv "$TEMP_DIR/lodestar" "$LOCAL_BIN/" | ||
| chmod +x "$LOCAL_BIN/lodestar" | ||
|
|
||
| # Verify if ~/.local/bin is in PATH | ||
| if [[ ":$PATH:" != *":$LOCAL_BIN:"* ]]; then | ||
| echo "Adding $LOCAL_BIN to PATH..." | ||
| echo 'export PATH="$PATH:$HOME/.local/bin"' >> "$HOME/.bashrc" | ||
| echo "Run 'source ~/.bashrc' to apply changes to your shell." | ||
| fi | ||
|
|
||
| # Clean up the temporary directory | ||
| rm -rf "$TEMP_DIR" | ||
|
|
||
| # Inform the user of successful installation | ||
| echo "Installation complete!" | ||
| echo "Run 'lodestar --help' to get started." |
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
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.