@@ -21,6 +21,11 @@ type Linux struct {
2121 pathMu sync.Mutex
2222}
2323
24+ // OSKind returns the identifier for Linux hosts
25+ func (l * Linux ) OSKind () string {
26+ return "linux"
27+ }
28+
2429// NOTE The Linux struct does not embed rig/os.Linux because it will confuse
2530// go as the distro-configurers' parents embed it too. This means you can't
2631// add functions to base Linux package that call functions in the rig/os.Linux package,
@@ -168,12 +173,6 @@ func (l *Linux) DownloadURL(h os.Host, url, destination string, opts ...exec.Opt
168173 return nil
169174}
170175
171- // K0sDownloadURL returns the release URL for the requested k0s binary
172- func (l * Linux ) K0sDownloadURL (_ os.Host , version * version.Version , arch string ) (string , error ) {
173- v := strings .ReplaceAll (strings .TrimPrefix (version .String (), "v" ), "+" , "%2B" )
174- return fmt .Sprintf ("https://github.com/k0sproject/k0s/releases/download/v%[1]s/k0s-v%[1]s-%[2]s" , v , arch ), nil
175- }
176-
177176// ReplaceK0sTokenPath replaces the config path in the service stub
178177func (l * Linux ) ReplaceK0sTokenPath (h os.Host , spath string ) error {
179178 return h .Exec (fmt .Sprintf ("sed -i 's^REPLACEME^%s^g' %s" , l .K0sJoinTokenPath (), spath ))
@@ -198,17 +197,6 @@ func (l *Linux) Chown(h os.Host, path, owner string, opts ...exec.Option) error
198197 return h .Exec (cmd , opts ... )
199198}
200199
201- func (l * Linux ) Chmod (h os.Host , path , perm string , opts ... exec.Option ) error {
202- if _ , err := strconv .ParseUint (perm , 8 , 32 ); err != nil {
203- return fmt .Errorf ("invalid file mode %q: %w" , perm , err )
204- }
205- if len (opts ) == 0 {
206- opts = []exec.Option {exec .Sudo (h )}
207- }
208- cmd := fmt .Sprintf (`chmod %s %s` , perm , shellescape .Quote (path ))
209- return h .Exec (cmd , opts ... )
210- }
211-
212200// KubeconfigPath returns the path to a kubeconfig on the host
213201func (l * Linux ) KubeconfigPath (h os.Host , dataDir string ) string {
214202 linux := & os.Linux {}
0 commit comments