aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2024-05-12 19:40:08 +0200
committerMichael Albinus2024-05-12 19:40:08 +0200
commite53e8b4cf44be0fac0eb92c816b2c7915533e283 (patch)
tree5fbb35a339461b7e2ff5be2628368c61f7a776fc
parent2c759b9ce620311df97f43b791ba27b1302171c4 (diff)
downloademacs-e53e8b4cf44be0fac0eb92c816b2c7915533e283.tar.gz
emacs-e53e8b4cf44be0fac0eb92c816b2c7915533e283.zip
Add Tramp method "nspawn"
* doc/misc/tramp.texi: Adapt some markups. (Inline methods) <nspawn>: Add. (Default Host): Mention default host for "nspawn". (Customizing Methods): Remove tramp-nspawn. (Password handling): Add "nspawn". * etc/NEWS: New Tramp method "nspawn". * lisp/net/tramp-compat.el (tramp-nspawn): Warn, if that package is used. * lisp/net/tramp-container.el (tramp-nspawn-program): New defcustom. (tramp-nspawn-method): New defconst. (tramp-nspawn--completion-function, tramp-enable-nspawn-method): New defuns. * lisp/net/tramp.el (tramp-local-host-regexp): Add OpenSUSE host names.
-rw-r--r--doc/misc/tramp.texi95
-rw-r--r--etc/NEWS8
-rw-r--r--lisp/net/tramp-compat.el3
-rw-r--r--lisp/net/tramp-container.el64
-rw-r--r--lisp/net/tramp.el6
5 files changed, 124 insertions, 52 deletions
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 6c36429fb79..e5e2f3b243f 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -973,7 +973,12 @@ supports changing the remote login shell @command{/bin/sh}.
973 973
974Check the @samp{Share SSH connections if possible} control for that 974Check the @samp{Share SSH connections if possible} control for that
975session. 975session.
976@end table
977
978@noindent
979The following methods allow to access containers in different ways:
976 980
981@table @asis
977@item @option{docker} 982@item @option{docker}
978@cindex method @option{docker} 983@cindex method @option{docker}
979@cindex @option{docker} method 984@cindex @option{docker} method
@@ -1032,6 +1037,14 @@ name, as returned by @samp{apptainer instance list}.
1032This is an optional method, @ref{Optional methods}. It does not 1037This is an optional method, @ref{Optional methods}. It does not
1033support user names. 1038support user names.
1034 1039
1040@item @option{nspawn}
1041@cindex method @option{nspawn}
1042@cindex @option{nspawn} method
1043
1044Integration of @code{systemd-nspawn} instances. The host name is the
1045instance name, as returned by @samp{machinectl list --all}.
1046
1047This is an optional method, @ref{Optional methods}.
1035@end table 1048@end table
1036 1049
1037 1050
@@ -1256,9 +1269,9 @@ domain name). An example:
1256@trampfn{smb,daniel%BIZARRE@@melancholia,/daniel$$/.emacs} 1269@trampfn{smb,daniel%BIZARRE@@melancholia,/daniel$$/.emacs}
1257@end example 1270@end example
1258 1271
1259where user @code{daniel} connects as a domain user to the SMB host 1272where user @samp{daniel} connects as a domain user to the SMB host
1260@code{melancholia} in the MS Windows domain @code{BIZARRE} to edit 1273@samp{melancholia} in the MS Windows domain @samp{BIZARRE} to edit
1261@file{.emacs} located in the home directory (share @code{daniel$}). 1274@file{.emacs} located in the home directory (share @samp{daniel$}).
1262 1275
1263Alternatively, for local WINS users (as opposed to domain users), 1276Alternatively, for local WINS users (as opposed to domain users),
1264substitute the domain name with the name of the local host in 1277substitute the domain name with the name of the local host in
@@ -1268,9 +1281,9 @@ UPPERCASE as shown here:
1268@trampfn{smb,daniel%MELANCHOLIA@@melancholia,/daniel$$/.emacs} 1281@trampfn{smb,daniel%MELANCHOLIA@@melancholia,/daniel$$/.emacs}
1269@end example 1282@end example
1270 1283
1271where user @code{daniel} connects as local user to the SMB host 1284where user @samp{daniel} connects as local user to the SMB host
1272@code{melancholia} in the local domain @code{MELANCHOLIA} to edit 1285@samp{melancholia} in the local domain @samp{MELANCHOLIA} to edit
1273@file{.emacs} located in the home directory (share @code{daniel$}). 1286@file{.emacs} located in the home directory (share @samp{daniel$}).
1274 1287
1275The domain name and user name are optional for @command{smbclient} 1288The domain name and user name are optional for @command{smbclient}
1276authentication. When user name is not specified, @command{smbclient} 1289authentication. When user name is not specified, @command{smbclient}
@@ -1702,8 +1715,8 @@ follows:
1702@end group 1715@end group
1703@end lisp 1716@end lisp
1704 1717
1705With all defaults set, @samp{@trampfn{-,,}} will connect @value{tramp} 1718With all defaults set, @file{@trampfn{-,,}} will connect @value{tramp}
1706to John's home directory on @code{target} via @code{ssh}. 1719to John's home directory on @samp{target} via method @option{ssh}.
1707@end defopt 1720@end defopt
1708 1721
1709@defopt tramp-default-host-alist 1722@defopt tramp-default-host-alist
@@ -1712,6 +1725,10 @@ allows multiple default host values based on access method or user
1712name combinations. The alist can hold multiple values. While 1725name combinations. The alist can hold multiple values. While
1713@code{tramp-default-host} is sufficient in most cases, some methods, 1726@code{tramp-default-host} is sufficient in most cases, some methods,
1714like @option{adb}, require defaults overwritten. 1727like @option{adb}, require defaults overwritten.
1728
1729The default host name for @option{nspawn} is @samp{.host}. Therefore,
1730@file{@trampfn{nspawn,,}} and @file{@trampfn{sudo,,}} have the same
1731effect.
1715@end defopt 1732@end defopt
1716 1733
1717 1734
@@ -1938,17 +1955,6 @@ Access of a hadoop/hdfs file system. A file is accessed via
1938the user that you want to use, and @samp{node} is the name of the 1955the user that you want to use, and @samp{node} is the name of the
1939hadoop server. 1956hadoop server.
1940 1957
1941@item tramp-nspawn
1942@cindex method @option{nspawn}
1943@cindex @option{nspawn} method
1944Access to environments provided by systemd-nspawn. A file is accessed
1945via @file{@trampfn{nspawn,user@@container,/path/to/file}}, where
1946@samp{user} is the (optional) user that you want to use, and
1947@samp{container} is the container to connect to. systemd-nspawn and
1948its container utilities often require super user access to run, use
1949multi-hop file names with @option{doas} or @option{sudo} to raise your
1950privileges.
1951
1952@item vagrant-tramp 1958@item vagrant-tramp
1953@cindex method @option{vagrant} 1959@cindex method @option{vagrant}
1954@cindex @option{vagrant} method 1960@cindex @option{vagrant} method
@@ -2118,11 +2124,12 @@ file name syntax, must be appended to the machine and login items:
2118machine melancholia#4711 port davs login daniel%BIZARRE password geheim 2124machine melancholia#4711 port davs login daniel%BIZARRE password geheim
2119@end example 2125@end example
2120 2126
2121For the methods @option{doas}, @option{sudo} and @option{sudoedit} the 2127For the methods @option{doas}, @option{sudo}, @option{sudoedit} and
2122password of the user requesting the connection is needed, and not the 2128@option{nspawn} the password of the user requesting the connection is
2123password of the target user@footnote{On the local host, @code{run0} 2129needed, and not the password of the target user@footnote{On the local
2124uses a graphical password agent.}. If these connections happen on the 2130host, @code{run0} uses a graphical password agent.}. If these
2125local host, an entry with the local user and local host is used: 2131connections happen on the local host, an entry with the local user and
2132local host is used:
2126 2133
2127@example 2134@example
2128machine @var{host} port sudo login @var{user} password secret 2135machine @var{host} port sudo login @var{user} password secret
@@ -2701,8 +2708,8 @@ its execution of @command{/bin/sh} on the remote host because Bourne
2701shell does not recognize the export command as entered in 2708shell does not recognize the export command as entered in
2702@file{.profile}. 2709@file{.profile}.
2703 2710
2704Likewise, (@code{~}) character in paths will cause errors because 2711Likewise, (@samp{~}) character in paths will cause errors because
2705Bourne shell does not do (@code{~}) character expansions. 2712Bourne shell does not do (@samp{~}) character expansions.
2706 2713
2707One approach to avoiding these incompatibilities is to make all 2714One approach to avoiding these incompatibilities is to make all
2708commands in @file{~/.shrc} and @file{~/.profile} Bourne shell 2715commands in @file{~/.shrc} and @file{~/.profile} Bourne shell
@@ -3417,7 +3424,7 @@ configuration option will be selected, it can be @t{"--standard"}
3417or @t{"--paranoia"}. See the @samp{encfs(1)} man page for details. 3424or @t{"--paranoia"}. See the @samp{encfs(1)} man page for details.
3418 3425
3419However, @value{tramp} must adapt these configuration sets. The 3426However, @value{tramp} must adapt these configuration sets. The
3420@code{chainedNameIV} configuration option must be disabled; otherwise 3427@option{chainedNameIV} configuration option must be disabled; otherwise
3421@value{tramp} couldn't handle file name encryption transparently. 3428@value{tramp} couldn't handle file name encryption transparently.
3422@end defopt 3429@end defopt
3423 3430
@@ -3536,7 +3543,7 @@ on the remote host @var{host}, using the method @var{method}.
3536@table @file 3543@table @file
3537@item @value{prefix}ssh@value{postfixhop}melancholia@value{postfix}.emacs 3544@item @value{prefix}ssh@value{postfixhop}melancholia@value{postfix}.emacs
3538For the file @file{.emacs} located in the home directory, on the host 3545For the file @file{.emacs} located in the home directory, on the host
3539@code{melancholia}, using method @code{ssh}. 3546@samp{melancholia}, using method @option{ssh}.
3540 3547
3541@item @value{prefix}ssh@value{postfixhop}melancholia.danann.net@value{postfix}.emacs 3548@item @value{prefix}ssh@value{postfixhop}melancholia.danann.net@value{postfix}.emacs
3542For the file @file{.emacs} specified using the fully qualified domain name of 3549For the file @file{.emacs} specified using the fully qualified domain name of
@@ -3546,12 +3553,12 @@ the host.
3546For the file @file{.emacs} specified using the @file{~}, which is expanded. 3553For the file @file{.emacs} specified using the @file{~}, which is expanded.
3547 3554
3548@item @value{prefix}ssh@value{postfixhop}melancholia@value{postfix}~daniel/.emacs 3555@item @value{prefix}ssh@value{postfixhop}melancholia@value{postfix}~daniel/.emacs
3549For the file @file{.emacs} located in @code{daniel}'s home directory 3556For the file @file{.emacs} located in @samp{daniel}'s home directory
3550on the host, @code{melancholia}. The @file{~<user>} construct is 3557on the host, @samp{melancholia}. The @file{~<user>} construct is
3551expanded to the home directory of that user on the remote host. 3558expanded to the home directory of that user on the remote host.
3552 3559
3553@item @value{prefix}ssh@value{postfixhop}melancholia@value{postfix}/etc/squid.conf 3560@item @value{prefix}ssh@value{postfixhop}melancholia@value{postfix}/etc/squid.conf
3554For the file @file{/etc/squid.conf} on the host @code{melancholia}. 3561For the file @file{/etc/squid.conf} on the host @samp{melancholia}.
3555 3562
3556@end table 3563@end table
3557 3564
@@ -3569,8 +3576,8 @@ different name using the proper syntax will override this default
3569behavior: @file{@trampfn{method,user@@host,path/to/file}}. 3576behavior: @file{@trampfn{method,user@@host,path/to/file}}.
3570 3577
3571@file{@trampfn{ssh,daniel@@melancholia,.emacs}} is for file 3578@file{@trampfn{ssh,daniel@@melancholia,.emacs}} is for file
3572@file{.emacs} in @code{daniel}'s home directory on the host, 3579@file{.emacs} in @samp{daniel}'s home directory on the host,
3573@code{melancholia}, accessing via method @code{ssh}. 3580@samp{melancholia}, accessing via method @option{ssh}.
3574 3581
3575For specifying port numbers, affix @file{#<port>} to the host 3582For specifying port numbers, affix @file{#<port>} to the host
3576name. For example: @file{@trampfn{ssh,daniel@@melancholia#42,.emacs}}. 3583name. For example: @file{@trampfn{ssh,daniel@@melancholia#42,.emacs}}.
@@ -3603,8 +3610,8 @@ names. Beside the @code{default} value, @var{syntax} can be
3603 3610
3604This remote file name syntax is similar to the syntax used by Ange FTP@. 3611This remote file name syntax is similar to the syntax used by Ange FTP@.
3605A remote file name has the form 3612A remote file name has the form
3606@code{@value{prefix}user@@host@value{postfix}path/to/file}. The 3613@file{@value{prefix}user@@host@value{postfix}path/to/file}. The
3607@code{user@@} part is optional, and the method is determined by 3614@samp{user@@} part is optional, and the method is determined by
3608@ref{Default Method}. 3615@ref{Default Method}.
3609 3616
3610@item @code{separate} 3617@item @code{separate}
@@ -3615,8 +3622,8 @@ A remote file name has the form
3615@include trampver.texi 3622@include trampver.texi
3616This remote file name syntax originated in the XEmacs text editor. 3623This remote file name syntax originated in the XEmacs text editor.
3617A remote file name has the form 3624A remote file name has the form
3618@code{@trampfn{method,user@@host,path/to/file}}. The @code{method} 3625@file{@trampfn{method,user@@host,path/to/file}}. The @samp{method}
3619and @code{user@@} parts are optional. 3626and @samp{user@@} parts are optional.
3620@clear separate 3627@clear separate
3621@set unified 3628@set unified
3622@include trampver.texi 3629@include trampver.texi
@@ -3799,12 +3806,12 @@ Ad-hoc proxies can take patterns @code{%h} or @code{%u} like in
3799@code{tramp-default-proxies-alist}. The following file name expands 3806@code{tramp-default-proxies-alist}. The following file name expands
3800to user @samp{root} on host @samp{remotehost}, starting with an 3807to user @samp{root} on host @samp{remotehost}, starting with an
3801@option{ssh} session on host @samp{remotehost}: 3808@option{ssh} session on host @samp{remotehost}:
3802@samp{@trampfn{ssh@value{postfixhop}%h|su,remotehost,}}. 3809@file{@trampfn{ssh@value{postfixhop}%h|su,remotehost,}}.
3803 3810
3804On the other hand, if a trailing hop does not specify a host name, the 3811On the other hand, if a trailing hop does not specify a host name, the
3805host name of the previous hop is reused. Therefore, the following 3812host name of the previous hop is reused. Therefore, the following
3806file name is equivalent to the previous example: 3813file name is equivalent to the previous example:
3807@samp{@trampfn{ssh@value{postfixhop}remotehost|su,,}}. 3814@file{@trampfn{ssh@value{postfixhop}remotehost|su,,}}.
3808 3815
3809@defopt tramp-completion-multi-hop-methods 3816@defopt tramp-completion-multi-hop-methods
3810When this list includes the last method in a multi-hop connection, the 3817When this list includes the last method in a multi-hop connection, the
@@ -3831,8 +3838,8 @@ The buffer must either visit a file, or a directory
3831 3838
3832@defopt tramp-file-name-with-method 3839@defopt tramp-file-name-with-method
3833The method @code{tramp-revert-buffer-with-sudo} shows an alternate 3840The method @code{tramp-revert-buffer-with-sudo} shows an alternate
3834buffer. It defaults to @code{sudo}, other valid methods are 3841buffer. It defaults to @option{sudo}, other valid methods are
3835@code{su}, @code{doas}, @code{run0}, and @code{ksu}. 3842@option{su}, @option{doas}, @option{run0}, and @option{ksu}.
3836 3843
3837@lisp 3844@lisp
3838(customize-set-variable 'tramp-file-name-with-method "doas") 3845(customize-set-variable 'tramp-file-name-with-method "doas")
@@ -4066,7 +4073,7 @@ follows in the local @file{.emacs} file:
4066local host that the remote host can redirect X11 window 4073local host that the remote host can redirect X11 window
4067interactions. If querying for a recognizable name is not possible for 4074interactions. If querying for a recognizable name is not possible for
4068whatever reason, then replace @code{(getenv "DISPLAY")} with a 4075whatever reason, then replace @code{(getenv "DISPLAY")} with a
4069hard-coded, fixed name. Note that using @code{:0} for X11 display name 4076hard-coded, fixed name. Note that using @samp{:0} for X11 display name
4070here will not work as expected. 4077here will not work as expected.
4071 4078
4072@vindex ForwardX11@r{, ssh option} 4079@vindex ForwardX11@r{, ssh option}
@@ -4638,7 +4645,7 @@ specifies the target to be applied for renaming buffer file names from
4638source via @code{tramp-rename-files}. @code{source} is a regular 4645source via @code{tramp-rename-files}. @code{source} is a regular
4639expressions, which matches a remote file name. @code{target} must be 4646expressions, which matches a remote file name. @code{target} must be
4640a directory name, which could be remote (including remote directories 4647a directory name, which could be remote (including remote directories
4641@value{tramp} infers by default, such as @samp{@trampfn{method,user@@host,}}). 4648@value{tramp} infers by default, such as @file{@trampfn{method,user@@host,}}).
4642 4649
4643@code{target} can contain the patterns @code{%m}, @code{%u} or 4650@code{target} can contain the patterns @code{%m}, @code{%u} or
4644@code{%h}, which are replaced by the method name, user name or host 4651@code{%h}, which are replaced by the method name, user name or host
@@ -4667,7 +4674,7 @@ ssh@value{postfixhop}%h@value{postfix}")
4667@end lisp 4674@end lisp
4668 4675
4669routes all connections to a host in @samp{company.org} via 4676routes all connections to a host in @samp{company.org} via
4670@samp{@trampfn{ssh,multi.hop,}}, which might be useful when using 4677@file{@trampfn{ssh,multi.hop,}}, which might be useful when using
4671Emacs outside the company network. 4678Emacs outside the company network.
4672 4679
4673@lisp 4680@lisp
diff --git a/etc/NEWS b/etc/NEWS
index 846bf759995..cb7c62a7876 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1079,9 +1079,11 @@ This connection method is similar to "sudo", but it uses the
1079These are the external methods counterparts of "docker" and "podman". 1079These are the external methods counterparts of "docker" and "podman".
1080 1080
1081+++ 1081+++
1082*** New optional connection methods "toolbox", "flatpak" and "apptainer". 1082*** New optional connection methods for containers.
1083They allow accessing system containers provided by Toolbox, sandboxes 1083Tere are new optional connection methods "toolbox", "flatpak",
1084provided by Flatpak, or instances managed by Apptainer. 1084"apptainer" and "nspawn". They allow accessing system containers
1085provided by Toolbox, sandboxes provided by Flatpak, instances managed by
1086Apptainer, or accessing systemd-based light-weight containers..
1085 1087
1086+++ 1088+++
1087*** Connection method "kubernetes" supports now optional container name. 1089*** Connection method "kubernetes" supports now optional container name.
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index d7492be63f2..26c2049fbae 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -55,6 +55,9 @@
55(with-eval-after-load 'kubernetes-tramp 55(with-eval-after-load 'kubernetes-tramp
56 (warn (concat "Package `kubernetes-tramp' has been obsoleted, " 56 (warn (concat "Package `kubernetes-tramp' has been obsoleted, "
57 "please use integrated package `tramp-container'"))) 57 "please use integrated package `tramp-container'")))
58(with-eval-after-load 'tramp-nspawn
59 (warn (concat "Package `tramp-nspawn' has been obsoleted, "
60 "please use integrated package `tramp-container'")))
58 61
59;; For not existing functions, obsolete functions, or functions with a 62;; For not existing functions, obsolete functions, or functions with a
60;; changed argument list, there are compiler warnings. We want to 63;; changed argument list, there are compiler warnings. We want to
diff --git a/lisp/net/tramp-container.el b/lisp/net/tramp-container.el
index 902fc6a451b..3d15d71d709 100644
--- a/lisp/net/tramp-container.el
+++ b/lisp/net/tramp-container.el
@@ -81,8 +81,8 @@
81;; C-x C-f /flatpak:SANDBOX:/path/to/file 81;; C-x C-f /flatpak:SANDBOX:/path/to/file
82;; 82;;
83;; Where: 83;; Where:
84;; SANDBOX is the running sandbox to connect to. 84;; SANDBOX is the running sandbox to connect to.
85;; It could be an application ID, an instance ID, or a PID. 85;; It could be an application ID, an instance ID, or a PID.
86;; 86;;
87;; 87;;
88;; 88;;
@@ -91,7 +91,17 @@
91;; C-x C-f /apptainer:INSTANCE:/path/to/file 91;; C-x C-f /apptainer:INSTANCE:/path/to/file
92;; 92;;
93;; Where: 93;; Where:
94;; INSTANCE is the running instance to connect to. 94;; INSTANCE is the running instance to connect to.
95;;
96;;
97;;
98;; Open a file on a running systemd-nspawn container:
99;;
100;; C-x C-f /nspawn:USER@CONTAINER:/path/to/file
101;;
102;; Where:
103;; USER is the user on the container to connect as (optional)
104;; CONTAINER is the container to connect to
95 105
96;;; Code: 106;;; Code:
97 107
@@ -159,6 +169,13 @@ If it is nil, the default context will be used."
159 :type '(choice (const "apptainer") 169 :type '(choice (const "apptainer")
160 (string))) 170 (string)))
161 171
172(defcustom tramp-nspawn-program "machinectl"
173 "Name of the machinectl program."
174 :group 'tramp
175 :version "30.1"
176 :type '(choice (const "machinectl")
177 (string)))
178
162;;;###tramp-autoload 179;;;###tramp-autoload
163(defconst tramp-docker-method "docker" 180(defconst tramp-docker-method "docker"
164 "Tramp method name to use to connect to Docker containers.") 181 "Tramp method name to use to connect to Docker containers.")
@@ -194,6 +211,10 @@ This is for out-of-band connections.")
194 "Tramp method name to use to connect to Apptainer instances.") 211 "Tramp method name to use to connect to Apptainer instances.")
195 212
196;;;###tramp-autoload 213;;;###tramp-autoload
214(defconst tramp-nspawn-method "nspawn"
215 "Tramp method name to use to connect to systemd-nspawn containers.")
216
217;;;###tramp-autoload
197(defmacro tramp-skeleton-completion-function (method &rest body) 218(defmacro tramp-skeleton-completion-function (method &rest body)
198 "Skeleton for `tramp-*-completion-function' with multi-hop support. 219 "Skeleton for `tramp-*-completion-function' with multi-hop support.
199BODY is the backend specific code." 220BODY is the backend specific code."
@@ -416,6 +437,21 @@ see its function help for a description of the format."
416 lines))) 437 lines)))
417 (mapcar (lambda (name) (list nil name)) names)))) 438 (mapcar (lambda (name) (list nil name)) names))))
418 439
440(defun tramp-nspawn--completion-function (method)
441 "List systemd-nspawn containers available for connection.
442
443This function is used by `tramp-set-completion-function', please
444see its function help for a description of the format."
445 (tramp-skeleton-completion-function method
446 (when-let ((raw-list
447 (shell-command-to-string (concat program " list --all -q")))
448 ;; Ignore header line.
449 (lines (cdr (split-string raw-list "\n")))
450 (first-words (mapcar (lambda (line) (car (split-string line)))
451 lines))
452 (machines (seq-take-while (lambda (name) name) first-words)))
453 (mapcar (lambda (m) (list nil m)) machines))))
454
419;;;###tramp-autoload 455;;;###tramp-autoload
420(defvar tramp-default-remote-shell) ;; Silence byte compiler. 456(defvar tramp-default-remote-shell) ;; Silence byte compiler.
421 457
@@ -580,6 +616,28 @@ see its function help for a description of the format."
580 tramp-apptainer-method 616 tramp-apptainer-method
581 `((tramp-apptainer--completion-function ,tramp-apptainer-method)))) 617 `((tramp-apptainer--completion-function ,tramp-apptainer-method))))
582 618
619;; todo: check tramp-async-args and tramp-direct-async
620;;;###tramp-autoload
621(defun tramp-enable-nspawn-method ()
622 "Enable connection to nspawn containers."
623 (add-to-list 'tramp-methods
624 `(,tramp-nspawn-method
625 (tramp-login-program ,tramp-nspawn-program)
626 (tramp-login-args (("shell")
627 ("-q")
628 ("--uid" "%u")
629 ("%h")))
630 (tramp-remote-shell ,tramp-default-remote-shell)
631 (tramp-remote-shell-login ("-l"))
632 (tramp-remote-shell-args ("-i" "-c"))))
633
634 (add-to-list 'tramp-default-host-alist `(,tramp-nspawn-method nil ".host"))
635 (add-to-list 'tramp-completion-multi-hop-methods tramp-nspawn-method)
636
637 (tramp-set-completion-function
638 tramp-nspawn-method
639 `((tramp-nspawn--completion-function ,tramp-nspawn-method))))
640
583;; Default connection-local variables for Tramp. 641;; Default connection-local variables for Tramp.
584 642
585(defconst tramp-kubernetes-connection-local-default-variables 643(defconst tramp-kubernetes-connection-local-default-variables
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 02a493f0a78..5bb1ab66175 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -562,11 +562,13 @@ host runs a restricted shell, it shall be added to this list, too."
562 ;; Fedora. 562 ;; Fedora.
563 "localhost4" "localhost6" 563 "localhost4" "localhost6"
564 ;; Ubuntu. 564 ;; Ubuntu.
565 "ip6-localhost" "ip6-loopback")) 565 "ip6-localhost" "ip6-loopback"
566 ;; OpenSUSE.
567 "ipv6-localhost" "ipv6-loopback"))
566 eos) 568 eos)
567 "Host names which are regarded as local host. 569 "Host names which are regarded as local host.
568If the local host runs a chrooted environment, set this to nil." 570If the local host runs a chrooted environment, set this to nil."
569 :version "29.3" 571 :version "30.1"
570 :type '(choice (const :tag "Chrooted environment" nil) 572 :type '(choice (const :tag "Chrooted environment" nil)
571 (regexp :tag "Host regexp"))) 573 (regexp :tag "Host regexp")))
572 574