mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
add archlinux support
This commit is contained in:
parent
67a1f23b13
commit
b015f27e14
3 changed files with 31 additions and 2 deletions
19
cmd/linux.go
19
cmd/linux.go
|
|
@ -10,9 +10,11 @@ type LinuxDistribution int
|
|||
|
||||
const (
|
||||
// Unknown is the catch-all distro
|
||||
Unknown LinuxDistribution = 0
|
||||
Unknown LinuxDistribution = iota
|
||||
// Ubuntu distribution
|
||||
Ubuntu LinuxDistribution = 1
|
||||
Ubuntu
|
||||
// Arch linux distribution
|
||||
Arch
|
||||
)
|
||||
|
||||
// DistroInfo contains all the information relating to a linux distribution
|
||||
|
|
@ -49,6 +51,8 @@ func GetLinuxDistroInfo() *DistroInfo {
|
|||
switch value {
|
||||
case "Ubuntu":
|
||||
result.Distribution = Ubuntu
|
||||
case "Arch":
|
||||
result.Distribution = Arch
|
||||
}
|
||||
case "Description":
|
||||
result.Description = value
|
||||
|
|
@ -75,3 +79,14 @@ func DpkgInstalled(packageName string) (bool, error) {
|
|||
_, _, exitCode, _ := dpkg.Run("-L", packageName)
|
||||
return exitCode == 0, nil
|
||||
}
|
||||
|
||||
// PacmanInstalled uses pacman to see if a package is installed.
|
||||
func PacmanInstalled(packageName string) (bool, error) {
|
||||
program := NewProgramHelper()
|
||||
pacman := program.FindProgram("pacman")
|
||||
if pacman == nil {
|
||||
return false, fmt.Errorf("cannot check dependencies: pacman not found")
|
||||
}
|
||||
_, _, exitCode, _ := pacman.Run("-Qs", packageName)
|
||||
return exitCode == 0, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,6 +97,9 @@ func getRequiredLibrariesLinux() (*Prerequisites, error) {
|
|||
case Ubuntu:
|
||||
result.Add(newPrerequisite("libgtk-3-dev", "Please install with `sudo apt install libgtk-3-dev` and try again"))
|
||||
result.Add(newPrerequisite("libwebkit2gtk-4.0-dev", "Please install with `sudo apt install libwebkit2gtk-4.0-dev` and try again"))
|
||||
case Arch:
|
||||
result.Add(newPrerequisite("gtk3", "Please install with `sudo pacman -S gtk3` and try again"))
|
||||
result.Add(newPrerequisite("webkit2gtk", "Please install with `sudo pacman -S webkit2gtk"))
|
||||
default:
|
||||
result.Add(newPrerequisite("libgtk-3-dev", "Please install with your system package manager and try again"))
|
||||
result.Add(newPrerequisite("libwebkit2gtk-4.0-dev", "Please install with your system package manager and try again"))
|
||||
|
|
|
|||
|
|
@ -272,6 +272,17 @@ func CheckDependencies(logger *Logger) (bool, error) {
|
|||
} else {
|
||||
logger.Green("Library '%s' installed.", library.Name)
|
||||
}
|
||||
case Arch:
|
||||
installed, err := PacmanInstalled(library.Name)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if !installed {
|
||||
errors = true
|
||||
logger.Red("Library '%s' not found. %s", library.Name, library.Help)
|
||||
} else {
|
||||
logger.Green("Library '%s' installed.", library.Name)
|
||||
}
|
||||
default:
|
||||
return false, fmt.Errorf("unable to check libraries on distribution '%s'. Please ensure that the '%s' equivalent is installed", distroInfo.DistributorID, library.Name)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue