From 63b74f407b79d034c770ef8ab307d09bb4091ad5 Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Mon, 10 Jul 2023 19:23:50 +0400 Subject: [PATCH] Version console device (#546) --- Sources/tart/VM.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Sources/tart/VM.swift b/Sources/tart/VM.swift index 20cf010..d93d875 100644 --- a/Sources/tart/VM.swift +++ b/Sources/tart/VM.swift @@ -339,6 +339,20 @@ class VM: NSObject, VZVirtualMachineDelegate, ObservableObject { // Serial Port configuration.serialPorts = serialPorts + // Version console device + // + // A dummy console device useful for implementing + // host feature checks in the guest agent software. + if #available(macOS 13, *) { + let consolePort = VZVirtioConsolePortConfiguration() + consolePort.name = "tart-version-\(CI.version)" + + let consoleDevice = VZVirtioConsoleDeviceConfiguration() + consoleDevice.ports[0] = consolePort + + configuration.consoleDevices.append(consoleDevice) + } + try configuration.validate() return configuration