@@ -18,7 +18,6 @@ package config
1818
1919import (
2020 "fmt"
21- "os/exec"
2221 "path/filepath"
2322 "runtime"
2423 "strings"
@@ -597,34 +596,34 @@ func NewBuildConfig(opts ...GenericOptions) *v1.BuildConfig {
597596
598597// ReconcileUpgradeSpec will check current mounts which may differ from elemental disovery from /sys/block tree
599598// as this skips multipathed devices which may be in use.
600- func ReconcileUpgradeSpec (spec * v1.UpgradeSpec ) error {
599+ func ReconcileUpgradeSpec (r * v1. RunConfig , spec * v1.UpgradeSpec ) error {
601600 if spec .Partitions .State != nil {
602- if err := reconcilePartition (spec .Partitions .State ); err != nil {
601+ if err := reconcilePartition (r , spec .Partitions .State ); err != nil {
603602 return err
604603 }
605604 }
606605 if spec .Partitions .Recovery != nil {
607- if err := reconcilePartition (spec .Partitions .Recovery ); err != nil {
606+ if err := reconcilePartition (r , spec .Partitions .Recovery ); err != nil {
608607 return err
609608 }
610609 }
611610
612611 if spec .Partitions .Persistent != nil {
613- if err := reconcilePartition (spec .Partitions .Persistent ); err != nil {
612+ if err := reconcilePartition (r , spec .Partitions .Persistent ); err != nil {
614613 return err
615614 }
616615 }
617616
618617 if spec .Partitions .OEM != nil {
619- if err := reconcilePartition (spec .Partitions .OEM ); err != nil {
618+ if err := reconcilePartition (r , spec .Partitions .OEM ); err != nil {
620619 return err
621620 }
622621 }
623622 return nil
624623}
625624
626- func reconcilePartition (part * v1.Partition ) error {
627- discoveredMountDiskBytes , err := execBlkid (part .FilesystemLabel )
625+ func reconcilePartition (r * v1. RunConfig , part * v1.Partition ) error {
626+ discoveredMountDiskBytes , err := execBlkid (r , part .FilesystemLabel )
628627 if err != nil {
629628 return fmt .Errorf ("error discovering current partition using label %s: %w" , part .FilesystemLabel , err )
630629 }
@@ -636,12 +635,10 @@ func reconcilePartition(part *v1.Partition) error {
636635 }
637636 return nil
638637}
639- func execBlkid (name string ) ([]byte , error ) {
640- path , err := exec .LookPath ("blkid" )
641- if err != nil {
642- return nil , err
638+ func execBlkid (r * v1.RunConfig , name string ) ([]byte , error ) {
639+ if ok := r .Config .Runner .CommandExists ("blkid" ); ok {
640+ return r .Config .Runner .Run ("blkid" , "-L" , name )
643641 }
644642
645- blkidCmd := exec .Command (path , "-L" , name )
646- return blkidCmd .Output ()
643+ return []byte {}, fmt .Errorf ("blkid not found" )
647644}
0 commit comments