main
 1#!/bin/bash
 2set -e
 3
 4# Ghetto Blaster installer script
 5REPO="xlgmokha/ghetto-blaster"
 6BINARY_NAME="ghetto-blaster"
 7
 8# Detect OS and architecture
 9OS=$(uname -s | tr '[:upper:]' '[:lower:]')
10ARCH=$(uname -m)
11
12case $OS in
13    linux)
14        case $ARCH in
15            x86_64) TARGET="linux-x86_64" ;;
16            *) echo "Unsupported architecture: $ARCH"; exit 1 ;;
17        esac
18        ;;
19    darwin)
20        case $ARCH in
21            x86_64) TARGET="macos-x86_64" ;;
22            arm64) TARGET="macos-arm64" ;;
23            *) echo "Unsupported architecture: $ARCH"; exit 1 ;;
24        esac
25        ;;
26    *)
27        echo "Unsupported OS: $OS (Linux and macOS only)"
28        exit 1
29        ;;
30esac
31
32echo "🎵 Installing Ghetto Blaster for $OS ($ARCH)..."
33
34# Get latest release
35LATEST_RELEASE=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
36DOWNLOAD_URL="https://github.com/$REPO/releases/download/$LATEST_RELEASE/$BINARY_NAME-$TARGET.tar.gz"
37
38echo "📦 Downloading $LATEST_RELEASE..."
39curl -L "$DOWNLOAD_URL" -o "/tmp/$BINARY_NAME.tar.gz"
40
41echo "📂 Extracting..."
42cd /tmp
43tar -xzf "$BINARY_NAME.tar.gz"
44
45echo "🔧 Installing to /usr/local/bin..."
46sudo mv "$BINARY_NAME" /usr/local/bin/
47sudo chmod +x "/usr/local/bin/$BINARY_NAME"
48
49echo "✅ Installation complete!"
50echo ""
51echo "🎧 Run with: ghetto-blaster"
52echo "📖 Config: ~/.config/ghetto-blaster.yml"
53echo ""
54echo "🎉 Enjoy your music!"