mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-05 04:19:45 +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
|
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
|
// EqueryInstalled uses equery to see if a package is installed
|
||||||
func EqueryInstalled(packageName string) (bool, error) {
|
func EqueryInstalled(packageName string) (bool, error) {
|
||||||
program := NewProgramHelper()
|
program := NewProgramHelper()
|
||||||
@ -166,9 +169,9 @@ func RpmInstalled(packageName string) (bool, error) {
|
|||||||
|
|
||||||
// RequestSupportForDistribution promts the user to submit a request to support their
|
// RequestSupportForDistribution promts the user to submit a request to support their
|
||||||
// currently unsupported distribution
|
// currently unsupported distribution
|
||||||
func RequestSupportForDistribution(distroInfo *DistroInfo, libraryName string) error {
|
func RequestSupportForDistribution(distroInfo *DistroInfo) error {
|
||||||
var logger = NewLogger()
|
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)
|
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)
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var libraryChecker CheckPkgInstalled
|
||||||
distroInfo := GetLinuxDistroInfo()
|
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 {
|
for _, library := range *requiredLibraries {
|
||||||
switch distroInfo.Distribution {
|
installed, err := libraryChecker(library.Name)
|
||||||
case Ubuntu, Debian, Zorin, Parrot, Linuxmint:
|
if err != nil {
|
||||||
installed, err := DpkgInstalled(library.Name)
|
return false, err
|
||||||
if err != nil {
|
}
|
||||||
return false, err
|
if !installed {
|
||||||
}
|
errors = true
|
||||||
if !installed {
|
logger.Error("Library '%s' not found. %s", library.Name, library.Help)
|
||||||
errors = true
|
} else {
|
||||||
logger.Error("Library '%s' not found. %s", library.Name, library.Help)
|
logger.Green("Library '%s' installed.", library.Name)
|
||||||
} 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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ func checkLibraries() (errors bool, err error) {
|
|||||||
logger.Green("Library '%s' installed.", library.Name)
|
logger.Green("Library '%s' installed.", library.Name)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return false, cmd.RequestSupportForDistribution(distroInfo, library.Name)
|
return false, cmd.RequestSupportForDistribution(distroInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user