File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
ContainerCommands/Builder Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import ContainerizationOCI
2626import Foundation
2727import Logging
2828import TerminalProgress
29+ import Virtualization
2930
3031extension Application {
3132 public struct BuilderStart : AsyncLoggableCommand {
@@ -195,7 +196,15 @@ extension Application {
195196 }
196197 }
197198
198- let useRosetta = DefaultsStore . getBool ( key: . buildRosetta) ?? true
199+ let rosettaPreference = DefaultsStore . getBool ( key: . buildRosetta) ?? true
200+ let rosettaExplicit = DefaultsStore . isSet ( key: . buildRosetta)
201+ let useRosetta : Bool
202+ #if arch(arm64)
203+ let rosettaAvailable = VZLinuxRosettaDirectoryShare . availability == . installed
204+ useRosetta = rosettaExplicit ? rosettaPreference : ( rosettaPreference && rosettaAvailable)
205+ #else
206+ useRosetta = false
207+ #endif
199208 let shimArguments = [
200209 " --debug " ,
201210 " --vsock " ,
Original file line number Diff line number Diff line change @@ -66,6 +66,10 @@ public enum DefaultsStore {
6666 ?? Bool ( key. defaultValue)
6767 }
6868
69+ public static func isSet( key: DefaultsStore . Keys ) -> Bool {
70+ udSuite. object ( forKey: key. rawValue) != nil
71+ }
72+
6973 public static func allValues( ) -> [ DefaultsStoreValue ] {
7074 let allKeys : [ ( Self . Keys , ( Self . Keys ) -> Any ? ) ] = [
7175 ( . buildRosetta, { Self . getBool ( key: $0) } ) ,
You can’t perform that action at this time.
0 commit comments