From 78c4b8f396db411dea7e3128968369e1de070eaf Mon Sep 17 00:00:00 2001 From: Colin Black Date: Sat, 28 Nov 2020 11:23:10 -0800 Subject: [PATCH 1/3] Ignore .DS_Store files --- .DS_Store | Bin 6148 -> 0 bytes .gitignore | 3 +++ 2 files changed, 3 insertions(+) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 4db263aa01c13b1800d6082b0ce42e546b361097..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK&2G~`5T0#Qx(PxAsZ!y#7Y;~KWe1s`1Cj~h&>NBw900X;95qIc*GinGkOuiR zXdi+{K;p;?@G?j+v%5w40V(PMBD5pTe&gN!*1MnO85;mtYZSWxbpYV#gq0dLzcCso zU$PC;Lp-L|IElu?JW6G>G}m@m1*`(=rvSaXTaZEm8H`}|{rwu{X)-Jv=NsGDtZZG` z=Dfyh*J^Kqo*V~7Sd50PaPW$*o`pp(GVyaM(_e8Iy-2#_gZj=BnH6D@bq9)^#9f^7 z`el;Ea@>-mEFP+L0zJTal~)hywbD;;m^tHdFvwDw9bqpqw&560KY#+yA40mH%8tokloTJM@BL7Q(bDXh ze76pId3U{raGRbItm(Q9@!;P5OX;nEJJINP%hAT1SOEUA`%uX+=qT2RaH|BleSJ!%% zc5_w%tH8fdfbxStC-e=L8dd7RMkPDM3U({Qn93$`ghAh6sS!uen5H6XDl@+rOw+Mn zn0dazQlq8=GijEYJ2Uf#!qnYyeW9iU^EKMmDqt0uS71|L)~WtK{qz6-Jjq^J1*`)9 zl>)5N4%#g|lBumrhof36&=1kcXkMvNQLr)PSOrvyZ=x&1F+l;MZ?M#eJ!tkrK*?Ym JtH57X;3pcT Date: Sat, 28 Nov 2020 11:56:40 -0800 Subject: [PATCH 2/3] Add command line argument to specify MAC address --- virtual/VirtualCommandRun.swift | 4 ++++ virtual/VirtualSystem.swift | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/virtual/VirtualCommandRun.swift b/virtual/VirtualCommandRun.swift index bb3b65e..8a1f46e 100644 --- a/virtual/VirtualCommandRun.swift +++ b/virtual/VirtualCommandRun.swift @@ -36,6 +36,10 @@ struct VirtualCommandRun: ParsableCommand { @Flag(name: .shortAndLong, help: "Enable NAT Networking") var network: Bool = false + // if not specified, will generate at random + @Option(name: [.customShort("a"), .long], help: "MAC Address") + var macaddr: String = "" + @Flag(name: .long, help: "Show Version Information") var version: Bool = false diff --git a/virtual/VirtualSystem.swift b/virtual/VirtualSystem.swift index 059cb3d..b6670dd 100644 --- a/virtual/VirtualSystem.swift +++ b/virtual/VirtualSystem.swift @@ -50,6 +50,13 @@ class VirtualSystem: NSObject, VZVirtualMachineDelegate { if command.network { let networkDevice = VZVirtioNetworkDeviceConfiguration() + if !command.macaddr.isEmpty { + if let macAddress = VZMACAddress(string: command.macaddr) { + networkDevice.macAddress = macAddress + } else { + NSLog("Ignoring MAC Address: was not in acceptable format e.g. 01:23:45:ab:cd:ef") + } + } networkDevice.attachment = VZNATNetworkDeviceAttachment() network.append(networkDevice) } From e9218df067903ded8e2cb38ace835618cc0760c9 Mon Sep 17 00:00:00 2001 From: Colin Black Date: Sat, 28 Nov 2020 11:57:22 -0800 Subject: [PATCH 3/3] Mount disks as read-write by default (allows use of persistent disk images) --- virtual/VirtualSystem.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virtual/VirtualSystem.swift b/virtual/VirtualSystem.swift index b6670dd..1ede56d 100644 --- a/virtual/VirtualSystem.swift +++ b/virtual/VirtualSystem.swift @@ -40,7 +40,7 @@ class VirtualSystem: NSObject, VZVirtualMachineDelegate { var storage: [VZStorageDeviceConfiguration] = [] if !command.disk.isEmpty { for disk in command.disk { - let blockAttachment = try VZDiskImageStorageDeviceAttachment(url: URL(fileURLWithPath: disk).absoluteURL, readOnly: true) + let blockAttachment = try VZDiskImageStorageDeviceAttachment(url: URL(fileURLWithPath: disk).absoluteURL, readOnly: false) let blockDevice = VZVirtioBlockDeviceConfiguration(attachment: blockAttachment) storage.append(blockDevice) }