--window opens the Redline window at launch, so a script or a demo lands on the new UI instead of an idle menu-bar icon. Clicking the running app in Finder, or open -a Redline, now shows the window instead of doing nothing. scripts/install-local.sh installs the locally built app into /Applications, keeps the previous copy at .build/Redline-<version>.app for rollback, and launches it with the window open.
56 lines
1.7 KiB
Bash
Executable File
56 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Installs the locally built Redline into /Applications and launches it with its
|
|
# session window open, so the current build is what is on screen.
|
|
#
|
|
# ./scripts/install-local.sh
|
|
#
|
|
# The previously installed copy is kept at .build/Redline-<version>.app so the change
|
|
# is reversible.
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
BUILT="${ROOT}/.build/Redline.app"
|
|
TARGET="/Applications/Redline.app"
|
|
BUNDLE_ID="ai.flowmaster.shotdeck"
|
|
|
|
if [[ ! -d "${BUILT}" ]]; then
|
|
echo "No ${BUILT}. Run ./scripts/build-app.sh first." >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -d "${TARGET}" ]]; then
|
|
OLD_VERSION="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "${TARGET}/Contents/Info.plist")"
|
|
BACKUP="${ROOT}/.build/Redline-${OLD_VERSION}.app"
|
|
if [[ ! -d "${BACKUP}" ]]; then
|
|
echo "==> Keeping the installed ${OLD_VERSION} at ${BACKUP}"
|
|
ditto "${TARGET}" "${BACKUP}"
|
|
fi
|
|
fi
|
|
|
|
echo "==> Quitting the running Redline"
|
|
osascript -e 'quit app "Redline"' >/dev/null 2>&1 || true
|
|
for _ in $(seq 1 40); do
|
|
if ! pgrep -f "${TARGET}/Contents/MacOS/Shotdeck" >/dev/null 2>&1; then
|
|
break
|
|
fi
|
|
sleep 0.25
|
|
done
|
|
pkill -f "${TARGET}/Contents/MacOS/Shotdeck" >/dev/null 2>&1 || true
|
|
sleep 0.5
|
|
|
|
echo "==> Installing ${BUILT} to ${TARGET}"
|
|
ditto "${BUILT}" "${TARGET}"
|
|
|
|
NEW_VERSION="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "${TARGET}/Contents/Info.plist")"
|
|
echo "==> Launching Redline ${NEW_VERSION} with its window open"
|
|
open -n "${TARGET}" --args --window
|
|
|
|
sleep 2
|
|
if pgrep -f "${TARGET}/Contents/MacOS/Shotdeck" >/dev/null 2>&1; then
|
|
echo "Redline ${NEW_VERSION} is running from ${TARGET}"
|
|
else
|
|
echo "Redline did not start" >&2
|
|
exit 1
|
|
fi
|