@@ -39,17 +39,17 @@ const (
39
39
40
40
func defaultContainerdArchives () []File {
41
41
const nerdctlVersion = "1.5.0"
42
- location := func (goarch string ) string {
43
- return "https://github.com/containerd/nerdctl/releases/download/v" + nerdctlVersion + "/nerdctl-full-" + nerdctlVersion + "-linux -" + goarch + ".tar.gz"
42
+ location := func (goos string , goarch string ) string {
43
+ return "https://github.com/containerd/nerdctl/releases/download/v" + nerdctlVersion + "/nerdctl-full-" + nerdctlVersion + "-" + goos + " -" + goarch + ".tar.gz"
44
44
}
45
45
return []File {
46
46
{
47
- Location : location ("amd64" ),
47
+ Location : location ("linux" , " amd64" ),
48
48
Arch : X8664 ,
49
49
Digest : "sha256:3f8c494e3c6a265fe2a3c41ef9d6bc859eeeb22095b3353d3558d8120833a23a" ,
50
50
},
51
51
{
52
- Location : location ("arm64" ),
52
+ Location : location ("linux" , " arm64" ),
53
53
Arch : AARCH64 ,
54
54
Digest : "sha256:32a2537e0a80e1493b5934ca56c3e237466606a1b720aef23b9c0a7fc3303bdb" ,
55
55
},
@@ -134,6 +134,13 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
134
134
y .VMType = o .VMType
135
135
}
136
136
y .VMType = pointer .String (ResolveVMType (y .VMType ))
137
+ if y .OS == nil {
138
+ y .OS = d .OS
139
+ }
140
+ if o .OS != nil {
141
+ y .OS = o .OS
142
+ }
143
+ y .OS = pointer .String (ResolveOS (y .OS ))
137
144
if y .Arch == nil {
138
145
y .Arch = d .Arch
139
146
}
@@ -768,6 +775,16 @@ func FillCopyToHostDefaults(rule *CopyToHost, instDir string) {
768
775
}
769
776
}
770
777
778
+ func NewOS (osname string ) OS {
779
+ switch osname {
780
+ case "linux" :
781
+ return LINUX
782
+ default :
783
+ logrus .Warnf ("Unknown os: %s" , osname )
784
+ return osname
785
+ }
786
+ }
787
+
771
788
func goarm () int {
772
789
if runtime .GOOS != "linux" {
773
790
return 0
@@ -824,6 +841,13 @@ func ResolveVMType(s *string) VMType {
824
841
return NewVMType (* s )
825
842
}
826
843
844
+ func ResolveOS (s * string ) OS {
845
+ if s == nil || * s == "" || * s == "default" {
846
+ return NewOS ("linux" )
847
+ }
848
+ return * s
849
+ }
850
+
827
851
func ResolveArch (s * string ) Arch {
828
852
if s == nil || * s == "" || * s == "default" {
829
853
return NewArch (runtime .GOARCH )
0 commit comments