Commit 1e92a8a3 authored by Michael Albinus's avatar Michael Albinus

* net/tramp.el (tramp-methods): Add docstring for `tramp-login-env'

  and `tramp-copy-env'.

* net/tramp-sh.el (tramp-methods) <sudo>: Add `tramp-login-env'.
  (tramp-maybe-open-connection): Handle `tramp-login-env'.
parent fef27dc1
2014-03-21 Michael Albinus <michael.albinus@gmx.de>
* net/tramp.el (tramp-methods): Add docstring for `tramp-login-env'
and `tramp-copy-env'.
* net/tramp-sh.el (tramp-methods) <sudo>: Add `tramp-login-env'.
(tramp-maybe-open-connection): Handle `tramp-login-env'.
2014-03-21 Glenn Morris <rgm@gnu.org> 2014-03-21 Glenn Morris <rgm@gnu.org>
* electric.el (electric-indent-post-self-insert-function): Add doc. * electric.el (electric-indent-post-self-insert-function): Add doc.
......
...@@ -227,6 +227,8 @@ detected as prompt when being sent on echoing hosts, therefore.") ...@@ -227,6 +227,8 @@ detected as prompt when being sent on echoing hosts, therefore.")
'("sudo" '("sudo"
(tramp-login-program "sudo") (tramp-login-program "sudo")
(tramp-login-args (("-u" "%u") ("-s") ("-H") ("-p" "Password:"))) (tramp-login-args (("-u" "%u") ("-s") ("-H") ("-p" "Password:")))
;; Local $SHELL could be a nasty one, like zsh or fish. Let's override it.
(tramp-login-env (("SHELL") ("/bin/sh")))
(tramp-remote-shell "/bin/sh") (tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c")) (tramp-remote-shell-args ("-c"))
(tramp-connection-timeout 10))) (tramp-connection-timeout 10)))
...@@ -4492,6 +4494,9 @@ connection if a previous connection has died for some reason." ...@@ -4492,6 +4494,9 @@ connection if a previous connection has died for some reason."
(login-args (login-args
(tramp-get-method-parameter (tramp-get-method-parameter
l-method 'tramp-login-args)) l-method 'tramp-login-args))
(login-env
(tramp-get-method-parameter
l-method 'tramp-login-env))
(async-args (async-args
(tramp-get-method-parameter (tramp-get-method-parameter
l-method 'tramp-async-args)) l-method 'tramp-async-args))
...@@ -4549,6 +4554,24 @@ connection if a previous connection has died for some reason." ...@@ -4549,6 +4554,24 @@ connection if a previous connection has died for some reason."
tramp-current-user (or g-user l-user) tramp-current-user (or g-user l-user)
tramp-current-host (or g-host l-host)) tramp-current-host (or g-host l-host))
;; Add login environment.
(when login-env
(setq
login-env
(mapcar
(lambda (x)
(setq x (mapcar (lambda (y) (format-spec y spec)) x))
(unless (member "" x) (mapconcat 'identity x " ")))
login-env))
(while login-env
(setq command
(format
"%s=%s %s"
(pop login-env)
(tramp-shell-quote-argument (pop login-env))
command)))
(setq command (concat "env " command)))
;; Replace `login-args' place holders. ;; Replace `login-args' place holders.
(setq (setq
l-host (or l-host "") l-host (or l-host "")
......
...@@ -230,6 +230,9 @@ pair of the form (KEY VALUE). The following KEYs are defined: ...@@ -230,6 +230,9 @@ pair of the form (KEY VALUE). The following KEYs are defined:
`tramp-make-tramp-temp-file'. \"%k\" indicates the keep-date `tramp-make-tramp-temp-file'. \"%k\" indicates the keep-date
parameter of a program, if exists. \"%c\" adds additional parameter of a program, if exists. \"%c\" adds additional
`tramp-ssh-controlmaster-options' options for the first hop. `tramp-ssh-controlmaster-options' options for the first hop.
* `tramp-login-env'
A list of environment variables and their values, which will
be set when calling `tramp-login-program'.
* `tramp-async-args' * `tramp-async-args'
When an asynchronous process is started, we know already that When an asynchronous process is started, we know already that
the connection works. Therefore, we can pass additional the connection works. Therefore, we can pass additional
...@@ -242,6 +245,9 @@ pair of the form (KEY VALUE). The following KEYs are defined: ...@@ -242,6 +245,9 @@ pair of the form (KEY VALUE). The following KEYs are defined:
* `tramp-copy-args' * `tramp-copy-args'
This specifies the list of parameters to pass to the above mentioned This specifies the list of parameters to pass to the above mentioned
program, the hints for `tramp-login-args' also apply here. program, the hints for `tramp-login-args' also apply here.
* `tramp-copy-env'
A list of environment variables and their values, which will
be set when calling `tramp-copy-program'.
* `tramp-copy-keep-date' * `tramp-copy-keep-date'
This specifies whether the copying program when the preserves the This specifies whether the copying program when the preserves the
timestamp of the original file. timestamp of the original file.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment