From 9167508302d9ec90389dd32f499698cfe592e2de Mon Sep 17 00:00:00 2001 From: Alexander Matviychuk Date: Fri, 5 Feb 2021 13:54:59 +0900 Subject: [PATCH] add support for crux linux (#581) * Add support for Crux Linux (http://crux.nu) * Update linuxdb.yaml fix typo * Update linux.go fixed comment typo * Update linuxdb.yaml fixed more typos Co-authored-by: Lea Anthony --- cmd/linux.go | 15 +++++++++++++++ cmd/linuxdb.yaml | 19 +++++++++++++++++++ cmd/system.go | 2 ++ 3 files changed, 36 insertions(+) diff --git a/cmd/linux.go b/cmd/linux.go index 4d5b91ca..4d55bc04 100644 --- a/cmd/linux.go +++ b/cmd/linux.go @@ -67,6 +67,8 @@ const ( Ctlos // EndeavourOS linux distribution EndeavourOS + // Crux linux distribution + Crux ) // DistroInfo contains all the information relating to a linux distribution @@ -175,6 +177,8 @@ func parseOsRelease(osRelease string) *DistroInfo { result.Distribution = Solus case "endeavouros": result.Distribution = EndeavourOS + case "crux": + result.Distribution = Crux default: result.Distribution = Unknown } @@ -255,6 +259,17 @@ func RpmInstalled(packageName string) (bool, error) { return exitCode == 0, nil } +// PrtGetInstalled uses prt-get to see if a package is installed +func PrtGetInstalled(packageName string) (bool, error) { + program := NewProgramHelper() + prtget := program.FindProgram("prt-get") + if prtget == nil { + return false, fmt.Errorf("cannot check dependencies: prt-get not found") + } + _, _, exitCode, _ := prtget.Run("isinst", packageName) + return exitCode == 0, nil +} + // RequestSupportForDistribution promts the user to submit a request to support their // currently unsupported distribution func RequestSupportForDistribution(distroInfo *DistroInfo) error { diff --git a/cmd/linuxdb.yaml b/cmd/linuxdb.yaml index 616ccd0f..13920279 100644 --- a/cmd/linuxdb.yaml +++ b/cmd/linuxdb.yaml @@ -307,3 +307,22 @@ distributions: gccversioncommand: *gccdumpfullversion programs: *opensusedefaultprograms libraries: *opensusedefaultlibraries + crux: + id: crux + releases: + default: + version: default + name: Crux Linux + gccversioncommand: *gccdumpversion + programs: + - name: gcc + help: Please install with `sudo prt-get depinst gcc-c++ make` and try again + - name: pkg-config + help: Please install with `sudo prt-get depinst pkg-config` and try again + - name: npm + help: Please install with `sudo prt-get depinst nodejs` and try again + libraries: + - name: gtk3 + help: Please install with `sudo prt-get depinst gtk3` and try again + - name: webkitgtk + help: Please install with `sudo prt-get depinst webkitgtk` and try again diff --git a/cmd/system.go b/cmd/system.go index ab3c9e5d..63839e32 100644 --- a/cmd/system.go +++ b/cmd/system.go @@ -286,6 +286,8 @@ func CheckDependencies(logger *Logger) (bool, error) { libraryChecker = XbpsInstalled case Solus: libraryChecker = EOpkgInstalled + case Crux: + libraryChecker = PrtGetInstalled default: return false, RequestSupportForDistribution(distroInfo) }