#!/bin/bash # Encore Terminal installer. Read it before you run it; it only downloads the # right app from the Encore releases on GitHub into /Applications. # curl -fsSL https://encore-ivory-omega.vercel.app/install.sh | bash # Files fetched with curl get no quarantine flag, so macOS shows no warning. # Works on OS X 10.10 Yosemite and newer (bash 3.2, no extra tools). # # Test-only switches (the public one-liner never sets them): # ENCORE_ROLE=sender|receiver skip the question # ENCORE_DMG_DIR=/path take the .dmg from a local folder, no download # ENCORE_DEST=/path install there instead of /Applications # ENCORE_NO_OPEN=1 don't open the app afterwards set -eu ENCORE_HOST="https://github.com/SophieTECH-dev/encore-releases/releases/latest/download" major=$(sw_vers -productVersion | cut -d. -f1) minor=$(sw_vers -productVersion | cut -d. -f2) if [ "$major" -ge 14 ] && [ "${ENCORE_ROLE:-}" != "receiver" ]; then role=sender else role=receiver fi # A Mac on macOS 14+ can be either; ask when we have a terminal. if [ "$role" = sender ] && [ -z "${ENCORE_ROLE:-}" ] && [ -r /dev/tty ]; then printf "Is this the new Mac (1) or the old iMac that becomes the screen (2)? [1] " read -r answer &2 exit 1 fi if [ "$role" = sender ]; then dmg=Encore.dmg; app="Encore.app"; else dmg=EncoreReceiver.dmg; app="Encore Receiver.app"; fi # 10.10 to 10.12 get the Legacy receiver, from the site: they don't trust # the certificate of GitHub's download host. if [ "$major" -eq 10 ] && [ "$minor" -lt 13 ]; then dmg=EncoreReceiverLegacy.dmg ENCORE_HOST="https://encore-ivory-omega.vercel.app/downloads" fi tmp=$(mktemp -d /tmp/encore.XXXXXX) trap 'hdiutil detach -quiet "$tmp/mnt" 2>/dev/null || true; rm -rf "$tmp"' EXIT if [ -n "${ENCORE_DMG_DIR:-}" ]; then echo "Using $ENCORE_DMG_DIR/$dmg (local test)." cp "$ENCORE_DMG_DIR/$dmg" "$tmp/$dmg" else echo "Downloading $dmg…" curl -fL --progress-bar "$ENCORE_HOST/$dmg" -o "$tmp/$dmg" fi hdiutil attach -quiet -nobrowse -readonly -mountpoint "$tmp/mnt" "$tmp/$dmg" if [ -n "${ENCORE_DEST:-}" ]; then dest="$ENCORE_DEST"; mkdir -p "$dest" elif [ -w /Applications ]; then dest=/Applications else dest="$HOME/Applications"; mkdir -p "$dest"; fi rm -rf "$dest/$app" cp -R "$tmp/mnt/$app" "$dest/" echo "Installed $app in $dest." [ "${ENCORE_NO_OPEN:-0}" = 1 ] || open "$dest/$app"