@@ -359,6 +359,10 @@ func templateArgs(ctx context.Context, bootScripts bool, instDir, name string, i
359359}
360360
361361func GenerateCloudConfig (ctx context.Context , instDir , name string , instConfig * limatype.LimaYAML ) error {
362+ if instConfig .OS != nil && * instConfig .OS == limatype .WINDOWS {
363+ return GenerateAutounattendXML (ctx , instDir , name , instConfig )
364+ }
365+
362366 args , err := templateArgs (ctx , false , instDir , name , instConfig , 0 , 0 , 0 , "" , false , false , false )
363367 if err != nil {
364368 return err
@@ -381,6 +385,25 @@ func GenerateCloudConfig(ctx context.Context, instDir, name string, instConfig *
381385 return os .WriteFile (filepath .Join (instDir , filenames .CloudConfig ), config , 0o444 )
382386}
383387
388+ func GenerateAutounattendXML (ctx context.Context , instDir , name string , instConfig * limatype.LimaYAML ) error {
389+ args , err := templateArgs (ctx , false , instDir , name , instConfig , 0 , 0 , 0 , "" , false , false , false )
390+ if err != nil {
391+ return err
392+ }
393+
394+ if err := ValidateTemplateArgs (args ); err != nil {
395+ return err
396+ }
397+
398+ config , err := ExecuteTemplateAutounattendXML (args )
399+ if err != nil {
400+ return err
401+ }
402+
403+ os .RemoveAll (filepath .Join (instDir , filenames .AutounattendXML ))
404+ return os .WriteFile (filepath .Join (instDir , filenames .AutounattendXML ), config , 0o444 )
405+ }
406+
384407// GenerateISO9660 generates the cidata ISO9660 image (or directory, for noCloudInit)
385408// in instDir. It returns the instance ID, which changes on every boot.
386409func GenerateISO9660 (ctx context.Context , drv driver.Driver , instDir , name string , instConfig * limatype.LimaYAML , udpDNSLocalPort , tcpDNSLocalPort int , guestAgentBinary , nerdctlArchive string , vsockPort int , virtioPort string , noCloudInit , rosettaEnabled , rosettaBinFmt bool ) (string , error ) {
0 commit comments