From 93539d2b6bdfa8c2a29e59cbd632b4b15249e848 Mon Sep 17 00:00:00 2001 From: purian23 Date: Sun, 21 Dec 2025 21:36:33 -0500 Subject: [PATCH] core: Debian Sid/OpenSuse Leap, Slowroll support --- core/internal/distros/debian.go | 2 ++ core/internal/distros/opensuse.go | 23 +++++++++++++++++++++-- core/internal/distros/osinfo.go | 17 ++++++++++++----- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/core/internal/distros/debian.go b/core/internal/distros/debian.go index 6372e2cc..12776594 100644 --- a/core/internal/distros/debian.go +++ b/core/internal/distros/debian.go @@ -384,6 +384,8 @@ func (d *DebianDistribution) enableOBSRepos(ctx context.Context, obsPkgs []Packa debianVersion := "Debian_13" if osInfo.VersionID == "testing" { debianVersion = "Debian_Testing" + } else if osInfo.VersionCodename == "sid" || osInfo.VersionID == "sid" || strings.Contains(strings.ToLower(osInfo.PrettyName), "sid") || strings.Contains(strings.ToLower(osInfo.PrettyName), "unstable") { + debianVersion = "Debian_Unstable" } for _, pkg := range obsPkgs { diff --git a/core/internal/distros/opensuse.go b/core/internal/distros/opensuse.go index 3465de99..5668b482 100644 --- a/core/internal/distros/opensuse.go +++ b/core/internal/distros/opensuse.go @@ -15,6 +15,12 @@ func init() { Register("opensuse-tumbleweed", "#73BA25", FamilySUSE, func(config DistroConfig, logChan chan<- string) Distribution { return NewOpenSUSEDistribution(config, logChan) }) + Register("opensuse-leap", "#73BA25", FamilySUSE, func(config DistroConfig, logChan chan<- string) Distribution { + return NewOpenSUSEDistribution(config, logChan) + }) + Register("opensuse-slowroll", "#73BA25", FamilySUSE, func(config DistroConfig, logChan chan<- string) Distribution { + return NewOpenSUSEDistribution(config, logChan) + }) } type OpenSUSEDistribution struct { @@ -434,6 +440,19 @@ func (o *OpenSUSEDistribution) extractPackageNames(packages []PackageMapping) [] func (o *OpenSUSEDistribution) enableOBSRepos(ctx context.Context, obsPkgs []PackageMapping, sudoPassword string, progressChan chan<- InstallProgressMsg) error { enabledRepos := make(map[string]bool) + osInfo, err := GetOSInfo() + if err != nil { + return fmt.Errorf("failed to get OS info: %w", err) + } + + obsDistroVersion := "openSUSE_Tumbleweed" + switch osInfo.Distribution.ID { + case "opensuse-leap": + obsDistroVersion = fmt.Sprintf("openSUSE_Leap_%s", osInfo.VersionID) + case "opensuse-slowroll": + obsDistroVersion = "openSUSE_Slowroll" + } + for _, pkg := range obsPkgs { if pkg.RepoURL != "" && !enabledRepos[pkg.RepoURL] { o.log(fmt.Sprintf("Enabling OBS repository: %s", pkg.RepoURL)) @@ -441,8 +460,8 @@ func (o *OpenSUSEDistribution) enableOBSRepos(ctx context.Context, obsPkgs []Pac // RepoURL format: "home:AvengeMedia:danklinux" repoPath := strings.ReplaceAll(pkg.RepoURL, ":", ":/") repoName := strings.ReplaceAll(pkg.RepoURL, ":", "-") - repoURL := fmt.Sprintf("https://download.opensuse.org/repositories/%s/openSUSE_Tumbleweed/%s.repo", - repoPath, pkg.RepoURL) + repoURL := fmt.Sprintf("https://download.opensuse.org/repositories/%s/%s/%s.repo", + repoPath, obsDistroVersion, pkg.RepoURL) checkCmd := exec.CommandContext(ctx, "zypper", "repos", repoName) if checkCmd.Run() == nil { diff --git a/core/internal/distros/osinfo.go b/core/internal/distros/osinfo.go index 90a86cf0..8fc4b25e 100644 --- a/core/internal/distros/osinfo.go +++ b/core/internal/distros/osinfo.go @@ -19,11 +19,12 @@ type DistroInfo struct { // OSInfo contains complete OS information type OSInfo struct { - Distribution DistroInfo - Version string - VersionID string - PrettyName string - Architecture string + Distribution DistroInfo + Version string + VersionID string + VersionCodename string + PrettyName string + Architecture string } // GetOSInfo detects the current OS and returns information about it @@ -72,6 +73,8 @@ func GetOSInfo() (*OSInfo, error) { info.VersionID = value case "VERSION": info.Version = value + case "VERSION_CODENAME": + info.VersionCodename = value case "PRETTY_NAME": info.PrettyName = value } @@ -100,6 +103,10 @@ func IsUnsupportedDistro(distroID, versionID string) bool { } if distroID == "debian" { + // unstable/sid support + if versionID == "sid" { + return false + } if versionID == "" { // debian testing/sid have no version ID return false