Subject: [PATCH] Add support for `doas` command.
From: Xi Lu <[email-masked]>
To: [email-masked]
Cc: Xi Lu <[email-masked]>
Date: Wed, 3 Feb 2016 17:19:33 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

In OpenBSD5.8, `sudo` has been replaced with b`doas`.
---
 lisp/net/tramp-sh.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 1f43747..11aa495 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -300,6 +300,13 @@ tramp-ssh-controlmaster-options
     (tramp-connection-timeout   10)))
 ;;;###tramp-autoload
 (add-to-list 'tramp-methods
+  '("doas"
+    (tramp-login-program        "doas")
+    (tramp-login-args           (("-u" "%u") ("-s")))
+    (tramp-remote-shell         "/bin/sh")
+    (tramp-connection-timeout   10)))
+;;;###tramp-autoload
+(add-to-list 'tramp-methods
   '("ksu"
     (tramp-login-program        "ksu")
     (tramp-login-args           (("%u") ("-q")))
@@ -401,7 +408,7 @@ tramp-ssh-controlmaster-options
 
 ;;;###tramp-autoload
 (add-to-list 'tramp-default-user-alist
-	     `(,(concat "\\`" (regexp-opt '("su" "sudo" "ksu")) "\\'")
+	     `(,(concat "\\`" (regexp-opt '("su" "sudo" "ksu" "doas")) "\\'")
 	       nil "root"))
 ;; Do not add "ssh" based methods, otherwise ~/.ssh/config would be ignored.
 ;; Do not add "plink" based methods, they ask interactively for the user.
@@ -471,6 +478,7 @@ tramp-completion-function-alist-putty
      (tramp-set-completion-function "nc" tramp-completion-function-alist-telnet)
      (tramp-set-completion-function "su" tramp-completion-function-alist-su)
      (tramp-set-completion-function "sudo" tramp-completion-function-alist-su)
+     (tramp-set-completion-function "doas" tramp-completion-function-alist-su)
      (tramp-set-completion-function "ksu" tramp-completion-function-alist-su)
      (tramp-set-completion-function
       "krlogin" tramp-completion-function-alist-rsh)
-- 
2.5.0