#!/bin/bash # Rhythms for Mac: installer for founding members (Digital Feng Shui). # What it does: downloads the app from our server, checks it arrived complete and unchanged, # puts it in your Applications folder and opens it. Nothing else. # The server fills in the four values below for your personal link. set -euo pipefail APP_NAME="Rhythms.app" ZIP_URL="https://digital-fengshui-app.pages.dev/d" SHA256="b522bee602c6841b7bd11532e130ce617c2d0195f67727669c3f9986f88412aa" INTEL_OK="1" DEST="${DFS_APP_DEST:-/Applications}" # DFS_APP_DEST is only for our own tests say() { printf '%s\n' "$*"; } stop() { say ""; say "$*"; say "Questions? Reply to the email with your link, we'll help."; exit 1; } [ "$(uname -s)" = "Darwin" ] || stop "This installs a Mac app. Run it on your Mac." major="$(sw_vers -productVersion | cut -d. -f1)" [ "$major" -ge 14 ] || stop "Rhythms needs macOS 14 (Sonoma) or newer. Your Mac has $(sw_vers -productVersion). Update first: Apple menu > System Settings > General > Software Update." if [ "$(uname -m)" = "x86_64" ] && [ "$INTEL_OK" != "1" ]; then stop "Rhythms doesn't run on Intel Macs yet. We'll email you as soon as it does." fi tmp="$(mktemp -d /tmp/rhythms.XXXXXX)" trap 'rm -rf "${tmp:?}"' EXIT say "Downloading Rhythms..." curl -fsSL --retry 2 "$ZIP_URL" -o "$tmp/app.zip" || stop "The download didn't work. Check your internet and run the line again." got="$(shasum -a 256 "$tmp/app.zip" | cut -d' ' -f1)" [ "$got" = "$SHA256" ] || stop "The download didn't arrive complete. Please run the line again." ditto -x -k "$tmp/app.zip" "$tmp/x" [ -d "$tmp/x/$APP_NAME" ] || stop "Something is wrong with the download." codesign --verify --deep --strict "$tmp/x/$APP_NAME" 2>/dev/null || stop "The app didn't pass its integrity check." if [ ! -w "$DEST" ]; then DEST="$HOME/Applications"; mkdir -p "$DEST"; fi proc="${APP_NAME%.app}" if pgrep -xq "$proc"; then say "Closing the running copy first..." osascript -e "quit app \"$proc\"" >/dev/null 2>&1 || true sleep 2 fi rm -rf "${DEST:?}/${APP_NAME:?}" ditto "$tmp/x/$APP_NAME" "$DEST/$APP_NAME" say "Installed in $DEST. Opening Rhythms..." open "$DEST/$APP_NAME" say "Done. You can close this window."