Skip to content
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

feat: shell installer #261

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
#
# curl -sSL https://raw.githubusercontent.com/rollchains/spawn/release/v0.50/install.sh | bash
#

VERSION=${1:-"v0.50.10"}
BASE_URL="https://github.com/rollchains/spawn/releases/download/$VERSION"

ARCH=$(uname -m)
case $ARCH in
x86_64)
ARCH="amd64"
;;
arm64)
ARCH="arm64"
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac

OS=$(uname -s | tr '[:upper:]' '[:lower:]')
echo "Downloading spawn $VERSION for $OS/$ARCH..."

VERSION_NORMALIZED=$(echo $VERSION | tr -d 'v')

URL="${BASE_URL}/spawn_${VERSION_NORMALIZED}_${OS}_${ARCH}.tar.gz"

TARGET_DIR="$(go env GOPATH)/bin"
mkdir -p "$TARGET_DIR"

mkdir -p /tmp/spawn-install
wget -O "/tmp/spawn-install/spawn.tar.gz" "$URL"
tar -xvf "/tmp/spawn-install/spawn.tar.gz" -C /tmp/spawn-install

mv "/tmp/spawn-install/spawn" "$TARGET_DIR"
chmod +x "$TARGET_DIR/spawn"


# see if the command spawn is avaliable in `which spawn`
if [ -x "$(command -v spawn)" ]; then
echo "Spawn Installation complete. spawn is now available in $TARGET_DIR. Run the command 'spawn' from any terminal session."
else
echo "Spawn is not available in your PATH"
echo "To make spawn available from any terminal session, add the following line to your .bashrc or .zshrc:"
echo 'export PATH="$PATH:$(go env GOPATH)/bin"'
fi


rm -rf /tmp/spawn-install
1 change: 1 addition & 0 deletions scripts/bump_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ findAndReplace() {
}

findAndReplace "*.md" "s/$OLD_VERSION/$NEW_VERSION/g"
findAndReplace "install.sh" "s/$OLD_VERSION/$NEW_VERSION/g"
Loading