Skip to content

armgit / WSM

Public Imported from GitHub
0

Run macOS applications on your Windows desktop, with a background runtime and integrated app windows.

C++
1.5 KB
Raw Blame
# WSM One-Click Guest Provisioner
# Uses the locally built reims-ctl to fetch macOS directly from Apple's servers
# (no proprietary Apple binaries are redistributed with WSM) onto F:\WSM\runtime\images,
# and optionally deploys wsm-guest-agent into the running guest over SSH.
param(
    [string]$VmName = "wsm-default",
    [string]$MacOsVersion = "tahoe",
    [switch]$DeployAgent,
    [string]$GuestUser = "user",
    [int]$SshPort = 2222
)

$ErrorActionPreference = 'Stop'
. F:\WSM\env.ps1

if ($DeployAgent) {
    Write-Host "==> Deploying wsm-guest-agent to guest ($GuestUser@127.0.0.1:$SshPort)..."
    scp -P $SshPort -o StrictHostKeyChecking=no `
        "F:\WSM\src\wsm-guest-agent\wsm_guest_agent.m" `
        "F:\WSM\src\wsm-guest-agent\com.wsm.guestagent.plist" `
        "F:\WSM\src\wsm-guest-agent\install-in-guest.sh" `
        "${GuestUser}@127.0.0.1:/tmp/"
    ssh -p $SshPort -o StrictHostKeyChecking=no "${GuestUser}@127.0.0.1" "chmod +x /tmp/install-in-guest.sh && /tmp/install-in-guest.sh"
    Write-Host "==> Guest agent deployed and running!"
    exit 0
}

$reimsCtl = Get-Command reims-ctl -ErrorAction SilentlyContinue
if (-not $reimsCtl) {
    $candidate = "F:\WSM\cache\cargo\bin\reims-ctl.exe"
    if (Test-Path $candidate) { $reimsCtl = $candidate }
    else { throw "reims-ctl.exe not found yet. Wait for build-reims-vgpu.ps1 to finish." }
}

$env:XDG_DATA_HOME = "F:\WSM\runtime"
Write-Host "==> Provisioning macOS ($MacOsVersion) VM '$VmName' into F:\WSM\runtime via reims-ctl..."
& $reimsCtl create $VmName --macos $MacOsVersion --start