Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/termux/termux-exec
A execve() wrapper to fix problem with shebangs.
https://github.com/termux/termux-exec
Last synced: 2 days ago
JSON representation
A execve() wrapper to fix problem with shebangs.
- Host: GitHub
- URL: https://github.com/termux/termux-exec
- Owner: termux
- License: apache-2.0
- Created: 2017-09-17T12:18:10.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-06-20T01:36:48.000Z (8 months ago)
- Last Synced: 2024-10-29T20:56:22.960Z (3 months ago)
- Language: C
- Size: 21.5 KB
- Stars: 183
- Watchers: 16
- Forks: 57
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# termux-exec
A `execve()` wrapper to fix problem with shebangs when running in Termux.# Problem
A lot of Linux software is written with the assumption that `/bin/sh`, `/usr/bin/env`
and similar file exists. This is not the case on Android where neither `/bin/` nor `/usr/`
exists.When building packages for Termux those hard-coded assumptions are patched away - but this
does not help with installing scripts and programs from other sources than Termux packages.# Solution
Create an `execve()` wrapper that rewrites calls to execute files under `/bin/` and `/usr/bin`
into the matching Termux executables under `$PREFIX/bin/` and inject that into processes
using `LD_PRELOAD`.# How to install
1. Install with `pkg install termux-exec`.
2. Exit your current session and start a new one.
3. From now on shebangs such as `/bin/sh` and `/usr/bin/env python` should work.# Where is LD_PRELOAD set?
The `$PREFIX/bin/login` program which is used to create new Termux sessions checks for
`$PREFIX/lib/libtermux-exec.so` and if so sets up `LD_PRELOAD` before launching the login shell.