@@ -23,14 +23,12 @@ import (
23
23
"os/exec"
24
24
"strconv"
25
25
"strings"
26
- "sync"
27
26
"syscall"
28
27
"time"
29
28
30
- "github.com/Masterminds/semver/v3"
31
29
"github.com/crc-org/crc/v2/pkg/crc/constants"
32
- "github.com/crc-org/crc/v2/pkg/crc/logging"
33
30
crcos "github.com/crc-org/crc/v2/pkg/os"
31
+ "github.com/crc-org/crc/v2/pkg/os/darwin"
34
32
"github.com/crc-org/machine/libmachine/drivers"
35
33
"github.com/crc-org/machine/libmachine/state"
36
34
"github.com/crc-org/vfkit/pkg/config"
@@ -488,36 +486,10 @@ func (d *Driver) sendSignal(s syscall.Signal) error {
488
486
return proc .SendSignal (s )
489
487
}
490
488
491
- var (
492
- once sync.Once
493
- macCurrentVersion string
494
- errGettingVersion error
495
- )
496
-
497
489
func (d * Driver ) supportsVirtiofs () bool {
498
- supportsVirtioFS , err := macosAtLeast ("12.0.0" )
490
+ supportsVirtioFS , err := darwin . AtLeast ("12.0.0" )
499
491
if err != nil {
500
492
log .Debugf ("Not able to compare version: %v" , err )
501
493
}
502
494
return supportsVirtioFS
503
495
}
504
-
505
- func macosAtLeast (targetVersion string ) (bool , error ) {
506
- once .Do (func () {
507
- macCurrentVersion , errGettingVersion = syscall .Sysctl ("kern.osproductversion" )
508
- logging .Debugf ("kern.osproductversion is: %s" , macCurrentVersion )
509
- })
510
- if errGettingVersion != nil {
511
- return false , errGettingVersion
512
- }
513
-
514
- cVersion , err := semver .NewVersion (macCurrentVersion )
515
- if err != nil {
516
- return false , errors .Wrap (err , fmt .Sprintf ("cannot parse %s" , macCurrentVersion ))
517
- }
518
- targetVersionStr , err := semver .NewVersion (targetVersion )
519
- if err != nil {
520
- return false , errors .Wrap (err , fmt .Sprintf ("cannot parse %s" , targetVersion ))
521
- }
522
- return cVersion .Equal (targetVersionStr ) || cVersion .GreaterThan (targetVersionStr ), nil
523
- }
0 commit comments