emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/crux f258bef9bb 3/6: Fix `sudo` not found error in OpenBSD


From: ELPA Syncer
Subject: [nongnu] elpa/crux f258bef9bb 3/6: Fix `sudo` not found error in OpenBSD and Alpine Linux (#93)
Date: Mon, 21 Nov 2022 03:58:59 -0500 (EST)

branch: elpa/crux
commit f258bef9bb09d93087b910868d3af3277f223205
Author: Kasim <oneness@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Fix `sudo` not found error in OpenBSD and Alpine Linux (#93)
    
    This comes handy for OpenBSD or Alpine linux users where doas is the
    replacement of sudo.
---
 CHANGELOG.md | 2 +-
 crux.el      | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 518ed8a3c4..2d98ae2d78 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,5 +30,5 @@
 
 * Fixed extra line issue when duplicating region.
 * Various small fixes that we were too lazy to document properly.
-
+* Fixed `sudo` not found in OpenBSD and Alpine Linux
 ## 0.3.0 (2016-05-31)
diff --git a/crux.el b/crux.el
index f39cc581fc..526b611b02 100644
--- a/crux.el
+++ b/crux.el
@@ -554,7 +554,9 @@ See `file-attributes' for more info."
         (remote-host (file-remote-p default-directory 'host))
         (remote-localname (file-remote-p filename 'localname)))
     (find-alternate-file (format "/%s:root@%s:%s"
-                                 (or remote-method "sudo")
+                                 (or remote-method (if (executable-find "doas")
+                                                      "doas"
+                                                    "sudo"))
                                  (or remote-host "localhost")
                                  (or remote-localname filename)))))
 
@@ -571,7 +573,9 @@ buffer is not visiting a file."
             (remote-host (file-remote-p default-directory 'host))
             (remote-localname (file-remote-p default-directory 'localname)))
         (find-file (format "/%s:root@%s:%s"
-                           (or remote-method "sudo")
+                           (or remote-method (if (executable-find "doas")
+                                                      "doas"
+                                                    "sudo"))
                            (or remote-host "localhost")
                            (or remote-localname
                                (read-file-name "Find file (as root): ")))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]