mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-28 14:07:47 -04:00
lock: arm fingerprint auth after the compositor confirms the lock
port 2.0
(cherry picked from commit 2804183b7f)
This commit is contained in:
1 parent
0acaaa4b44
commit
10008104ce
7 files changed
+25
-60
No files matched your search
@@ -128,20 +128,14 @@ func updateArchLinux() error {
|
||||
|
||||
var packageName string
|
||||
var isAUR bool
|
||||
// AUR names first: pacman -Q matches provides, and dux-shell-git provides dms-shell.
|
||||
// AUR name first: pacman -Q matches provides, and dux-shell-git provides dux-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 if isArchPackageInstalled("dux-shell") {
|
||||
packageName = "dux-shell"
|
||||
} else {
|
||||
fmt.Println("Info: No dms-shell package found.")
|
||||
fmt.Println("Info: No dux-shell package found.")
|
||||
fmt.Println("Info: Falling back to git-based update method...")
|
||||
return updateOtherDistros()
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package distros
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
@@ -165,31 +164,8 @@ func (a *ArchDistribution) detectDMSGreeter() deps.Dependency {
|
||||
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 {
|
||||
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 ""
|
||||
return exec.Command("pacman", "-Q", pkg).Run() == nil
|
||||
}
|
||||
|
||||
// parseSRCINFODeps reads a .SRCINFO file and returns runtime dep and makedep package
|
||||
@@ -292,7 +268,7 @@ func (a *ArchDistribution) getMangoMapping(variant deps.PackageVariant) PackageM
|
||||
if variant == deps.VariantGit {
|
||||
return PackageMapping{Name: "mangowm-git", Repository: RepoTypeAUR}
|
||||
}
|
||||
return PackageMapping{Name: "mangowm", Repository: RepoTypeAUR}
|
||||
return PackageMapping{Name: "mangowm", Repository: RepoTypeSystem}
|
||||
}
|
||||
|
||||
func (a *ArchDistribution) getMatugenMapping(variant deps.PackageVariant) PackageMapping {
|
||||
@@ -331,7 +307,7 @@ func (a *ArchDistribution) getDMSMapping(variant deps.PackageVariant) PackageMap
|
||||
if forceDMSGit || variant == deps.VariantGit {
|
||||
return PackageMapping{Name: "dux-shell-git", Repository: RepoTypeAUR}
|
||||
}
|
||||
return PackageMapping{Name: "dms-shell", Repository: RepoTypeSystem}
|
||||
return PackageMapping{Name: "dux-shell", Repository: RepoTypeSystem}
|
||||
}
|
||||
|
||||
func (a *ArchDistribution) detectXwaylandSatellite() deps.Dependency {
|
||||
@@ -418,7 +394,7 @@ func (a *ArchDistribution) InstallPackages(ctx context.Context, dependencies []d
|
||||
|
||||
systemPkgs, aurPkgs, manualPkgs, variantMap := a.categorizePackages(dependencies, wm, reinstallFlags, skipFlags)
|
||||
|
||||
if slices.Contains(aurPkgs, "quickshell-git") && slices.Contains(systemPkgs, "dms-shell") {
|
||||
if slices.Contains(aurPkgs, "quickshell-git") && slices.Contains(systemPkgs, "dux-shell") {
|
||||
if err := a.preinstallQuickshellGit(ctx, sudoPassword, progressChan); err != nil {
|
||||
return fmt.Errorf("failed to preinstall quickshell-git: %w", err)
|
||||
}
|
||||
@@ -588,7 +564,7 @@ func (a *ArchDistribution) preinstallQuickshellGit(ctx context.Context, sudoPass
|
||||
Progress: 0.18,
|
||||
Step: "Building quickshell-git before system packages...",
|
||||
IsComplete: false,
|
||||
CommandInfo: "Installing quickshell-git ahead of dms-shell to avoid conflict",
|
||||
CommandInfo: "Installing quickshell-git ahead of dux-shell to avoid conflict",
|
||||
}
|
||||
return a.installSingleAURPackage(ctx, "quickshell-git", sudoPassword, progressChan, 0.18, 0.32)
|
||||
}
|
||||
@@ -609,7 +585,7 @@ func (a *ArchDistribution) SwapVariants(ctx context.Context, swaps []VariantSwap
|
||||
}
|
||||
|
||||
if swap.To.Repository == RepoTypeAUR {
|
||||
from := cmp.Or(a.installedName(swap.From.Name), swap.From.Name)
|
||||
from := 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
|
||||
}
|
||||
@@ -631,11 +607,7 @@ func (a *ArchDistribution) installSystemPackages(ctx context.Context, packages [
|
||||
|
||||
a.log(fmt.Sprintf("Installing system packages: %s", strings.Join(packages, ", ")))
|
||||
|
||||
args := []string{"pacman", "-S", "--needed", "--noconfirm"}
|
||||
if slices.Contains(packages, "dms-shell") {
|
||||
args = append(args, "--assume-installed", "dms-shell-compositor=1")
|
||||
}
|
||||
args = append(args, packages...)
|
||||
args := append([]string{"pacman", "-S", "--needed", "--noconfirm"}, packages...)
|
||||
|
||||
progressChan <- InstallProgressMsg{
|
||||
Phase: PhaseSystemPackages,
|
||||
@@ -806,15 +778,16 @@ func (a *ArchDistribution) installSingleAURPackageInternal(ctx context.Context,
|
||||
|
||||
if pkg == "dux-shell-git" {
|
||||
srcinfoPath := filepath.Join(packageDir, ".SRCINFO")
|
||||
depsToRemove := []string{
|
||||
"depends = quickshell",
|
||||
"depends = dgop",
|
||||
// extra ships dgop only as dux-gop (provides dgop), which makepkg resolves but pacman -Si does not
|
||||
srcinfoEdits := []string{
|
||||
"/depends = quickshell/d",
|
||||
`s/^\(\s*depends = \)dgop$/\1dux-gop/`,
|
||||
}
|
||||
|
||||
for _, dep := range depsToRemove {
|
||||
sedCmd := exec.CommandContext(ctx, "sed", "-i", fmt.Sprintf("/%s/d", dep), srcinfoPath)
|
||||
for _, edit := range srcinfoEdits {
|
||||
sedCmd := exec.CommandContext(ctx, "sed", "-i", edit, srcinfoPath)
|
||||
if err := sedCmd.Run(); err != nil {
|
||||
return fmt.Errorf("failed to remove dependency %s from .SRCINFO for %s: %w", dep, pkg, err)
|
||||
return fmt.Errorf("failed to patch .SRCINFO for %s: %w", pkg, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,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,
|
||||
"dux-shell": true, "dux-shell-git": true,
|
||||
}
|
||||
|
||||
// Arch/Debian/SUSE: 1.7.0+git4915.56234761; Fedora COPR: 0.0.git.4915.56234761
|
||||
@@ -115,7 +114,7 @@ func packageOwner(ctx context.Context, path string) (InstallMethod, string, stri
|
||||
|
||||
switch {
|
||||
case commandExists("pacman"):
|
||||
// "/usr/bin/dms is owned by dms-shell-git 1.7.0+git4915-1"
|
||||
// "/usr/bin/dms is owned by dux-shell-git 2.0.0+git4915-1"
|
||||
out := runOutput(ctx, "pacman", "-Qo", path)
|
||||
fields := strings.Fields(out)
|
||||
if len(fields) < 2 {
|
||||
|
||||
@@ -85,11 +85,11 @@ func TestDetectChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFindShellPackagePrefersOwner(t *testing.T) {
|
||||
pkgs := []Package{{Name: "dms-shell"}, {Name: "dms-shell-git"}, {Name: "firefox"}}
|
||||
if got := findShellPackage(pkgs, "dms-shell-git"); got == nil || got.Name != "dms-shell-git" {
|
||||
pkgs := []Package{{Name: "dux-shell"}, {Name: "dux-shell-git"}, {Name: "firefox"}}
|
||||
if got := findShellPackage(pkgs, "dux-shell-git"); got == nil || got.Name != "dux-shell-git" {
|
||||
t.Errorf("owner match = %v", got)
|
||||
}
|
||||
if got := findShellPackage(pkgs, ""); got == nil || got.Name != "dms-shell" {
|
||||
if got := findShellPackage(pkgs, ""); got == nil || got.Name != "dux-shell" {
|
||||
t.Errorf("fallback = %v", got)
|
||||
}
|
||||
if got := findShellPackage([]Package{{Name: "firefox"}}, "dms"); got != nil {
|
||||
|
||||
@@ -125,7 +125,7 @@ func dmsPackageName(distroID string, dependencies []deps.Dependency) string {
|
||||
if isGit {
|
||||
return "dux-shell-git"
|
||||
}
|
||||
return "dms-shell"
|
||||
return "dux-shell"
|
||||
case distros.FamilyFedora, distros.FamilyUbuntu, distros.FamilyDebian, distros.FamilySUSE, distros.FamilyVoid:
|
||||
if isGit {
|
||||
return "dms-git"
|
||||
|
||||
@@ -284,7 +284,7 @@ Scope {
|
||||
|
||||
Pam {
|
||||
id: sharedPam
|
||||
lockSecured: root.shouldLock
|
||||
lockSecured: root.shouldLock && sessionLock.secure
|
||||
buffer: root.sharedPasswordBuffer
|
||||
onUnlockRequested: root.unlock()
|
||||
}
|
||||
|
||||
@@ -73,7 +73,6 @@ FocusScope {
|
||||
|
||||
Component.onCompleted: {
|
||||
WeatherService.addRef();
|
||||
UserInfoService.getUserInfo();
|
||||
|
||||
lockerReadyArmed = true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user