Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions internal/diskutil/diskutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ func ForProduct(p *system.Product) (DiskUtil, error) {
return newSequoia(p.Version)
case system.Tahoe:
return newTahoe(p.Version)
case system.GoldenGate:
return newGoldenGate(p.Version)
default:
return nil, errors.New("unknown release")
}
Expand Down Expand Up @@ -190,6 +192,16 @@ func newTahoe(version semver.Version) (*diskutilSonoma, error) {
return du, nil
}

// newGoldenGate configures the DiskUtil for the specified Golden Gate version.
func newGoldenGate(version semver.Version) (*diskutilSonoma, error) {
du := &diskutilSonoma{
embeddedDiskutil: &DiskUtilityCmd{},
dec: &PlistDecoder{},
}

return du, nil
}

// embeddedDiskutil is a private interface used to embed UtilImpl into implementation-specific structs.
type embeddedDiskutil interface {
UtilImpl
Expand Down
7 changes: 7 additions & 0 deletions internal/system/product.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const (
Sonoma
Sequoia
Tahoe
GoldenGate
CompatMode
)

Expand All @@ -40,6 +41,8 @@ func (r Release) String() string {
return "Sequoia"
case Tahoe:
return "Tahoe"
case GoldenGate:
return "Golden Gate"
case CompatMode:
return "Compatability Mode"
default:
Expand All @@ -64,6 +67,8 @@ var (
sequoiaConstraints = mustInitConstraint(semver.NewConstraint("~15"))
// tahoeConstraints are the constraints used to identify Tahoe versions (26.x.x).
tahoeConstraints = mustInitConstraint(semver.NewConstraint("~26"))
// goldenGateConstraints are the constraints used to identify Golden Gate versions (27.x.x).
goldenGateConstraints = mustInitConstraint(semver.NewConstraint("~27"))
// compatModeConstraints are the constraints used to identify macOS Big Sur and later. This version is returned
// when the system is in compat mode (SYSTEM_VERSION_COMPAT=1).
compatModeConstraints = mustInitConstraint(semver.NewConstraint("~10.16"))
Expand Down Expand Up @@ -124,6 +129,8 @@ func getVersionRelease(version semver.Version) Release {
return Sequoia
case tahoeConstraints.Check(&version):
return Tahoe
case goldenGateConstraints.Check(&version):
return GoldenGate
case compatModeConstraints.Check(&version):
return CompatMode
default:
Expand Down
Loading