#!/bin/sh # scrubadubber installer (macOS). # # curl -fsSL https://scrubadubber.com/install.sh | sh # # Downloads the latest scrubadubber.dmg from GitHub Releases, verifies its # SHA-256 against checksums.txt, installs the app into /Applications, and opens # it. It does nothing else — read it first; that is the whole point of this # project. # # Override (optional): # SCRUBADUBBER_VERSION release tag to install (default: latest) set -eu REPO="salehkreiner/scrubadubber" ASSET="scrubadubber.dmg" VERSION="${SCRUBADUBBER_VERSION:-latest}" if [ "$VERSION" = "latest" ]; then BASE="https://github.com/$REPO/releases/latest/download" else BASE="https://github.com/$REPO/releases/download/$VERSION" fi err() { printf 'install.sh: error: %s\n' "$*" >&2; exit 1; } os=$(uname -s 2>/dev/null || echo unknown) [ "$os" = "Darwin" ] || err "this installer is macOS-only (detected '$os'); on Windows use install.ps1" tmp=$(mktemp -d) mnt="" cleanup() { [ -n "$mnt" ] && hdiutil detach "$mnt" -quiet >/dev/null 2>&1 || true rm -rf "$tmp" } trap cleanup EXIT echo "Downloading $ASSET ..." curl -fSL --proto '=https' --tlsv1.2 -o "$tmp/$ASSET" "$BASE/$ASSET" curl -fSL --proto '=https' --tlsv1.2 -o "$tmp/checksums.txt" "$BASE/checksums.txt" # checksums.txt is shasum -a 256 format: " " expected=$(awk -v a="$ASSET" '$2==a || $2=="*"a {print $1; exit}' "$tmp/checksums.txt") [ -n "$expected" ] || err "no checksum entry for $ASSET in checksums.txt" actual=$(shasum -a 256 "$tmp/$ASSET" | awk '{print $1}') [ "$expected" = "$actual" ] || err "checksum mismatch for $ASSET (expected $expected, got $actual)" echo "Checksum verified." echo "Mounting $ASSET ..." mnt=$(hdiutil attach -nobrowse -noverify -noautoopen "$tmp/$ASSET" | sed -n 's:.*\(/Volumes/.*\):\1:p' | head -1) [ -n "$mnt" ] || err "could not mount $ASSET" app=$(find "$mnt" -maxdepth 1 -name '*.app' | head -1) [ -n "$app" ] || err "no .app found inside $ASSET" name=$(basename "$app") echo "Installing $name to /Applications ..." rm -rf "/Applications/$name" cp -R "$app" "/Applications/" || err "could not copy to /Applications (try running with sudo)" hdiutil detach "$mnt" -quiet >/dev/null 2>&1 || true mnt="" echo "Launching $name ..." open "/Applications/$name" || true echo "" echo "Done. scrubadubber is installed in /Applications."