这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@intgr
Copy link

@intgr intgr commented Mar 16, 2021

This resolves #924 and makes it possible to access Termux directrly from adb shell via run-as.

Not totally elegant, but it works:

% adb shell
dreamlte:/ $ run-as com.termux
dreamlte:/data/data/com.termux $ PATH=/data/data/com.termux/files/usr/bin LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so /data/data/com.termux/files/usr/bin/bash -l
~ $ python
Python 3.9.2 (default, Feb 22 2021, 12:26:04)
[Clang 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 98c855489 on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

This resolves termux#924 and makes it possible to access Termux directrly from `adb shell` via `run-as`.

Not totally elegant, but it works:
```
% adb shell
dreamlte:/ $ run-as com.termux
dreamlte:/data/data/com.termux $ PATH=/data/data/com.termux/files/usr/bin LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so /data/data/com.termux/files/usr/bin/bash -l
~ $ python
Python 3.9.2 (default, Feb 22 2021, 12:26:04)
[Clang 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 98c855489 on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
```
@intgr
Copy link
Author

intgr commented Mar 16, 2021

It would be useful to include a helper command that sets PATH and LD_PRELOAD, but it's usable without that too.

@intgr
Copy link
Author

intgr commented Mar 16, 2021

Now, I'm extremely new to Android development. Should research whether the android:debuggable annotation has any downsides.

@agnostic-apollo
Copy link
Member

Dude, you don't release app APKs in debuggable mode. That's only to be used while developing an app.

@intgr
Copy link
Author

intgr commented Mar 16, 2021

@agnostic-apollo What's the downside of enabling debuggable?

Seems like a Digital Restrictions Management feature to "protect" the user from themselves. It's not like Termux has some trade secrets locked up in the app. The website https://termux.com/ lists Tinkerable in bold letters. Why disallow debugging by the device's owner? It enables a convenient feature requested in #924.

@ghost
Copy link

ghost commented Mar 16, 2021

@intgr Get a development build for yourself from Github Actions, what's the problem?

https://github.com/termux/termux-app/suites/2272001163/artifacts/47404244

@agnostic-apollo
Copy link
Member

The downside will be that we will likely never be able to upload APKs to google play store again (even after solving targetsdk 29 issues).

Check https://developer.android.com/studio/publish/preparing#turn-off-logging-and-debugging

Uploading debuggable APKs will throw errors like You uploaded a debuggable APK or Android App Bundle. For security reasons you need to disable debugging before it can be published in Google Play.

On top of that, debuggable APKs are not allowed by F-Droid builds either as mentioned here.

Those are pretty small downsides, I think, well, not that small actually. But if this would allow you to Tinker, then, hell with those millions of users, you just say the word!

@intgr
Copy link
Author

intgr commented Mar 16, 2021

Right, fair enough, then clearly this won't work. But there's no need to be such dicks about it.

@intgr Get a development build for yourself from Github Actions, what's the problem?

You can see many people in #924 having this problem. This solution that you imply is so blindingly obvious was not mentioned, otherwise I wouldn't have went through this trouble.

@agnostic-apollo
Copy link
Member

Adding "/s" or smileys would have decreased the impact of the said sarcasm. Wasn't being a dick.

The solution would work but it isn't ideal for average users, since it would require manual update checking and apk signing keys issues would be there, i.e, all termux plugin apps will also need to be installed from github action builds. Installation would fail unless all APKs from other sources are uninstalled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add the ability to run Termux commands via. ADB without root.

2 participants