nixpkgs/pkgs/desktops/deepin/go-package/dde-daemon/0003-aviod-use-hardcode-path.diff
2024-08-15 08:57:13 +08:00

93 lines
3.8 KiB
Diff

diff --git a/accounts1/user.go b/accounts1/user.go
index 8101d9c6..16c7f15f 100644
--- a/accounts1/user.go
+++ b/accounts1/user.go
@@ -482,7 +482,7 @@ func (u *User) checkIsControlCenter(sender dbus.Sender) bool {
return false
}
- if exe == controlCenterPath {
+ if strings.Contains(exe, "dde-control-center") {
return true
}
diff --git a/accounts1/user_chpwd_union_id.go b/accounts1/user_chpwd_union_id.go
index 61a691d9..47d2163e 100644
--- a/accounts1/user_chpwd_union_id.go
+++ b/accounts1/user_chpwd_union_id.go
@@ -89,14 +89,13 @@ func newCaller(service *dbusutil.Service, sender dbus.Sender) (ret *caller, err
// 只允许来自控制中心, 锁屏和 greetter 的调用
var app string
- switch exe {
- case "/usr/bin/dde-control-center":
+ if (strings.Contains(exe, "dde-control-center")) {
app = "control-center"
- case "/usr/bin/dde-lock":
+ } else if (strings.Contains(exe, "dde-lock")) {
app = "lock"
- case "/usr/bin/lightdm-deepin-greeter":
+ } else if (strings.Contains(exe, "lightdm-deepin-greeter")) {
app = "greeter"
- default:
+ } else {
err = fmt.Errorf("set password with Union ID called by %s, which is not allow", exe)
return
}
diff --git a/bin/dde-authority/fprint_transaction.go b/bin/dde-authority/fprint_transaction.go
index ca2951a0..3223ad25 100644
--- a/bin/dde-authority/fprint_transaction.go
+++ b/bin/dde-authority/fprint_transaction.go
@@ -461,7 +461,7 @@ func (tx *FPrintTransaction) End(sender dbus.Sender) *dbus.Error {
func killFPrintDaemon() {
logger.Debug("kill fprintd")
- err := exec.Command("pkill", "-f", "/usr/lib/fprintd/fprintd").Run()
+ err := exec.Command("pkill", "fprintd").Run()
if err != nil {
logger.Warning("failed to kill fprintd:", err)
}
diff --git a/grub2/grub2.go b/grub2/grub2.go
index 085b7157..10cb8256 100644
--- a/grub2/grub2.go
+++ b/grub2/grub2.go
@@ -603,7 +603,7 @@ func checkInvokePermission(service *dbusutil.Service, sender dbus.Sender) error
if err != nil {
return err
}
- if cmd == "/usr/bin/dde-control-center" {
+ if strings.Contains(cmd, "dde-control-center") {
return nil
}
uid, err := service.GetConnUID(string(sender))
diff --git a/misc/etc/acpi/powerbtn.sh b/misc/etc/acpi/powerbtn.sh
index 5c536b9e..39c28987 100755
--- a/misc/etc/acpi/powerbtn.sh
+++ b/misc/etc/acpi/powerbtn.sh
@@ -58,4 +58,4 @@ elif test "$XUSER" != "" && test -x /usr/bin/qdbus; then
fi
# If all else failed, just initiate a plain shutdown.
-/sbin/shutdown -h now "Power button pressed"
+shutdown -h now "Power button pressed"
diff --git a/misc/udev-rules/80-deepin-fprintd.rules b/misc/udev-rules/80-deepin-fprintd.rules
index 7063a40c..c4c6103a 100644
--- a/misc/udev-rules/80-deepin-fprintd.rules
+++ b/misc/udev-rules/80-deepin-fprintd.rules
@@ -1 +1 @@
-SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_interface", ACTION=="add|remove", ENV{LIBFPRINT_DRIVER}!="", RUN+="/usr/bin/dbus-send --system --dest=org.deepin.dde.Fprintd1 --print-reply /org/deepin/dde/Fprintd1 org.deepin.dde.Fprintd1.TriggerUDevEvent"
+SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_interface", ACTION=="add|remove", ENV{LIBFPRINT_DRIVER}!="", RUN+="@dbus@/bin/dbus-send --system --dest=org.deepin.dde.Fprintd1 --print-reply /org/deepin/dde/Fprintd1 org.deepin.dde.Fprintd1.TriggerUDevEvent"
diff --git a/system/display/displaycfg.go b/system/display/displaycfg.go
index cda69a77..e394ae07 100644
--- a/system/display/displaycfg.go
+++ b/system/display/displaycfg.go
@@ -255,7 +255,7 @@ func (d *Display) doDetectSupportWayland(sender dbus.Sender) (bool, error) {
return false, err
}
var cmd *exec.Cmd
- if execPath == "/usr/bin/lightdm-deepin-greeter" {
+ if strings.Contains(execPath, "lightdm-deepin-greeter") {
cmd = exec.Command("runuser", "-u", "lightdm", "glxinfo") // runuser -u lightdm glxinfo
} else {
cmd = exec.Command("glxinfo")