mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-05 04:31:26 +08:00
Merge branch 'develop' of github.com:wailsapp/wails into develop
This commit is contained in:
commit
a5f9688708
@ -120,6 +120,9 @@ func parseOsRelease(osRelease string) *DistroInfo {
|
||||
return result
|
||||
}
|
||||
|
||||
// CheckPkgInstalled is all functions that use local programs to see if a package is installed
|
||||
type CheckPkgInstalled func(string) (bool, error)
|
||||
|
||||
// EqueryInstalled uses equery to see if a package is installed
|
||||
func EqueryInstalled(packageName string) (bool, error) {
|
||||
program := NewProgramHelper()
|
||||
@ -166,9 +169,9 @@ func RpmInstalled(packageName string) (bool, error) {
|
||||
|
||||
// RequestSupportForDistribution promts the user to submit a request to support their
|
||||
// currently unsupported distribution
|
||||
func RequestSupportForDistribution(distroInfo *DistroInfo, libraryName string) error {
|
||||
func RequestSupportForDistribution(distroInfo *DistroInfo) error {
|
||||
var logger = NewLogger()
|
||||
defaultError := fmt.Errorf("unable to check libraries on distribution '%s'. Please ensure that the '%s' equivalent is installed", distroInfo.Name, libraryName)
|
||||
defaultError := fmt.Errorf("unable to check libraries on distribution '%s'", distroInfo.Name)
|
||||
|
||||
logger.Yellow("Distribution '%s' is not currently supported, but we would love to!", distroInfo.Name)
|
||||
q := fmt.Sprintf("Would you like to submit a request to support distribution '%s'?", distroInfo.Name)
|
||||
|
@ -269,55 +269,33 @@ func CheckDependencies(logger *Logger) (bool, error) {
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
var libraryChecker CheckPkgInstalled
|
||||
distroInfo := GetLinuxDistroInfo()
|
||||
|
||||
switch distroInfo.Distribution {
|
||||
case Ubuntu, Debian, Zorin, Parrot, Linuxmint:
|
||||
libraryChecker = DpkgInstalled
|
||||
case Arch:
|
||||
libraryChecker = PacmanInstalled
|
||||
case CentOS, Fedora:
|
||||
libraryChecker = RpmInstalled
|
||||
case Gentoo:
|
||||
libraryChecker = EqueryInstalled
|
||||
default:
|
||||
return false, RequestSupportForDistribution(distroInfo)
|
||||
}
|
||||
|
||||
for _, library := range *requiredLibraries {
|
||||
switch distroInfo.Distribution {
|
||||
case Ubuntu, Debian, Zorin, Parrot, Linuxmint:
|
||||
installed, err := DpkgInstalled(library.Name)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if !installed {
|
||||
errors = true
|
||||
logger.Error("Library '%s' not found. %s", library.Name, library.Help)
|
||||
} 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.Error("Library '%s' not found. %s", library.Name, library.Help)
|
||||
} else {
|
||||
logger.Green("Library '%s' installed.", library.Name)
|
||||
}
|
||||
case CentOS, Fedora:
|
||||
installed, err := RpmInstalled(library.Name)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if !installed {
|
||||
errors = true
|
||||
logger.Error("Library '%s' not found. %s", library.Name, library.Help)
|
||||
} else {
|
||||
logger.Green("Library '%s' installed.", library.Name)
|
||||
}
|
||||
case Gentoo:
|
||||
installed, err := EqueryInstalled(library.Name)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if !installed {
|
||||
errors = true
|
||||
logger.Error("Library '%s' not found. %s", library.Name, library.Help)
|
||||
} else {
|
||||
logger.Green("Library '%s' installed.", library.Name)
|
||||
}
|
||||
default:
|
||||
return false, RequestSupportForDistribution(distroInfo, library.Name)
|
||||
installed, err := libraryChecker(library.Name)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if !installed {
|
||||
errors = true
|
||||
logger.Error("Library '%s' not found. %s", library.Name, library.Help)
|
||||
} else {
|
||||
logger.Green("Library '%s' installed.", library.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ func checkLibraries() (errors bool, err error) {
|
||||
logger.Green("Library '%s' installed.", library.Name)
|
||||
}
|
||||
default:
|
||||
return false, cmd.RequestSupportForDistribution(distroInfo, library.Name)
|
||||
return false, cmd.RequestSupportForDistribution(distroInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user