mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
Update tramp-androidsu
* doc/misc/tramp.texi (Quick Start Guide): Remove documentation pertaining to tramp-androidsu.el. (Inline methods): Document it here instead. * lisp/net/tramp-androidsu.el (tramp-androidsu-mount-global-namespace) (tramp-androidsu-remote-path, tramp-androidsu-local-shell-name) (tramp-androidsu-local-tmp-directory, add-to-list) (tramp-androidsu-maybe-open-connection) (tramp-androidsu-handle-access-file) (tramp-androidsu-handle-add-name-to-file) (tramp-androidsu-handle-copy-directory) (tramp-androidsu-sh-handle-copy-file) (tramp-androidsu-handle-copy-file) (tramp-androidsu-adb-handle-delete-directory) (tramp-androidsu-handle-delete-directory) (tramp-androidsu-adb-handle-delete-file) (tramp-androidsu-handle-delete-file) (tramp-androidsu-handle-directory-file-name) (tramp-androidsu-handle-directory-files) (tramp-androidsu-adb-handle-directory-files-and-attributes) (tramp-androidsu-handle-directory-files-and-attributes) (tramp-androidsu-handle-dired-uncache) (tramp-androidsu-adb-handle-exec-path) (tramp-androidsu-handle-exec-path) (tramp-androidsu-handle-expand-file-name) (tramp-androidsu-handle-file-accessible-directory-p) (tramp-androidsu-adb-handle-file-attributes) (tramp-androidsu-handle-file-attributes) (tramp-androidsu-handle-file-directory-p) (tramp-androidsu-handle-file-equal-p) (tramp-androidsu-adb-handle-file-executable-p) (tramp-androidsu-handle-file-executable-p) (tramp-androidsu-adb-handle-file-exists-p) (tramp-androidsu-handle-file-exists-p) (tramp-androidsu-handle-file-group-gid) (tramp-androidsu-handle-file-in-directory-p) (tramp-androidsu-sh-handle-file-local-copy) (tramp-androidsu-handle-file-local-copy) (tramp-androidsu-handle-file-locked-p) (tramp-androidsu-handle-file-modes) (tramp-androidsu-adb-handle-file-name-all-completions) (tramp-androidsu-handle-file-name-all-completions) (tramp-androidsu-handle-file-name-as-directory) (tramp-androidsu-handle-file-name-case-insensitive-p) (tramp-androidsu-handle-file-name-completion) (tramp-androidsu-handle-file-name-directory) (tramp-androidsu-handle-file-name-nondirectory) (tramp-androidsu-handle-file-newer-than-file-p) (tramp-androidsu-handle-file-notify-add-watch) (tramp-androidsu-handle-file-notify-rm-watch) (tramp-androidsu-handle-file-notify-valid-p) (tramp-androidsu-adb-handle-file-readable-p) (tramp-androidsu-handle-file-readable-p) (tramp-androidsu-handle-file-regular-p) (tramp-androidsu-handle-file-remote-p) (tramp-androidsu-handle-file-selinux-context) (tramp-androidsu-handle-file-symlink-p) (tramp-androidsu-adb-handle-file-system-info) (tramp-androidsu-handle-file-system-info) (tramp-androidsu-handle-file-truename) (tramp-androidsu-handle-file-user-uid) (tramp-androidsu-adb-handle-file-writable-p) (tramp-androidsu-handle-file-writable-p) (tramp-androidsu-handle-find-backup-file-name) (tramp-androidsu-handle-insert-directory) (tramp-androidsu-handle-insert-file-contents) (tramp-androidsu-handle-list-system-processes) (tramp-androidsu-handle-load, tramp-androidsu-handle-lock-file) (tramp-androidsu-handle-make-auto-save-file-name) (tramp-androidsu-adb-handle-make-directory) (tramp-androidsu-handle-make-directory) (tramp-androidsu-handle-make-lock-file-name) (tramp-androidsu-handle-make-nearby-temp-file) (tramp-androidsu-make-process) (tramp-androidsu-sh-handle-make-symbolic-link) (tramp-androidsu-handle-make-symbolic-link) (tramp-androidsu-handle-memory-info) (tramp-androidsu-handle-process-attributes) (tramp-androidsu-adb-handle-process-file) (tramp-androidsu-handle-process-file) (tramp-androidsu-sh-handle-rename-file) (tramp-androidsu-handle-rename-file) (tramp-androidsu-adb-handle-set-file-modes) (tramp-androidsu-handle-set-file-modes) (tramp-androidsu-adb-handle-set-file-times) (tramp-androidsu-handle-set-file-times) (tramp-androidsu-handle-set-visited-file-modtime) (tramp-androidsu-handle-shell-command) (tramp-androidsu-handle-start-file-process) (tramp-androidsu-handle-substitute-in-file-name) (tramp-androidsu-handle-temporary-file-directory) (tramp-androidsu-adb-handle-get-remote-gid) (tramp-androidsu-handle-get-remote-gid) (tramp-androidsu-adb-handle-get-remote-groups) (tramp-androidsu-handle-get-remote-groups) (tramp-androidsu-adb-handle-get-remote-uid) (tramp-androidsu-handle-get-remote-uid) (tramp-androidsu-handle-unlock-file) (tramp-androidsu-handle-verify-visited-file-modtime) (tramp-androidsu-sh-handle-write-region) (tramp-androidsu-handle-write-region) (tramp-androidsu-file-name-handler-alist): Make hard-coded executable and file names defconsts, remove redundant wrapper functions and remove names of wrapped functions from their wrappers.
This commit is contained in:
parent
445f376e4e
commit
f5c65dae09
2 changed files with 152 additions and 272 deletions
|
|
@ -510,7 +510,6 @@ default host name. Therefore, it is convenient to open a file as
|
|||
The method @option{sg} stands for ``switch group''; here the user name
|
||||
is used as the group to change to. The default host name is the same.
|
||||
|
||||
|
||||
@anchor{Quick Start Guide Combining ssh, plink, su, sudo and doas methods}
|
||||
@section Combining @option{ssh} or @option{plink} with @option{su}, @option{sudo} or @option{doas}
|
||||
@cindex method @option{ssh}
|
||||
|
|
@ -523,8 +522,6 @@ is used as the group to change to. The default host name is the same.
|
|||
@cindex @option{sudo} method
|
||||
@cindex method @option{doas}
|
||||
@cindex @option{doas} method
|
||||
@cindex method @option{androidsu}
|
||||
@cindex @option{androidsu} method
|
||||
|
||||
If the @option{su}, @option{sudo} or @option{doas} option should be
|
||||
performed on another host, it can be combined with a leading
|
||||
|
|
@ -535,12 +532,6 @@ a simple case, the syntax looks like
|
|||
@file{@trampfn{ssh@value{postfixhop}user@@host|sudo,,/path/to/file}}.
|
||||
@xref{Ad-hoc multi-hops}.
|
||||
|
||||
The @option{su} method and other shell-based methods conflict with
|
||||
non-standard @command{su} implementations popular among Android users
|
||||
and the restricted command-line utilities distributed with that system.
|
||||
The @option{androidsu} method enables accessing files through
|
||||
@command{su} on such systems, but multi-hops are not supported.
|
||||
|
||||
@anchor{Quick Start Guide sudoedit method}
|
||||
@section Using @command{sudoedit}
|
||||
@cindex method @option{sudoedit}
|
||||
|
|
@ -826,6 +817,16 @@ editing as another user. The host can be either @samp{localhost} or
|
|||
the host returned by the function @command{(system-name)}. See
|
||||
@ref{Multi-hops} for an exception to this behavior.
|
||||
|
||||
@cindex method @option{androidsu}
|
||||
@cindex @option{androidsu} method
|
||||
Because the default implementation of the @option{su} method and other
|
||||
shell-based methods conflict with non-standard @command{su}
|
||||
implementations popular among Android users and the restricted
|
||||
command-line utilities distributed with that system, a largely
|
||||
equivalent @option{androidsu} method is provided for that system with
|
||||
workarounds for its many idiosyncrasies, with the exception that
|
||||
multi-hops are unsupported.
|
||||
|
||||
@item @option{sudo}
|
||||
@cindex method @option{sudo}
|
||||
@cindex @option{sudo} method
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
;;; tramp-androidsu.el --- TRAMP method for Android superuser shells -*- lexical-binding:t -*-
|
||||
;;; tramp-androidsu.el --- Tramp method for Android superuser shells -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Po Lu
|
||||
;; Keywords: comm, processes
|
||||
;; Package: tramp
|
||||
|
||||
|
|
@ -22,12 +23,15 @@
|
|||
|
||||
;;; Commentary:
|
||||
|
||||
;; `su' method implementation for Android.
|
||||
;;
|
||||
;; The `su' method struggles (as do other shell-based methods) with the
|
||||
;; crippled versions of many Unix utilities installed on Android,
|
||||
;; workarounds for which are implemented in the `adb' method. This
|
||||
;; method defines a shell-based method that is identical in function to
|
||||
;; `su', but reuses such code from the `adb' method where applicable and
|
||||
;; also provides for certain mannerisms of popular Android `su'
|
||||
;; and replaces if connecting to a local Android machine `su', but
|
||||
;; reuses such code from the `adb' method where applicable and also
|
||||
;; provides for certain mannerisms of popular Android `su'
|
||||
;; implementations.
|
||||
|
||||
;;; Code:
|
||||
|
|
@ -43,33 +47,51 @@
|
|||
;;;###tramp-autoload
|
||||
(defcustom tramp-androidsu-mount-global-namespace t
|
||||
"When non-nil, browse files from within the global mount namespace.
|
||||
On systems that assign each application a unique view of the filesystem
|
||||
by executing them within individual mount namespaces and thus conceal
|
||||
each application's data directories from others, invoke `su' with the
|
||||
option `-mm' in order for the shell launched to run within the global
|
||||
mount namespace, so that TRAMP may edit files belonging to any and all
|
||||
applications."
|
||||
On systems that assign each application a unique view of the
|
||||
filesystem by executing them within individual mount namespaces
|
||||
and thus conceal each application's data directories from
|
||||
others, invoke `su' with the option `-mm' in order for the shell
|
||||
launched to run within the global mount namespace, so that Tramp
|
||||
may edit files belonging to any and all applications."
|
||||
:group 'tramp
|
||||
:version "30.1"
|
||||
:type 'boolean)
|
||||
|
||||
;;;###tramp-autoload
|
||||
(defcustom tramp-androidsu-remote-path '("/system/bin"
|
||||
"/system/xbin")
|
||||
"Directories in which to search for transfer programs and the like."
|
||||
:group 'tramp
|
||||
:version "30.1"
|
||||
:type '(list string))
|
||||
|
||||
(defvar tramp-androidsu-su-mm-supported 'unknown
|
||||
"Whether `su -mm' is supported on this system.")
|
||||
|
||||
;;;###tramp-autoload
|
||||
(defconst tramp-androidsu-local-shell-name "/system/bin/sh"
|
||||
"Name of the local shell on Android.")
|
||||
|
||||
;;;###tramp-autoload
|
||||
(defconst tramp-androidsu-local-tmp-directory "/data/local/tmp"
|
||||
"Name of the local temporary directory on Android.")
|
||||
|
||||
;;;###tramp-autoload
|
||||
(tramp--with-startup
|
||||
(add-to-list 'tramp-methods
|
||||
`(,tramp-androidsu-method
|
||||
(tramp-login-program "su")
|
||||
(tramp-login-args (("-") ("%u")))
|
||||
(tramp-remote-shell "/system/bin/sh")
|
||||
(tramp-remote-shell-login ("-l"))
|
||||
(tramp-remote-shell-args ("-c"))
|
||||
(tramp-tmpdir "/data/local/tmp")
|
||||
(tramp-connection-timeout 10)))
|
||||
|
||||
(tramp-login-program "su")
|
||||
(tramp-login-args (("-") ("%u")))
|
||||
(tramp-remote-shell ,tramp-androidsu-local-shell-name)
|
||||
(tramp-remote-shell-login ("-l"))
|
||||
(tramp-remote-shell-args ("-c"))
|
||||
(tramp-tmpdir ,tramp-androidsu-local-tmp-directory)
|
||||
(tramp-connection-timeout 10)
|
||||
(tramp-shell-name ,tramp-androidsu-local-shell-name)))
|
||||
(add-to-list 'tramp-default-host-alist
|
||||
`(,tramp-androidsu-method nil "localhost")))
|
||||
`(,tramp-androidsu-method nil "localhost"))
|
||||
(add-to-list 'tramp-default-user-alist
|
||||
`(,tramp-androidsu-method nil ,tramp-root-id-string)))
|
||||
|
||||
(defvar android-use-exec-loader) ; androidfns.c.
|
||||
|
||||
|
|
@ -112,15 +134,14 @@ multibyte mode and waits for the shell prompt to appear."
|
|||
;; there's no guarantee that it's
|
||||
;; possible to execute it with
|
||||
;; `android-use-exec-loader' off.
|
||||
"/system/bin/sh" "-i"))
|
||||
tramp-androidsu-local-shell-name "-i"))
|
||||
(user (tramp-file-name-user vec))
|
||||
command)
|
||||
;; Set sentinel. Initialize variables.
|
||||
(set-process-sentinel p #'tramp-process-sentinel)
|
||||
(tramp-post-process-creation p vec)
|
||||
;; Replace `login-args' place holders.
|
||||
(setq command (format "exec su - %s || exit"
|
||||
(or user "root")))
|
||||
(setq command (format "exec su - %s || exit" user))
|
||||
(tramp-set-connection-property vec "remote-namespace" nil)
|
||||
;; Attempt to execute the shell inside the global mount
|
||||
;; namespace if requested.
|
||||
|
|
@ -142,7 +163,7 @@ multibyte mode and waits for the shell prompt to appear."
|
|||
(tramp-set-connection-property
|
||||
vec "remote-namespace" t)
|
||||
(setq command (format "exec su -mm - %s || exit"
|
||||
(or user "root"))))))
|
||||
user)))))
|
||||
;; Send the command.
|
||||
(tramp-message vec 3 "Sending command `%s'" command)
|
||||
(tramp-adb-send-command vec command t t)
|
||||
|
|
@ -154,7 +175,6 @@ multibyte mode and waits for the shell prompt to appear."
|
|||
(with-current-buffer (process-buffer p)
|
||||
(tramp-wait-for-regexp p tramp-connection-timeout
|
||||
"#[[:space:]]*$"))
|
||||
|
||||
;; Set connection-local variables.
|
||||
(tramp-set-connection-local-variables vec)
|
||||
;; Change prompt.
|
||||
|
|
@ -167,7 +187,8 @@ multibyte mode and waits for the shell prompt to appear."
|
|||
;; Dump option settings in the traces.
|
||||
(when (>= tramp-verbose 9)
|
||||
(tramp-adb-send-command vec "set -o"))
|
||||
;; Disable Unicode.
|
||||
;; Disable Unicode, for otherwise Unicode filenames will
|
||||
;; not be decoded correctly.
|
||||
(tramp-adb-send-command vec "set +U")
|
||||
;; Disable echo expansion.
|
||||
(tramp-adb-send-command
|
||||
|
|
@ -188,8 +209,7 @@ multibyte mode and waits for the shell prompt to appear."
|
|||
t)))
|
||||
;; Set the remote PATH to a suitable value.
|
||||
(tramp-set-connection-property vec "remote-path"
|
||||
'("/system/bin"
|
||||
"/system/xbin"))
|
||||
tramp-androidsu-remote-path)
|
||||
;; Mark it as connected.
|
||||
(tramp-set-connection-property p "connected" t))))
|
||||
;; Cleanup, and propagate the signal.
|
||||
|
|
@ -223,163 +243,49 @@ FUNCTION."
|
|||
(fset 'tramp-adb-wait-for-output tramp-adb-wait-for-output)
|
||||
(fset 'tramp-adb-maybe-open-connection tramp-adb-maybe-open-connection)))))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-access-file
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-access-file))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-add-name-to-file
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-add-name-to-file))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-copy-directory
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-copy-directory))
|
||||
|
||||
(defalias 'tramp-androidsu-sh-handle-copy-file
|
||||
(defalias 'tramp-androidsu-handle-copy-file
|
||||
(tramp-androidsu-generate-wrapper #'tramp-sh-handle-copy-file))
|
||||
|
||||
(defalias 'tramp-androidsu-adb-handle-delete-directory
|
||||
(defalias 'tramp-androidsu-handle-delete-directory
|
||||
(tramp-androidsu-generate-wrapper #'tramp-adb-handle-delete-directory))
|
||||
|
||||
(defalias 'tramp-androidsu-adb-handle-delete-file
|
||||
(defalias 'tramp-androidsu-handle-delete-file
|
||||
(tramp-androidsu-generate-wrapper #'tramp-adb-handle-delete-file))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-directory-file-name
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-directory-file-name))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-directory-files
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-directory-files))
|
||||
|
||||
(defalias 'tramp-androidsu-adb-handle-directory-files-and-attributes
|
||||
(defalias 'tramp-androidsu-handle-directory-files-and-attributes
|
||||
(tramp-androidsu-generate-wrapper #'tramp-adb-handle-directory-files-and-attributes))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-dired-uncache
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-dired-uncache))
|
||||
|
||||
(defalias 'tramp-androidsu-adb-handle-exec-path
|
||||
(defalias 'tramp-androidsu-handle-exec-path
|
||||
(tramp-androidsu-generate-wrapper #'tramp-adb-handle-exec-path))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-expand-file-name
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-expand-file-name))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-accessible-directory-p
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-accessible-directory-p))
|
||||
|
||||
(defalias 'tramp-androidsu-adb-handle-file-attributes
|
||||
(defalias 'tramp-androidsu-handle-file-attributes
|
||||
(tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-attributes))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-directory-p
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-directory-p))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-equal-p
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-equal-p))
|
||||
|
||||
(defalias 'tramp-androidsu-adb-handle-file-executable-p
|
||||
(defalias 'tramp-androidsu-handle-file-executable-p
|
||||
(tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-executable-p))
|
||||
|
||||
(defalias 'tramp-androidsu-adb-handle-file-exists-p
|
||||
(defalias 'tramp-androidsu-handle-file-exists-p
|
||||
(tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-exists-p))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-group-gid
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-group-gid))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-in-directory-p
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-in-directory-p))
|
||||
|
||||
(defalias 'tramp-androidsu-sh-handle-file-local-copy
|
||||
(defalias 'tramp-androidsu-handle-file-local-copy
|
||||
(tramp-androidsu-generate-wrapper #'tramp-sh-handle-file-local-copy))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-locked-p
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-locked-p))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-modes
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-modes))
|
||||
|
||||
(defalias 'tramp-androidsu-adb-handle-file-name-all-completions
|
||||
(defalias 'tramp-androidsu-handle-file-name-all-completions
|
||||
(tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-name-all-completions))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-name-as-directory
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-name-as-directory))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-name-case-insensitive-p
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-name-case-insensitive-p))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-name-completion
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-name-completion))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-name-directory
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-name-directory))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-name-nondirectory
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-name-nondirectory))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-newer-than-file-p
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-newer-than-file-p))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-notify-add-watch
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-notify-add-watch))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-notify-rm-watch
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-notify-rm-watch))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-notify-valid-p
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-notify-valid-p))
|
||||
|
||||
(defalias 'tramp-androidsu-adb-handle-file-readable-p
|
||||
(defalias 'tramp-androidsu-handle-file-readable-p
|
||||
(tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-readable-p))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-regular-p
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-regular-p))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-remote-p
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-remote-p))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-selinux-context
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-selinux-context))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-symlink-p
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-symlink-p))
|
||||
|
||||
(defalias 'tramp-androidsu-adb-handle-file-system-info
|
||||
(defalias 'tramp-androidsu-handle-file-system-info
|
||||
(tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-system-info))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-truename
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-truename))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-file-user-uid
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-file-user-uid))
|
||||
|
||||
(defalias 'tramp-androidsu-adb-handle-file-writable-p
|
||||
(defalias 'tramp-androidsu-handle-file-writable-p
|
||||
(tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-writable-p))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-find-backup-file-name
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-find-backup-file-name))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-insert-directory
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-insert-directory))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-insert-file-contents
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-insert-file-contents))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-list-system-processes
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-list-system-processes))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-load
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-load))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-lock-file
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-lock-file))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-make-auto-save-file-name
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-make-auto-save-file-name))
|
||||
|
||||
(defalias 'tramp-androidsu-adb-handle-make-directory
|
||||
(defalias 'tramp-androidsu-handle-make-directory
|
||||
(tramp-androidsu-generate-wrapper #'tramp-adb-handle-make-directory))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-make-lock-file-name
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-make-lock-file-name))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-make-nearby-temp-file
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-make-nearby-temp-file))
|
||||
|
||||
(defun tramp-androidsu-make-process (&rest args)
|
||||
(defun tramp-androidsu-handle-make-process (&rest args)
|
||||
"Like `tramp-handle-make-process', but modified for Android."
|
||||
(when args
|
||||
(with-parsed-tramp-file-name (expand-file-name default-directory) nil
|
||||
|
|
@ -493,150 +399,123 @@ FUNCTION."
|
|||
(tramp-taint-remote-process-buffer stderr))
|
||||
p)))))
|
||||
|
||||
(defalias 'tramp-androidsu-sh-handle-make-symbolic-link
|
||||
(defalias 'tramp-androidsu-handle-make-symbolic-link
|
||||
(tramp-androidsu-generate-wrapper
|
||||
#'tramp-sh-handle-make-symbolic-link))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-memory-info
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-memory-info))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-process-attributes
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-process-attributes))
|
||||
|
||||
(defalias 'tramp-androidsu-adb-handle-process-file
|
||||
(defalias 'tramp-androidsu-handle-process-file
|
||||
(tramp-androidsu-generate-wrapper #'tramp-adb-handle-process-file))
|
||||
|
||||
(defalias 'tramp-androidsu-sh-handle-rename-file
|
||||
(defalias 'tramp-androidsu-handle-rename-file
|
||||
(tramp-androidsu-generate-wrapper #'tramp-sh-handle-rename-file))
|
||||
|
||||
(defalias 'tramp-androidsu-adb-handle-set-file-modes
|
||||
(defalias 'tramp-androidsu-handle-set-file-modes
|
||||
(tramp-androidsu-generate-wrapper #'tramp-adb-handle-set-file-modes))
|
||||
|
||||
(defalias 'tramp-androidsu-adb-handle-set-file-times
|
||||
(defalias 'tramp-androidsu-handle-set-file-times
|
||||
(tramp-androidsu-generate-wrapper #'tramp-adb-handle-set-file-times))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-set-visited-file-modtime
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-set-visited-file-modtime))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-shell-command
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-shell-command))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-start-file-process
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-start-file-process))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-substitute-in-file-name
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-substitute-in-file-name))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-temporary-file-directory
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-temporary-file-directory))
|
||||
|
||||
(defalias 'tramp-androidsu-adb-handle-get-remote-gid
|
||||
(defalias 'tramp-androidsu-handle-get-remote-gid
|
||||
(tramp-androidsu-generate-wrapper #'tramp-adb-handle-get-remote-gid))
|
||||
|
||||
(defalias 'tramp-androidsu-adb-handle-get-remote-groups
|
||||
(defalias 'tramp-androidsu-handle-get-remote-groups
|
||||
(tramp-androidsu-generate-wrapper #'tramp-adb-handle-get-remote-groups))
|
||||
|
||||
(defalias 'tramp-androidsu-adb-handle-get-remote-uid
|
||||
(defalias 'tramp-androidsu-handle-get-remote-uid
|
||||
(tramp-androidsu-generate-wrapper #'tramp-adb-handle-get-remote-uid))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-unlock-file
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-unlock-file))
|
||||
|
||||
(defalias 'tramp-androidsu-handle-verify-visited-file-modtime
|
||||
(tramp-androidsu-generate-wrapper #'tramp-handle-verify-visited-file-modtime))
|
||||
|
||||
(defalias 'tramp-androidsu-sh-handle-write-region
|
||||
(defalias 'tramp-androidsu-handle-write-region
|
||||
(tramp-androidsu-generate-wrapper #'tramp-sh-handle-write-region))
|
||||
|
||||
;;;###tramp-autoload
|
||||
(defconst tramp-androidsu-file-name-handler-alist
|
||||
'(;; `abbreviate-file-name' performed by default handler.
|
||||
(access-file . tramp-androidsu-handle-access-file)
|
||||
(add-name-to-file . tramp-androidsu-handle-add-name-to-file)
|
||||
(access-file . tramp-handle-access-file)
|
||||
(add-name-to-file . tramp-handle-add-name-to-file)
|
||||
;; `byte-compiler-base-file-name' performed by default handler.
|
||||
(copy-directory . tramp-androidsu-handle-copy-directory)
|
||||
(copy-file . tramp-androidsu-sh-handle-copy-file)
|
||||
(delete-directory . tramp-androidsu-adb-handle-delete-directory)
|
||||
(delete-file . tramp-androidsu-adb-handle-delete-file)
|
||||
(copy-directory . tramp-handle-copy-directory)
|
||||
(copy-file . tramp-androidsu-handle-copy-file)
|
||||
(delete-directory . tramp-androidsu-handle-delete-directory)
|
||||
(delete-file . tramp-androidsu-handle-delete-file)
|
||||
;; `diff-latest-backup-file' performed by default handler.
|
||||
(directory-file-name . tramp-androidsu-handle-directory-file-name)
|
||||
(directory-files . tramp-androidsu-handle-directory-files)
|
||||
(directory-file-name . tramp-handle-directory-file-name)
|
||||
(directory-files . tramp-handle-directory-files)
|
||||
(directory-files-and-attributes
|
||||
. tramp-androidsu-adb-handle-directory-files-and-attributes)
|
||||
. tramp-androidsu-handle-directory-files-and-attributes)
|
||||
(dired-compress-file . ignore)
|
||||
(dired-uncache . tramp-androidsu-handle-dired-uncache)
|
||||
(exec-path . tramp-androidsu-adb-handle-exec-path)
|
||||
(expand-file-name . tramp-androidsu-handle-expand-file-name)
|
||||
(file-accessible-directory-p . tramp-androidsu-handle-file-accessible-directory-p)
|
||||
(dired-uncache . tramp-handle-dired-uncache)
|
||||
(exec-path . tramp-androidsu-handle-exec-path)
|
||||
(expand-file-name . tramp-handle-expand-file-name)
|
||||
(file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
|
||||
(file-acl . ignore)
|
||||
(file-attributes . tramp-androidsu-adb-handle-file-attributes)
|
||||
(file-directory-p . tramp-androidsu-handle-file-directory-p)
|
||||
(file-equal-p . tramp-androidsu-handle-file-equal-p)
|
||||
(file-executable-p . tramp-androidsu-adb-handle-file-executable-p)
|
||||
(file-exists-p . tramp-androidsu-adb-handle-file-exists-p)
|
||||
(file-group-gid . tramp-androidsu-handle-file-group-gid)
|
||||
(file-in-directory-p . tramp-androidsu-handle-file-in-directory-p)
|
||||
(file-local-copy . tramp-androidsu-sh-handle-file-local-copy)
|
||||
(file-locked-p . tramp-androidsu-handle-file-locked-p)
|
||||
(file-modes . tramp-androidsu-handle-file-modes)
|
||||
(file-name-all-completions . tramp-androidsu-adb-handle-file-name-all-completions)
|
||||
(file-name-as-directory . tramp-androidsu-handle-file-name-as-directory)
|
||||
(file-name-case-insensitive-p . tramp-androidsu-handle-file-name-case-insensitive-p)
|
||||
(file-name-completion . tramp-androidsu-handle-file-name-completion)
|
||||
(file-name-directory . tramp-androidsu-handle-file-name-directory)
|
||||
(file-name-nondirectory . tramp-androidsu-handle-file-name-nondirectory)
|
||||
(file-attributes . tramp-androidsu-handle-file-attributes)
|
||||
(file-directory-p . tramp-handle-file-directory-p)
|
||||
(file-equal-p . tramp-handle-file-equal-p)
|
||||
(file-executable-p . tramp-androidsu-handle-file-executable-p)
|
||||
(file-exists-p . tramp-androidsu-handle-file-exists-p)
|
||||
(file-group-gid . tramp-handle-file-group-gid)
|
||||
(file-in-directory-p . tramp-handle-file-in-directory-p)
|
||||
(file-local-copy . tramp-androidsu-handle-file-local-copy)
|
||||
(file-locked-p . tramp-handle-file-locked-p)
|
||||
(file-modes . tramp-handle-file-modes)
|
||||
(file-name-all-completions . tramp-androidsu-handle-file-name-all-completions)
|
||||
(file-name-as-directory . tramp-handle-file-name-as-directory)
|
||||
(file-name-case-insensitive-p . tramp-handle-file-name-case-insensitive-p)
|
||||
(file-name-completion . tramp-handle-file-name-completion)
|
||||
(file-name-directory . tramp-handle-file-name-directory)
|
||||
(file-name-nondirectory . tramp-handle-file-name-nondirectory)
|
||||
;; `file-name-sans-versions' performed by default handler.
|
||||
(file-newer-than-file-p . tramp-androidsu-handle-file-newer-than-file-p)
|
||||
(file-notify-add-watch . tramp-androidsu-handle-file-notify-add-watch)
|
||||
(file-notify-rm-watch . tramp-androidsu-handle-file-notify-rm-watch)
|
||||
(file-notify-valid-p . tramp-androidsu-handle-file-notify-valid-p)
|
||||
(file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
|
||||
(file-notify-add-watch . tramp-handle-file-notify-add-watch)
|
||||
(file-notify-rm-watch . tramp-handle-file-notify-rm-watch)
|
||||
(file-notify-valid-p . tramp-handle-file-notify-valid-p)
|
||||
(file-ownership-preserved-p . ignore)
|
||||
(file-readable-p . tramp-androidsu-adb-handle-file-readable-p)
|
||||
(file-regular-p . tramp-androidsu-handle-file-regular-p)
|
||||
(file-remote-p . tramp-androidsu-handle-file-remote-p)
|
||||
(file-selinux-context . tramp-androidsu-handle-file-selinux-context)
|
||||
(file-symlink-p . tramp-androidsu-handle-file-symlink-p)
|
||||
(file-system-info . tramp-androidsu-adb-handle-file-system-info)
|
||||
(file-truename . tramp-androidsu-handle-file-truename)
|
||||
(file-user-uid . tramp-androidsu-handle-file-user-uid)
|
||||
(file-writable-p . tramp-androidsu-adb-handle-file-writable-p)
|
||||
(find-backup-file-name . tramp-androidsu-handle-find-backup-file-name)
|
||||
(file-readable-p . tramp-androidsu-handle-file-readable-p)
|
||||
(file-regular-p . tramp-handle-file-regular-p)
|
||||
(file-remote-p . tramp-handle-file-remote-p)
|
||||
(file-selinux-context . tramp-handle-file-selinux-context)
|
||||
(file-symlink-p . tramp-handle-file-symlink-p)
|
||||
(file-system-info . tramp-androidsu-handle-file-system-info)
|
||||
(file-truename . tramp-handle-file-truename)
|
||||
(file-user-uid . tramp-handle-file-user-uid)
|
||||
(file-writable-p . tramp-androidsu-handle-file-writable-p)
|
||||
(find-backup-file-name . tramp-handle-find-backup-file-name)
|
||||
;; `get-file-buffer' performed by default handler.
|
||||
(insert-directory . tramp-androidsu-handle-insert-directory)
|
||||
(insert-file-contents . tramp-androidsu-handle-insert-file-contents)
|
||||
(list-system-processes . tramp-androidsu-handle-list-system-processes)
|
||||
(load . tramp-androidsu-handle-load)
|
||||
(lock-file . tramp-androidsu-handle-lock-file)
|
||||
(make-auto-save-file-name . tramp-androidsu-handle-make-auto-save-file-name)
|
||||
(make-directory . tramp-androidsu-adb-handle-make-directory)
|
||||
(insert-directory . tramp-handle-insert-directory)
|
||||
(insert-file-contents . tramp-handle-insert-file-contents)
|
||||
(list-system-processes . tramp-handle-list-system-processes)
|
||||
(load . tramp-handle-load)
|
||||
(lock-file . tramp-handle-lock-file)
|
||||
(make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
|
||||
(make-directory . tramp-androidsu-handle-make-directory)
|
||||
(make-directory-internal . ignore)
|
||||
(make-lock-file-name . tramp-androidsu-handle-make-lock-file-name)
|
||||
(make-nearby-temp-file . tramp-androidsu-handle-make-nearby-temp-file)
|
||||
(make-process . tramp-androidsu-make-process)
|
||||
(make-symbolic-link . tramp-androidsu-sh-handle-make-symbolic-link)
|
||||
(memory-info . tramp-androidsu-handle-memory-info)
|
||||
(process-attributes . tramp-androidsu-handle-process-attributes)
|
||||
(process-file . tramp-androidsu-adb-handle-process-file)
|
||||
(rename-file . tramp-androidsu-sh-handle-rename-file)
|
||||
(make-lock-file-name . tramp-handle-make-lock-file-name)
|
||||
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
|
||||
(make-process . tramp-androidsu-handle-make-process)
|
||||
(make-symbolic-link . tramp-androidsu-handle-make-symbolic-link)
|
||||
(memory-info . tramp-handle-memory-info)
|
||||
(process-attributes . tramp-handle-process-attributes)
|
||||
(process-file . tramp-androidsu-handle-process-file)
|
||||
(rename-file . tramp-androidsu-handle-rename-file)
|
||||
(set-file-acl . ignore)
|
||||
(set-file-modes . tramp-androidsu-adb-handle-set-file-modes)
|
||||
(set-file-modes . tramp-androidsu-handle-set-file-modes)
|
||||
(set-file-selinux-context . ignore)
|
||||
(set-file-times . tramp-androidsu-adb-handle-set-file-times)
|
||||
(set-visited-file-modtime . tramp-androidsu-handle-set-visited-file-modtime)
|
||||
(shell-command . tramp-androidsu-handle-shell-command)
|
||||
(start-file-process . tramp-androidsu-handle-start-file-process)
|
||||
(substitute-in-file-name . tramp-androidsu-handle-substitute-in-file-name)
|
||||
(temporary-file-directory . tramp-androidsu-handle-temporary-file-directory)
|
||||
(set-file-times . tramp-androidsu-handle-set-file-times)
|
||||
(set-visited-file-modtime . tramp-handle-set-visited-file-modtime)
|
||||
(shell-command . tramp-handle-shell-command)
|
||||
(start-file-process . tramp-handle-start-file-process)
|
||||
(substitute-in-file-name . tramp-handle-substitute-in-file-name)
|
||||
(temporary-file-directory . tramp-handle-temporary-file-directory)
|
||||
(tramp-get-home-directory . ignore)
|
||||
(tramp-get-remote-gid . tramp-androidsu-adb-handle-get-remote-gid)
|
||||
(tramp-get-remote-groups . tramp-androidsu-adb-handle-get-remote-groups)
|
||||
(tramp-get-remote-uid . tramp-androidsu-adb-handle-get-remote-uid)
|
||||
(tramp-get-remote-gid . tramp-androidsu-handle-get-remote-gid)
|
||||
(tramp-get-remote-groups . tramp-androidsu-handle-get-remote-groups)
|
||||
(tramp-get-remote-uid . tramp-androidsu-handle-get-remote-uid)
|
||||
(tramp-set-file-uid-gid . ignore)
|
||||
(unhandled-file-name-directory . ignore)
|
||||
(unlock-file . tramp-androidsu-handle-unlock-file)
|
||||
(unlock-file . tramp-handle-unlock-file)
|
||||
(vc-registered . ignore)
|
||||
(verify-visited-file-modtime . tramp-androidsu-handle-verify-visited-file-modtime)
|
||||
(write-region . tramp-androidsu-sh-handle-write-region))
|
||||
(verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
|
||||
(write-region . tramp-androidsu-handle-write-region))
|
||||
"Alist of TRAMP handler functions for superuser sessions on Android.")
|
||||
|
||||
;; It must be a `defsubst' in order to push the whole code into
|
||||
|
|
@ -669,7 +548,7 @@ arguments to pass to the OPERATION."
|
|||
|
||||
(with-eval-after-load 'shell
|
||||
(connection-local-set-profiles
|
||||
`(:application tramp :protocol ,tramp-adb-method)
|
||||
`(:application tramp :protocol ,tramp-androidsu-method)
|
||||
'tramp-adb-connection-local-default-shell-profile
|
||||
'tramp-adb-connection-local-default-ps-profile))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue