Files
komorebi/e2e/platforms/tart_macos/provision.sh
T
LGUG2Z fa2742a75d feat(e2e): scripts that build the golden image of the macOS guest and its programs
build-golden.sh makes the golden Tart image from a vanilla one of Cirrus Labs: it provisions the
guest over SSH (provision.sh: the agent starts at login from a Terminal window, no state of earlier
runs is left, Terminal does not reopen old windows), stops for the one step that cannot be
scripted (a person allows Screen Recording and Accessibility for Terminal, once, and the grants live
in every clone), checks that the agent answers, and shuts the guest down from inside, so that
the last writes are on the disk the clones copy. build-bins.sh builds the programs under test for
the host and points the libiconv of the nix store at the system's, as the nix package does.
2026-11-06 14:40:50 -08:00

41 lines
1.6 KiB
Bash
Executable File

#!/bin/sh
# Runs in the guest, as the logged-in user, to make it what a scenario clones: the agent starts at
# login from a Terminal window (which holds the grants, so the agent and the daemon it starts are
# attributed to it), nothing from earlier runs is left, and Terminal does not reopen old windows.
set -eu
pkill -x komorebi || true
pkill -f komorebi-e2e-agent || true
pkill -f komorebi-testwin || true
killall Terminal 2>/dev/null || true
sleep 1
rm -rf "$HOME/Library/Saved Application State/com.apple.Terminal.savedState" \
"$HOME/Library/Application Support/komorebi"
defaults write com.apple.Terminal NSQuitAlwaysKeepsWindows -bool false
defaults write -g ApplePersistenceIgnoreState -bool true
mkdir -p "$HOME/e2e/bin" "$HOME/e2e/tmp" "$HOME/Library/LaunchAgents"
# what the launch agent opens: a Terminal window that runs the agent
cat > "$HOME/e2e/agent.command" <<COMMAND
#!/bin/sh
exec \$HOME/e2e/bin/komorebi-e2e-agent
COMMAND
chmod +x "$HOME/e2e/agent.command"
cat > "$HOME/Library/LaunchAgents/dev.komorebi.e2e-agent.plist" <<PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
<key>Label</key><string>dev.komorebi.e2e-agent</string>
<key>ProgramArguments</key><array>
<string>/usr/bin/open</string><string>-a</string><string>Terminal</string>
<string>$HOME/e2e/agent.command</string>
</array>
<key>RunAtLoad</key><true/>
<key>LimitLoadToSessionType</key><string>Aqua</string>
</dict></plist>
PLIST
plutil -lint "$HOME/Library/LaunchAgents/dev.komorebi.e2e-agent.plist"