diff --git a/core/cmd/dms/commands_features.go b/core/cmd/dms/commands_features.go index ce5ee83da..7ec21080d 100644 --- a/core/cmd/dms/commands_features.go +++ b/core/cmd/dms/commands_features.go @@ -128,14 +128,18 @@ func updateArchLinux() error { var packageName string var isAUR bool - if isArchPackageInstalled("dms-shell") { - packageName = "dms-shell" + // AUR names first: pacman -Q matches provides, and dux-shell-git provides dms-shell. + if isArchPackageInstalled("dux-shell-git") { + packageName = "dux-shell-git" + isAUR = true } 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 if isArchPackageInstalled("dms-shell") { + packageName = "dms-shell" } else { fmt.Println("Info: No dms-shell package found.") fmt.Println("Info: Falling back to git-based update method...") diff --git a/core/cmd/dms/commands_greeter.go b/core/cmd/dms/commands_greeter.go index 89d4caecd..b2d0850c6 100644 --- a/core/cmd/dms/commands_greeter.go +++ b/core/cmd/dms/commands_greeter.go @@ -67,7 +67,7 @@ func greeterPackageInstallHint() string { case distros.FamilyFedora: return "Install with 'sudo dnf install dms-greeter' (requires COPR: sudo dnf copr enable avengemedia/danklinux)" case distros.FamilyArch: - return "Install from AUR with 'paru -S greetd-dms-greeter-bin' or 'yay -S greetd-dms-greeter-bin'" + return "Install from AUR with 'paru -S dux-greeter-bin' or 'yay -S dux-greeter-bin'" case distros.FamilyVoid: return "Install with 'sudo xbps-install -S dms-greeter' (requires DMS XBPS repo: echo 'repository=" + distros.VoidDMSRepo + "' | sudo tee /etc/xbps.d/dms.conf)" default: diff --git a/core/install.sh b/core/install.sh index 4bbcc7c7e..8e4b8c6f7 100755 --- a/core/install.sh +++ b/core/install.sh @@ -52,8 +52,14 @@ cd "$TEMP_DIR" || exit 1 # Download the gzipped binary and its checksum printf "%bDownloading installer...%b\n" "$GREEN" "$NC" -curl -L "https://github.com/duxlabs-dev/dux-shell/releases/download/$LATEST_VERSION/duxinstall-$ARCH.gz" -o "installer.gz" -curl -L "https://github.com/duxlabs-dev/dux-shell/releases/download/$LATEST_VERSION/duxinstall-$ARCH.gz.sha256" -o "expected.sha256" +RELEASE_URL="https://github.com/duxlabs-dev/dux-shell/releases/download/$LATEST_VERSION" +# install.duxlabs.dev serves this file from master; releases before 2.0.1 only ship dankinstall-*.gz +ASSET="duxinstall-$ARCH.gz" +if ! curl -fsLI "$RELEASE_URL/$ASSET" >/dev/null; then + ASSET="dankinstall-$ARCH.gz" +fi +curl -fL "$RELEASE_URL/$ASSET" -o "installer.gz" +curl -fL "$RELEASE_URL/$ASSET.sha256" -o "expected.sha256" # Get the expected checksum EXPECTED_CHECKSUM=$(awk '{print $1}' expected.sha256) diff --git a/core/internal/distros/arch.go b/core/internal/distros/arch.go index 4bf2eb771..b53510c7a 100644 --- a/core/internal/distros/arch.go +++ b/core/internal/distros/arch.go @@ -1,6 +1,7 @@ package distros import ( + "cmp" "context" "fmt" "os" @@ -128,7 +129,7 @@ func (a *ArchDistribution) DetectDependenciesWithTerminal(ctx context.Context, w func (a *ArchDistribution) detectDanksearch() deps.Dependency { dep := a.BaseDistribution.detectDanksearch() dep.CanToggle = true - if a.packageInstalled("dsearch-git") { + if a.packageInstalled("dux-search-git") { dep.Variant = deps.VariantGit } return dep @@ -136,14 +137,14 @@ func (a *ArchDistribution) detectDanksearch() deps.Dependency { func (a *ArchDistribution) detectDMS() deps.Dependency { dep := a.BaseDistribution.detectDMS() - if a.packageInstalled("dms-shell-git") { + if a.packageInstalled("dux-shell-git") { dep.Variant = deps.VariantGit } return dep } func (a *ArchDistribution) detectDankCalendar() deps.Dependency { - return withGitVariant(a.BaseDistribution.detectDankCalendar(), a.packageInstalled("dankcalendar-git")) + return withGitVariant(a.BaseDistribution.detectDankCalendar(), a.packageInstalled("dux-calendar-git")) } func (a *ArchDistribution) detectXDGPortal() deps.Dependency { @@ -155,19 +156,40 @@ func (a *ArchDistribution) detectAccountsService() deps.Dependency { } func (a *ArchDistribution) detectDMSGreeter() deps.Dependency { - installed := a.packageInstalled("greetd-dms-greeter-git") || a.packageInstalled("greetd-dms-greeter-bin") + installed := a.packageInstalled("dux-greeter-git") || a.packageInstalled("dux-greeter-bin") dep := a.detectOptionalPackage("dms-greeter", "Dux Shell greetd greeter", installed) dep.CanToggle = true - if a.packageInstalled("greetd-dms-greeter-git") { + if a.packageInstalled("dux-greeter-git") { dep.Variant = deps.VariantGit } return dep } +// AUR packages renamed for Dux; installs from before the rename keep the old name. +var legacyAURNames = map[string]string{ + "dux-shell-git": "dms-shell-git", + "dux-greeter-bin": "greetd-dms-greeter-bin", + "dux-greeter-git": "greetd-dms-greeter-git", + "dux-search-bin": "dsearch-bin", + "dux-search-git": "dsearch-git", + "dux-calendar-bin": "dankcalendar-bin", + "dux-calendar-git": "dankcalendar-git", +} + func (a *ArchDistribution) packageInstalled(pkg string) bool { - cmd := exec.Command("pacman", "-Q", pkg) - err := cmd.Run() - return err == nil + return a.installedName(pkg) != "" +} + +// installedName returns the name pkg is installed under, which may be its pre-rename name. +func (a *ArchDistribution) installedName(pkg string) string { + if exec.Command("pacman", "-Q", pkg).Run() == nil { + return pkg + } + legacy, ok := legacyAURNames[pkg] + if ok && exec.Command("pacman", "-Q", legacy).Run() == nil { + return legacy + } + return "" } // parseSRCINFODeps reads a .SRCINFO file and returns runtime dep and makedep package @@ -286,28 +308,28 @@ func (a *ArchDistribution) getMatugenMapping(variant deps.PackageVariant) Packag func (a *ArchDistribution) getDanksearchMapping(variant deps.PackageVariant) PackageMapping { if variant == deps.VariantGit { - return PackageMapping{Name: "dsearch-git", Repository: RepoTypeAUR} + return PackageMapping{Name: "dux-search-git", Repository: RepoTypeAUR} } - return PackageMapping{Name: "dsearch-bin", Repository: RepoTypeAUR} + return PackageMapping{Name: "dux-search-bin", Repository: RepoTypeAUR} } func (a *ArchDistribution) getDankCalendarMapping(variant deps.PackageVariant) PackageMapping { if variant == deps.VariantGit { - return PackageMapping{Name: "dankcalendar-git", Repository: RepoTypeAUR} + return PackageMapping{Name: "dux-calendar-git", Repository: RepoTypeAUR} } - return PackageMapping{Name: "dankcalendar-bin", Repository: RepoTypeAUR} + return PackageMapping{Name: "dux-calendar-bin", Repository: RepoTypeAUR} } func (a *ArchDistribution) getDMSGreeterMapping(variant deps.PackageVariant) PackageMapping { if variant == deps.VariantGit { - return PackageMapping{Name: "greetd-dms-greeter-git", Repository: RepoTypeAUR} + return PackageMapping{Name: "dux-greeter-git", Repository: RepoTypeAUR} } - return PackageMapping{Name: "greetd-dms-greeter-bin", Repository: RepoTypeAUR} + return PackageMapping{Name: "dux-greeter-bin", Repository: RepoTypeAUR} } func (a *ArchDistribution) getDMSMapping(variant deps.PackageVariant) PackageMapping { if forceDMSGit || variant == deps.VariantGit { - return PackageMapping{Name: "dms-shell-git", Repository: RepoTypeAUR} + return PackageMapping{Name: "dux-shell-git", Repository: RepoTypeAUR} } return PackageMapping{Name: "dms-shell", Repository: RepoTypeSystem} } @@ -587,7 +609,8 @@ func (a *ArchDistribution) SwapVariants(ctx context.Context, swaps []VariantSwap } if swap.To.Repository == RepoTypeAUR { - if err := a.installSingleAURPackageInternal(ctx, swap.To.Name, swap.From.Name, sudoPassword, progressChan, 0.40, 0.85, make(map[string]bool)); err != nil { + from := cmp.Or(a.installedName(swap.From.Name), swap.From.Name) + if err := a.installSingleAURPackageInternal(ctx, swap.To.Name, from, sudoPassword, progressChan, 0.40, 0.85, make(map[string]bool)); err != nil { return err } continue @@ -658,7 +681,7 @@ func (a *ArchDistribution) installAURPackages(ctx context.Context, packages []st } } - // Reorder packages to ensure dms-shell-git dependencies are installed first + // Reorder packages to ensure dux-shell-git dependencies are installed first orderedPackages := a.reorderAURPackages(packages) baseProgress := 0.67 @@ -699,7 +722,7 @@ func (a *ArchDistribution) reorderAURPackages(packages []string) []string { var dmsShell []string for _, pkg := range packages { - if pkg == "dms-shell-git" { + if pkg == "dux-shell-git" { dmsShell = append(dmsShell, pkg) } else { isDep := false @@ -781,7 +804,7 @@ func (a *ArchDistribution) installSingleAURPackageInternal(ctx context.Context, } } - if pkg == "dms-shell-git" { + if pkg == "dux-shell-git" { srcinfoPath := filepath.Join(packageDir, ".SRCINFO") depsToRemove := []string{ "depends = quickshell", diff --git a/core/internal/server/sysupdate/shell.go b/core/internal/server/sysupdate/shell.go index c09f13d43..eaaa2e213 100644 --- a/core/internal/server/sysupdate/shell.go +++ b/core/internal/server/sysupdate/shell.go @@ -18,6 +18,7 @@ const ownerQueryTimeout = 10 * time.Second var dmsPackageNames = map[string]bool{ "dms": true, "dms-git": true, "dms-shell": true, "dms-shell-git": true, "dms-shell-bin": true, + "dux-shell-git": true, } // Arch/Debian/SUSE: 1.7.0+git4915.56234761; Fedora COPR: 0.0.git.4915.56234761 diff --git a/core/internal/tui/views_install.go b/core/internal/tui/views_install.go index c4244af50..f862e78bc 100644 --- a/core/internal/tui/views_install.go +++ b/core/internal/tui/views_install.go @@ -123,7 +123,7 @@ func dmsPackageName(distroID string, dependencies []deps.Dependency) string { switch config.Family { case distros.FamilyArch: if isGit { - return "dms-shell-git" + return "dux-shell-git" } return "dms-shell" case distros.FamilyFedora, distros.FamilyUbuntu, distros.FamilyDebian, distros.FamilySUSE, distros.FamilyVoid: