File tree Expand file tree Collapse file tree 3 files changed +41
-2
lines changed Expand file tree Collapse file tree 3 files changed +41
-2
lines changed Original file line number Diff line number Diff line change 1+ package linux
2+
3+ import (
4+ "errors"
5+ "github.com/k0sproject/k0sctl/configurer"
6+ "github.com/k0sproject/rig"
7+ "github.com/k0sproject/rig/os"
8+ "github.com/k0sproject/rig/os/registry"
9+ "strings"
10+ )
11+
12+ // CoreOS provides OS support for ostree based Fedora & RHEL systems
13+ type CoreOS struct {
14+ os.Linux
15+ BaseLinux
16+ }
17+
18+ func init () {
19+ registry .RegisterOSModule (
20+ func (os rig.OSVersion ) bool {
21+ return os .ID == "fedora" && strings .Contains (os .Name , "CoreOS" ) || os .ID == "rhel" && strings .Contains (os .Name , "CoreOS" )
22+ },
23+ func () interface {} {
24+ linuxType := & CoreOS {}
25+ linuxType .PathFuncs = interface {}(linuxType ).(configurer.PathFuncs )
26+ return linuxType
27+ },
28+ )
29+ }
30+
31+ func (l CoreOS ) InstallPackage (h os.Host , pkg ... string ) error {
32+ return errors .New ("CoreOS does not support installing packages manually" )
33+ }
34+
35+ func (l CoreOS ) K0sBinaryPath () string {
36+ return "/opt/bin/k0s"
37+ }
Original file line number Diff line number Diff line change 55 k0slinux "github.com/k0sproject/k0sctl/configurer/linux"
66 "github.com/k0sproject/rig"
77 "github.com/k0sproject/rig/os/registry"
8+ "strings"
89)
910
1011// Fedora provides OS support for Fedora
@@ -16,7 +17,7 @@ type Fedora struct {
1617func init () {
1718 registry .RegisterOSModule (
1819 func (os rig.OSVersion ) bool {
19- return os .ID == "fedora"
20+ return os .ID == "fedora" && ! strings . Contains ( os . Name , "CoreOS" )
2021 },
2122 func () interface {} {
2223 linuxType := & Fedora {}
Original file line number Diff line number Diff line change 55 k0slinux "github.com/k0sproject/k0sctl/configurer/linux"
66 "github.com/k0sproject/rig"
77 "github.com/k0sproject/rig/os/registry"
8+ "strings"
89)
910
1011// RHEL provides OS support for RedHat Enterprise Linux
@@ -15,7 +16,7 @@ type RHEL struct {
1516func init () {
1617 registry .RegisterOSModule (
1718 func (os rig.OSVersion ) bool {
18- return os .ID == "rhel"
19+ return os .ID == "rhel" && ! strings . Contains ( os . Name , "CoreOS" )
1920 },
2021 func () interface {} {
2122 linuxType := & RHEL {}
You can’t perform that action at this time.
0 commit comments