From 18901c7cdeb572b95d355d636ea49e6818bb0755 Mon Sep 17 00:00:00 2001 From: bbedward Date: Mon, 6 Apr 2026 10:09:55 -0400 Subject: [PATCH] core: migrate to dms-shell arch package --- core/cmd/dms/commands_features.go | 31 ++++++++++++++-- core/internal/distros/arch.go | 57 ++++-------------------------- core/internal/tui/views_install.go | 2 +- 3 files changed, 35 insertions(+), 55 deletions(-) diff --git a/core/cmd/dms/commands_features.go b/core/cmd/dms/commands_features.go index e1acc421..7ec54375 100644 --- a/core/cmd/dms/commands_features.go +++ b/core/cmd/dms/commands_features.go @@ -109,16 +109,41 @@ func updateArchLinux() error { } var packageName string - if isArchPackageInstalled("dms-shell-bin") { - packageName = "dms-shell-bin" + var isAUR bool + if isArchPackageInstalled("dms-shell") { + packageName = "dms-shell" } else if isArchPackageInstalled("dms-shell-git") { packageName = "dms-shell-git" + isAUR = true + } else if isArchPackageInstalled("dms-shell-bin") { + packageName = "dms-shell-bin" + isAUR = true } else { - fmt.Println("Info: Neither dms-shell-bin nor dms-shell-git package found.") + fmt.Println("Info: No dms-shell package found.") fmt.Println("Info: Falling back to git-based update method...") return updateOtherDistros() } + if !isAUR { + fmt.Printf("This will update %s using pacman.\n", packageName) + if !confirmUpdate() { + return errdefs.ErrUpdateCancelled + } + + fmt.Printf("\nRunning: sudo pacman -S %s\n", packageName) + cmd := exec.Command("sudo", "pacman", "-S", "--noconfirm", packageName) + cmd.Stdin = os.Stdin + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + if err := cmd.Run(); err != nil { + fmt.Printf("Error: Failed to update using pacman: %v\n", err) + return err + } + + fmt.Println("dms successfully updated") + return nil + } + var helper string var updateCmd *exec.Cmd diff --git a/core/internal/distros/arch.go b/core/internal/distros/arch.go index 785e901d..7321b289 100644 --- a/core/internal/distros/arch.go +++ b/core/internal/distros/arch.go @@ -242,11 +242,7 @@ func (a *ArchDistribution) getDMSMapping(variant deps.PackageVariant) PackageMap return PackageMapping{Name: "dms-shell-git", Repository: RepoTypeAUR} } - if a.packageInstalled("dms-shell-bin") { - return PackageMapping{Name: "dms-shell-bin", Repository: RepoTypeAUR} - } - - return PackageMapping{Name: "dms-shell-bin", Repository: RepoTypeAUR} + return PackageMapping{Name: "dms-shell", Repository: RepoTypeSystem} } func (a *ArchDistribution) detectXwaylandSatellite() deps.Dependency { @@ -540,7 +536,7 @@ func (a *ArchDistribution) reorderAURPackages(packages []string) []string { var dmsShell []string for _, pkg := range packages { - if pkg == "dms-shell-git" || pkg == "dms-shell-bin" { + if pkg == "dms-shell-git" { dmsShell = append(dmsShell, pkg) } else { isDep := false @@ -621,7 +617,7 @@ func (a *ArchDistribution) installSingleAURPackageInternal(ctx context.Context, } } - if pkg == "dms-shell-git" || pkg == "dms-shell-bin" { + if pkg == "dms-shell-git" { srcinfoPath := filepath.Join(packageDir, ".SRCINFO") depsToRemove := []string{ "depends = quickshell", @@ -644,15 +640,7 @@ func (a *ArchDistribution) installSingleAURPackageInternal(ctx context.Context, } srcinfoPath = filepath.Join(packageDir, ".SRCINFO") - if pkg == "dms-shell-bin" { - progressChan <- InstallProgressMsg{ - Phase: PhaseAURPackages, - Progress: startProgress + 0.35*(endProgress-startProgress), - Step: fmt.Sprintf("Skipping dependency installation for %s (manually managed)...", pkg), - IsComplete: false, - LogOutput: fmt.Sprintf("Dependencies for %s are installed separately", pkg), - } - } else { + { progressChan <- InstallProgressMsg{ Phase: PhaseAURPackages, Progress: startProgress + 0.3*(endProgress-startProgress), @@ -739,42 +727,9 @@ func (a *ArchDistribution) installSingleAURPackageInternal(ctx context.Context, CommandInfo: "sudo pacman -U built-package", } - // Find .pkg.tar* files - for split packages, install the base and any installed compositor variants var files []string - if pkg == "dms-shell-git" || pkg == "dms-shell-bin" { - // For DMS split packages, install base package - pattern := filepath.Join(packageDir, fmt.Sprintf("%s-%s*.pkg.tar*", pkg, "*")) - matches, err := filepath.Glob(pattern) - if err == nil { - for _, match := range matches { - basename := filepath.Base(match) - // Always include base package - if !strings.Contains(basename, "hyprland") && !strings.Contains(basename, "niri") { - files = append(files, match) - } - } - } - - // Also update compositor-specific packages if they're installed - if strings.HasSuffix(pkg, "-git") { - if a.packageInstalled("dms-shell-hyprland-git") { - hyprlandPattern := filepath.Join(packageDir, "dms-shell-hyprland-git-*.pkg.tar*") - if hyprlandMatches, err := filepath.Glob(hyprlandPattern); err == nil && len(hyprlandMatches) > 0 { - files = append(files, hyprlandMatches[0]) - } - } - if a.packageInstalled("dms-shell-niri-git") { - niriPattern := filepath.Join(packageDir, "dms-shell-niri-git-*.pkg.tar*") - if niriMatches, err := filepath.Glob(niriPattern); err == nil && len(niriMatches) > 0 { - files = append(files, niriMatches[0]) - } - } - } - } else { - // For other packages, install all built packages - matches, _ := filepath.Glob(filepath.Join(packageDir, "*.pkg.tar*")) - files = matches - } + matches, _ := filepath.Glob(filepath.Join(packageDir, "*.pkg.tar*")) + files = matches if len(files) == 0 { return fmt.Errorf("no package files found after building %s", pkg) diff --git a/core/internal/tui/views_install.go b/core/internal/tui/views_install.go index c61c3373..41bef1f3 100644 --- a/core/internal/tui/views_install.go +++ b/core/internal/tui/views_install.go @@ -139,7 +139,7 @@ func dmsPackageName(distroID string, dependencies []deps.Dependency) string { if isGit { return "dms-shell-git" } - return "dms-shell-bin" + return "dms-shell" case distros.FamilyFedora, distros.FamilyUbuntu, distros.FamilyDebian, distros.FamilySUSE: if isGit { return "dms-git"