#!/bin/sh # tia-love — one-line installer (F-029) # # curl -fsSL https://gitea.oxpoe.qzz.io/oxpoe/tia-love/raw/branch/main/install.sh | sh # # Mendeteksi OS/arch, mengunduh rilis terbaru dari Gitea Releases, # memverifikasi SHA256, lalu memasang ke ~/.local/bin (tanpa sudo). # Override lokasi: TIA_LOVE_INSTALL_DIR=/path set -eu GITEA="${TIA_LOVE_GITEA_URL:-https://gitea.oxpoe.qzz.io}" REPO="oxpoe/tia-love" BIN="tia-love" DEST="${TIA_LOVE_INSTALL_DIR:-$HOME/.local/bin}" os=$(uname -s | tr '[:upper:]' '[:lower:]') arch=$(uname -m) case "$arch" in x86_64 | amd64) arch=amd64 ;; aarch64 | arm64) arch=arm64 ;; *) echo "tia-love: arsitektur tidak didukung: $arch" >&2 exit 1 ;; esac case "$os" in linux | darwin) ;; *) echo "tia-love: OS tidak didukung: $os (Windows: gunakan WSL2)" >&2 exit 1 ;; esac echo "==> mencari rilis terbaru..." tag=$(curl -fsSL "$GITEA/api/v1/repos/$REPO/releases/latest" | grep -o '"tag_name": *"[^"]*"' | head -1 | cut -d'"' -f4) if [ -z "${tag:-}" ]; then echo "tia-love: tidak menemukan rilis di $GITEA/$REPO/releases" >&2 exit 1 fi tarball="${BIN}_${os}_${arch}.tar.gz" base="$GITEA/$REPO/releases/download/$tag" tmp=$(mktemp -d) trap 'rm -rf "$tmp"' EXIT echo "==> unduh $tarball ($tag)" curl -fsSL -o "$tmp/$tarball" "$base/$tarball" curl -fsSL -o "$tmp/checksums.txt" "$base/checksums.txt" echo "==> verifikasi SHA256" if command -v sha256sum >/dev/null 2>&1; then verify="sha256sum -c -" else verify="shasum -a 256 -c -" # macOS fi awk -v f="$tarball" '$2 == f' "$tmp/checksums.txt" | (cd "$tmp" && $verify >/dev/null) || { echo "tia-love: verifikasi checksum GAGAL — unduhan dibatalkan" >&2 exit 1 } tar -xzf "$tmp/$tarball" -C "$tmp" "$BIN" mkdir -p "$DEST" install -m 0755 "$tmp/$BIN" "$DEST/$BIN" echo "==> terpasang: $DEST/$BIN ($tag)" case ":$PATH:" in *":$DEST:"*) ;; *) echo "catatan: $DEST belum ada di \$PATH — tambahkan, lalu buka terminal baru" ;; esac