@@ -547,14 +547,14 @@ func (i *Installer) getBootPartitions(ctx context.Context, mode Mode, bootloader
547547 return bootloader .GenerateAssets ("/efi" , bootloaderOptions )
548548}
549549
550- func (i * Installer ) installBootloader (ctx context.Context , mode Mode , bootlder bootloaderpkg.Bootloader , info * blkid.Info ) (* bootloaderoptions.InstallResult , error ) {
550+ func (i * Installer ) installBootloader (ctx context.Context , mode Mode , bootloader bootloaderpkg.Bootloader , info * blkid.Info ) (* bootloaderoptions.InstallResult , error ) {
551551 installOptions := i .generateBootloaderOptions (ctx , mode , info )
552552
553553 switch mode {
554554 case ModeInstall :
555- return bootlder .Install (installOptions )
555+ return bootloader .Install (installOptions )
556556 case ModeUpgrade :
557- return bootlder .Upgrade (installOptions )
557+ return bootloader .Upgrade (installOptions )
558558 case ModeImage :
559559 return & bootloaderoptions.InstallResult {}, nil // bootloader already installed in image mode during partition creation
560560 default :
@@ -687,30 +687,30 @@ func (i *Installer) formatPartitions(mode Mode, parts []partition.Options) error
687687
688688//nolint:gocyclo
689689func (i * Installer ) handlePartitionDataPopulation (idx int , p partition.Options , pt * gpt.Table ) error {
690+ // skip data population for partitions without filesystem ie. partition.FilesystemTypeNone
691+ // or zeroed partitions ie. partition.FilesystemTypeZeroes
692+ if p .FileSystemType == partition .FilesystemTypeNone || p .FileSystemType == partition .FilesystemTypeZeroes {
693+ // no data population required
694+ return nil
695+ }
696+
690697 partitionImageFile := filepath .Join (i .options .MountPrefix , p .Label + ".img" )
691698
692699 if err := utils .CreateRawDisk (i .options .Printf , partitionImageFile , int64 (p .Size )); err != nil {
693700 return fmt .Errorf ("failed to create raw disk for partition %s: %w" , p .Label , err )
694701 }
695702
696- // skip data population for partitions without filesystem ie. partition.FilesystemTypeNone
697- // or zeroed partitions ie. partition.FilesystemTypeZeroes
698- if p .FileSystemType != partition .FilesystemTypeNone && p .FileSystemType != partition .FilesystemTypeZeroes {
699- if p .SourceDirectory == "" {
700- return fmt .Errorf ("missing source directory for partition %s" , p .Label )
701- }
703+ if p .SourceDirectory == "" {
704+ return fmt .Errorf ("missing source directory for partition %s" , p .Label )
705+ }
702706
703- // this ensures that the images are reproducible
704- if err := utils .TouchFiles (i .options .Printf , p .SourceDirectory ); err != nil {
705- return fmt .Errorf ("failed to touch files in source directory %s for partition %s: %w" , p .SourceDirectory , p .Label , err )
706- }
707+ // this ensures that the images are reproducible
708+ if err := utils .TouchFiles (i .options .Printf , p .SourceDirectory ); err != nil {
709+ return fmt .Errorf ("failed to touch files in source directory %s for partition %s: %w" , p .SourceDirectory , p .Label , err )
707710 }
708711
709- // we don't need to zero the partition image here, as CreateRawDisk already does that
710- if p .FileSystemType != partition .FilesystemTypeZeroes {
711- if err := partition .Format (partitionImageFile , & p .FormatOptions , i .options .Version , i .options .Printf ); err != nil {
712- return fmt .Errorf ("failed to format partition %s: %w" , partitionImageFile , err )
713- }
712+ if err := partition .Format (partitionImageFile , & p .FormatOptions , i .options .Version , i .options .Printf ); err != nil {
713+ return fmt .Errorf ("failed to format partition %s: %w" , partitionImageFile , err )
714714 }
715715
716716 partitionData , err := os .Open (partitionImageFile )
0 commit comments