Check system for user installed Linux dependencies (#1180)

* [linux] Fix discovery of other deps

* Update v2/internal/system/system_linux.go

Co-authored-by: stffabi <stffabi@users.noreply.github.com>

* Try setting locale before running apt

* Use LC_ALL

* Remove continue

Co-authored-by: stffabi <stffabi@users.noreply.github.com>
This commit is contained in:
Lea Anthony
2022-03-15 20:25:23 +11:00
committed by GitHub
co-authored by stffabi
parent a278c9e164
commit d7395fc56a
3 changed files with 82 additions and 25 deletions
+23 -20
View File
@@ -8,6 +8,26 @@ import (
"github.com/wailsapp/wails/v2/internal/system/packagemanager"
)
func checkLocallyInstalled(checker func() *packagemanager.Dependancy, dependency *packagemanager.Dependancy) {
if !dependency.Installed {
locallyInstalled := checker()
if locallyInstalled.Installed {
dependency.Installed = true
dependency.Version = locallyInstalled.Version
}
}
}
var checkerFunctions = map[string]func() *packagemanager.Dependancy{
"npm": checkNPM,
"docker": checkDocker,
"upx": checkUPX,
"gcc": checkGCC,
"pkg-config": checkPkgConfig,
"libgtk-3": checkLibrary("libgtk-3"),
"libwebkit": checkLibrary("libwebkit"),
}
func (i *Info) discover() error {
var err error
@@ -24,26 +44,9 @@ func (i *Info) discover() error {
return err
}
for _, dep := range dependencies {
if dep.Name == "npm" {
locallyInstalled := checkNPM()
if locallyInstalled.Installed {
dep.Installed = true
dep.Version = locallyInstalled.Version
}
}
if dep.Name == "docker" {
locallyInstalled := checkDocker()
if locallyInstalled.Installed {
dep.Installed = true
dep.Version = locallyInstalled.Version
}
}
if dep.Name == "upx" {
locallyInstalled := checkUPX()
if locallyInstalled.Installed {
dep.Installed = true
dep.Version = locallyInstalled.Version
}
checker := checkerFunctions[dep.Name]
if checker != nil {
checkLocallyInstalled(checker, dep)
}
if dep.Name == "nsis" {
locallyInstalled := checkNSIS()