XNU as a loadable kernel module inside Linux (macOS personality for arm64 Linux)
C
install-krun-agent.sh: remove shuts down the VM the agent runs (its SSH_PORT, its KRUN) (#48)
Fred Nix8ae3483349cd
diff --git a/scripts/install-krun-agent.sh b/scripts/install-krun-agent.shindex 905accb..04bd7af 100755--- a/scripts/install-krun-agent.sh+++ b/scripts/install-krun-agent.sh@@ -13,10 +13,13 @@ domain() { launchctl print "gui/$(id -u)" >/dev/null 2>&1 && echo "gui/$(id -u)"PL=$HOME/Library/LaunchAgents/$L.plistS=${S:-$HOME/.local/state/xnupoc-krun}if [ "${1:-}" = remove ]; then+ # the VM as the agent runs it: the SSH_PORT and KRUN written into the agent at install, unless the environment says+ setting() { local v; v=$([ -f "$PL" ] && /usr/libexec/PlistBuddy -c "Print :EnvironmentVariables:$1" "$PL" 2>/dev/null) && echo "$v" || true; }+ SSH_PORT=${SSH_PORT:-$(setting SSH_PORT)}; KRUN=${KRUN:-$(setting KRUN)}# a clean guest shutdown first (the hosted macOS's disk synced by xnulinux.service), then the agentssh -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10 -p "${SSH_PORT:-2223}" \${VMKEY:+-i "$VMKEY"} [email protected] 'sudo systemctl poweroff' 2>/dev/null || true- for _ in $(seq 1 120); do pgrep -f "$HOME/.local/krunkit/bin/krunkit" >/dev/null || break; sleep 1; done+ for _ in $(seq 1 120); do pgrep -f "${KRUN:-$HOME/.local/krunkit}/bin/krunkit" >/dev/null || break; sleep 1; donelaunchctl bootout "$(domain)/$L" 2>/dev/null || truerm -f "$PL"; echo "removed"; exit 0fi