diff --git a/installer.sh b/installer.sh new file mode 100644 index 0000000..1416a59 --- /dev/null +++ b/installer.sh @@ -0,0 +1,106 @@ +#!/bin/bash + +set -euo pipefail + +# Simple script to install the latest jiggablend binary for Linux AMD64 +# and create wrapper scripts for manager and runner using test setup + +# Dependencies: curl, jq, tar, sha256sum, sudo (for installation to /usr/local/bin) + +REPO="s1d3sw1ped/jiggablend" +API_URL="https://git.s1d3sw1ped.com/api/v1/repos/${REPO}/releases/latest" +ASSET_NAME="jiggablend-linux-amd64.tar.gz" + +echo "Fetching latest release information..." +RELEASE_JSON=$(curl -s "$API_URL") + +TAG=$(echo "$RELEASE_JSON" | jq -r '.tag_name') +echo "Latest version: $TAG" + +ASSET_URL=$(echo "$RELEASE_JSON" | jq -r ".assets[] | select(.name == \"$ASSET_NAME\") | .browser_download_url") +if [ -z "$ASSET_URL" ]; then + echo "Error: Asset $ASSET_NAME not found in latest release." + exit 1 +fi + +CHECKSUM_URL=$(echo "$RELEASE_JSON" | jq -r '.assets[] | select(.name == "checksums.txt") | .browser_download_url') +if [ -z "$CHECKSUM_URL" ]; then + echo "Error: checksums.txt not found in latest release." + exit 1 +fi + +echo "Downloading $ASSET_NAME..." +curl -L -o "$ASSET_NAME" "$ASSET_URL" + +echo "Downloading checksums.txt..." +curl -L -o "checksums.txt" "$CHECKSUM_URL" + +echo "Verifying checksum..." +if ! sha256sum --ignore-missing --quiet -c checksums.txt; then + echo "Error: Checksum verification failed." + rm -f "$ASSET_NAME" checksums.txt + exit 1 +fi + +echo "Extracting..." +tar -xzf "$ASSET_NAME" + +echo "Installing binary to /usr/local/bin (requires sudo)..." +sudo install -m 0755 jiggablend /usr/local/bin/ + +echo "Creating manager wrapper script..." +cat << 'EOF' > jiggablend-manager.sh +#!/bin/bash + +set -euo pipefail + +# Wrapper to run jiggablend manager with test setup +# Run this in a directory where you want the db, storage, and logs + +mkdir -p logs +rm -f logs/manager.log + +# Initialize test configuration +jiggablend manager config enable localauth +jiggablend manager config set fixed-apikey jk_r0_test_key_123456789012345678901234567890 -f -y +jiggablend manager config add user test@example.com testpassword --admin -f -y + +# Run manager +jiggablend manager -l logs/manager.log +EOF +chmod +x jiggablend-manager.sh +sudo install -m 0755 jiggablend-manager.sh /usr/local/bin/jiggablend-manager +rm -f jiggablend-manager.sh + +echo "Creating runner wrapper script..." +cat << 'EOF' > jiggablend-runner.sh +#!/bin/bash + +set -euo pipefail + +# Wrapper to run jiggablend runner with test setup +# Usage: jiggablend-runner [MANAGER_URL] +# Default MANAGER_URL: http://localhost:8080 +# Run this in a directory where you want the logs + +MANAGER_URL="${1:-http://localhost:8080}" + +mkdir -p logs +rm -f logs/runner.log + +# Run runner +jiggablend runner -l logs/runner.log --api-key=jk_r0_test_key_123456789012345678901234567890 --manager "$MANAGER_URL" +EOF +chmod +x jiggablend-runner.sh +sudo install -m 0755 jiggablend-runner.sh /usr/local/bin/jiggablend-runner +rm -f jiggablend-runner.sh + +echo "Cleaning up..." +rm -f "$ASSET_NAME" checksums.txt jiggablend + +echo "Installation complete!" +echo "Binary: jiggablend" +echo "Wrappers: jiggablend-manager, jiggablend-runner" +echo "Run 'jiggablend-manager' to start the manager with test config." +echo "Run 'jiggablend-runner [url]' to start the runner, e.g., jiggablend-runner http://your-manager:8080" +echo "Note: Depending on whether you're running the manager or runner, additional dependencies like Blender, ImageMagick, or FFmpeg may be required. See the project README for details." \ No newline at end of file