mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-03 20:32:07 -04:00
-Updated for Debian, Ubuntu, Fedora, and OpenSUSE - New shared minimal installation logic to streamline package handling across distros
45 lines
929 B
Go
45 lines
929 B
Go
package distros
|
|
|
|
type minimalInstallGroup struct {
|
|
packages []string
|
|
minimal bool
|
|
}
|
|
|
|
func shouldPreferMinimalInstall(pkg string) bool {
|
|
switch pkg {
|
|
case "niri", "niri-git":
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
func splitMinimalInstallPackages(packages []string) (normal []string, minimal []string) {
|
|
for _, pkg := range packages {
|
|
if shouldPreferMinimalInstall(pkg) {
|
|
minimal = append(minimal, pkg)
|
|
continue
|
|
}
|
|
normal = append(normal, pkg)
|
|
}
|
|
return normal, minimal
|
|
}
|
|
|
|
func orderedMinimalInstallGroups(packages []string) []minimalInstallGroup {
|
|
normal, minimal := splitMinimalInstallPackages(packages)
|
|
groups := make([]minimalInstallGroup, 0, 2)
|
|
if len(minimal) > 0 {
|
|
groups = append(groups, minimalInstallGroup{
|
|
packages: minimal,
|
|
minimal: true,
|
|
})
|
|
}
|
|
if len(normal) > 0 {
|
|
groups = append(groups, minimalInstallGroup{
|
|
packages: normal,
|
|
minimal: false,
|
|
})
|
|
}
|
|
return groups
|
|
}
|