#!/bin/bash # # VolumeLens installer — https://volumelens.onzira.com # Onzira Labs Private Limited # # curl -fsSL https://volumelens.onzira.com/install.sh | bash # # Why this exists: macOS attaches a "quarantine" flag to anything a *browser* # downloads, and Gatekeeper refuses to open a quarantined app that Apple has # not notarized. curl does not set that flag, so an app installed this way # opens normally. Nothing here disables a security feature or edits any # system setting — it simply is not the browser download path. # # What you are trusting: this script is served over HTTPS from # volumelens.onzira.com and verifies the download against the SHA-256 published # in that same release manifest, so a corrupted or altered transfer is caught. # It is not a substitute for Apple notarization, which additionally has Apple # scan the binary. If you would rather not trust us, build from source: # https://github.com/onzira/volumelens # # Options: # --prefix DIR install somewhere other than /Applications # --uninstall remove VolumeLens (leaves your scan data alone) # --keep keep the downloaded disk image set -euo pipefail BASE="${VOLUMELENS_BASE:-https://volumelens.onzira.com}" PREFIX="/Applications" UNINSTALL=0 KEEP=0 while [ $# -gt 0 ]; do case "$1" in --prefix) PREFIX="${2:?--prefix needs a directory}"; shift 2 ;; --uninstall) UNINSTALL=1; shift ;; --keep) KEEP=1; shift ;; -h|--help) sed -n '2,26p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;; *) echo "unknown option: $1" >&2; exit 2 ;; esac done APP="$PREFIX/VolumeLens.app" bold() { printf '\033[1m%s\033[0m\n' "$1"; } die() { printf '\033[31merror:\033[0m %s\n' "$1" >&2; exit 1; } [ "$(uname -s)" = "Darwin" ] || die "VolumeLens is a macOS application." [ "$(id -u)" != "0" ] || die "Run this as yourself, not with sudo — installing as root leaves the app unusable." if [ "$UNINSTALL" = "1" ]; then [ -d "$APP" ] || die "VolumeLens is not installed at $APP" pkill -x VolumeLens 2>/dev/null || true rm -rf "$APP" bold "Removed $APP" echo "Your scans and settings are still in ~/Library/Containers/com.volumelens.app" echo "Remove those too with: rm -rf ~/Library/Containers/com.volumelens.app" exit 0 fi # macOS 14 or later. MAJOR="$(sw_vers -productVersion | cut -d. -f1)" [ "$MAJOR" -ge 14 ] 2>/dev/null || die "VolumeLens needs macOS 14 (Sonoma) or later; this is $(sw_vers -productVersion)." bold "Fetching the current release…" MANIFEST="$(curl -fsSL "$BASE/releases.json")" || die "Could not reach $BASE" read_field() { printf '%s' "$MANIFEST" | /usr/bin/python3 -c "import json,sys;print(json.load(sys.stdin).get('$1',''))"; } VERSION="$(read_field version)" FILE="$(read_field file)" WANT_SHA="$(read_field sha256)" ARCHS="$(read_field architectures)" [ -n "$FILE" ] && [ -n "$WANT_SHA" ] || die "The release manifest is incomplete; try again later." # Refuse an Intel install of an Apple-silicon-only build rather than let it fail later. if [ "$ARCHS" = "arm64" ] && [ "$(uname -m)" != "arm64" ]; then die "This build is Apple silicon only and this Mac is $(uname -m). A universal build is coming; email support@onzira.com." fi TMP="$(mktemp -d)" cleanup() { [ -n "${MOUNT:-}" ] && [ -d "${MOUNT:-}" ] && hdiutil detach "$MOUNT" -quiet 2>/dev/null || true [ "$KEEP" = "1" ] || rm -rf "$TMP" } trap cleanup EXIT bold "Downloading VolumeLens $VERSION…" curl -fL --progress-bar -o "$TMP/$FILE" "$BASE/downloads/$FILE" || die "Download failed." bold "Verifying the download…" GOT_SHA="$(shasum -a 256 "$TMP/$FILE" | awk '{print $1}')" if [ "$GOT_SHA" != "$WANT_SHA" ]; then die "Checksum mismatch — the file does not match what $BASE published, so it was NOT installed. expected $WANT_SHA received $GOT_SHA" fi echo " SHA-256 matches: $GOT_SHA" MOUNT="$(hdiutil attach -nobrowse -readonly "$TMP/$FILE" | tail -1 | sed 's|.*\(/Volumes/.*\)|\1|')" [ -d "$MOUNT/VolumeLens.app" ] || die "The disk image does not contain VolumeLens.app" if pgrep -x VolumeLens >/dev/null 2>&1; then bold "Quitting the running copy…" osascript -e 'quit app "VolumeLens"' 2>/dev/null || pkill -x VolumeLens || true sleep 2 fi bold "Installing to $PREFIX…" mkdir -p "$PREFIX" [ -w "$PREFIX" ] || die "$PREFIX is not writable by $(whoami). Try: $0 --prefix ~/Applications" rm -rf "$APP" cp -R "$MOUNT/VolumeLens.app" "$APP" # Belt and braces: nothing here should carry quarantine, but a re-run over an # older browser-installed copy might have inherited it. xattr -dr com.apple.quarantine "$APP" 2>/dev/null || true if ! codesign --verify --strict "$APP" 2>/dev/null; then die "The installed copy failed its own signature check and was removed. Please report this." fi echo bold "VolumeLens $VERSION is installed." echo " $APP" echo echo "Open it with: open -a VolumeLens" echo "Uninstall: curl -fsSL $BASE/install.sh | bash -s -- --uninstall" echo echo "It scans only the folder you choose and sends nothing anywhere. The scan" echo "reads names and sizes, never file contents; the only file it ever opens is" echo "an app's Info.plist on the Applications screen."