#!/bin/bash
# res2.2 installer for macOS. Builds a small res2.2.app in /Applications (or ~/Applications) that
# opens res2.2 in its own window: Google Chrome in app mode if installed, otherwise the default
# browser. Nothing else is installed; the app itself runs on the researcher's server.
set -e
URL="https://lab-ioars35.tail64cdcc.ts.net"
DEST="/Applications"
[ -w "$DEST" ] || { DEST="$HOME/Applications"; mkdir -p "$DEST"; }
APP="$DEST/res2.2.app"
mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
cat > "$APP/Contents/Info.plist" <<'PLIST'
CFBundleNameres2.2
CFBundleDisplayNameres2.2
CFBundleIdentifierlab.vision.res22
CFBundleVersion1.0
CFBundlePackageTypeAPPL
CFBundleExecutableres2.2
LSMinimumSystemVersion11.0
NSCameraUsageDescriptionres2.2 shows your camera so the face swap can run.
PLIST
cat > "$APP/Contents/MacOS/res2.2" </dev/null || true
echo
echo "res2.2 is installed in $DEST. Open it from Applications or Spotlight and sign in with your invited email."
echo
open "$APP"