#!/bin/sh # Installs Sizeup on a Mac: downloads the app, checks its checksum, # puts it in Applications and opens it. Running it again updates the app. # curl -fsSL https://sizeup.parthh.dev/install | sh set -eu VERSION="0.2.0" URL="https://sizeup.parthh.dev/download/Sizeup-0.2.0-mac.zip" SHA256="c0461f7c1ef10998555a10658978a52278199570ff2da7c5a0868c9068ff974e" APP="Sizeup.app" fail() { printf 'Sizeup: %s\n' "$*" >&2 exit 1 } [ "$(uname -s)" = "Darwin" ] || fail "this installer is for macOS. On Windows, see https://sizeup.parthh.dev/#install" major=$(sw_vers -productVersion | cut -d. -f1) [ "$major" -ge 11 ] || fail "needs macOS 11 (Big Sur) or newer." tmp=$(mktemp -d) trap 'rm -rf "$tmp"' EXIT INT TERM printf 'Downloading Sizeup %s...\n' "$VERSION" curl -fsSL "$URL" -o "$tmp/app.zip" || fail "the download failed. Check your connection and try again." got=$(shasum -a 256 "$tmp/app.zip" | cut -d' ' -f1) [ "$got" = "$SHA256" ] || fail "the download didn't match its checksum, so nothing was installed." ditto -x -k "$tmp/app.zip" "$tmp/unzipped" [ -d "$tmp/unzipped/$APP" ] || fail "the download looks incomplete, so nothing was installed." if [ -w /Applications ]; then dest=/Applications else dest="$HOME/Applications" mkdir -p "$dest" fi # Quit a running copy so it can be replaced. osascript -e 'quit app "Sizeup"' >/dev/null 2>&1 || true pkill -x sizeup >/dev/null 2>&1 || true sleep 1 rm -rf "${dest:?}/$APP" mv "$tmp/unzipped/$APP" "$dest/" xattr -dr com.apple.quarantine "$dest/$APP" 2>/dev/null || true open "$dest/$APP" printf 'Installed in %s.\n' "$dest" printf 'Look for the icon in your menu bar, or press Cmd+Option+S.\n'