Skip to content

Commit

Permalink
Add ArchLinux support (#33)
Browse files Browse the repository at this point in the history
Signed-off-by: erdii <[email protected]>
  • Loading branch information
erdii authored Aug 10, 2021
1 parent dc40042 commit a79e60c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
30 changes: 30 additions & 0 deletions os/linux/archlinux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package linux

import (
"strings"

"github.com/k0sproject/rig"
"github.com/k0sproject/rig/os"
"github.com/k0sproject/rig/os/registry"
)

// Archlinux provides OS support for Archlinux systems
type Archlinux struct {
os.Linux
}

func init() {
registry.RegisterOSModule(
func(os rig.OSVersion) bool {
return os.IDLike == "arch"
},
func() interface{} {
return Archlinux{}
},
)
}

// InstallPackage installs packages via pacman
func (c Archlinux) InstallPackage(h os.Host, s ...string) error {
return h.Execf("sudo pacman -S --noconfirm --noprogressbar %s", strings.Join(s, " "))
}
3 changes: 3 additions & 0 deletions resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ func parseOSReleaseFile(s string, os *OSVersion) error {
os.ID = unquote(fields[1])
case "ID_LIKE":
os.IDLike = unquote(fields[1])
if os.IDLike == "arch" {
os.Version = "0.0.0"
}
case "VERSION_ID":
os.Version = unquote(fields[1])
case "PRETTY_NAME":
Expand Down

0 comments on commit a79e60c

Please sign in to comment.