Repository navigation
RedTerm v2.4.0
Added
-
A Termux:API bridge of RedTerm's own. A command run inside a proot session can now
reach an Android feature in the app, over the same wire protocol Termux:API speaks — an
abstract Unix socket, the text of a fakeamcommand line, and a uint16 length-prefixed
answer on the same connection. The guest half is a small C helper built for all four
architectures and extracted per-ABI in app storage, the same way the bundledsshbinary
already is; the app half is a listener that starts with the process and one feature object
per API. The command names and the grammar are Termux:API's on purpose, so a script
written fortermux-apiruns in a RedTerm distro unchanged — but the shell, the helper and
the features are all in this app, and nothing is handed to another package. -
A persistent user startup hook, separate from the generated
/root/.startup. RedTerm rewrites/root/.startupon every new
proot session, so a hand edit there does not survive. An optional,
user-managed/root/.startup.localnow runs once, when a new
interactive session opens, before the interactive shell starts: the
launcher marks the interactive tail (REDTERM_INTERACTIVE_SESSION),
the generated startup runs the hook as a separate process when that
marker is set and the file exists, and skips it otherwise. A missing
file is a silent no-op; a non-zero exit is reported (RedTerm: /root/.startup.local reported an error (exit N) — continuing the session) without ending the session; one-shot commands never run it;
and the file is user-owned — RedTerm regenerates/root/.startupbut
never the hook, so it survives session restarts and app updates. This
is the requested persistent initialization point for distro startup
tasks such as Debian's dynamic MOTD (run-parts /etc/update-motd.d).
The mechanism is distro-agnostic — the hook block is in the shared tail
of the generated startup for all twenty distros, not Debian only. A new
guest commandredterm-startup-local(pure guest-side, no bridge)
prints a safe starter body for the hook: its Debian-family MOTD line is
double-guarded so it is a no-op on the other nineteen, so one printed
body is correct everywhere. Pipe it to create the hook:
redterm-startup-local > /root/.startup.local. Fixes #32.
Commands
Every command below is installed in the distro's /usr/local/bin under both a
redterm- and a termux- name (same body), so existing Termux:API scripts keep
running. Commands with structured output write JSON to stdout. Parser errors and
refused commands write plain text. A refusal may report a declared-but-missing
grant, or a permission this build does not declare at all. After the response
is received, the helper exits with status 0 — the exit status reports transport,
never the command's outcome, so the text is the answer. A missing grant on a
declared permission is fixed in Settings; an undeclared one cannot be enabled
there, and the refusal says so.
Bridge control
redterm-api <args…>— generic pass-through to the app's action handler (-a <action> --es/--ei/--ef/--esa …)redterm-api-start/redterm-api-stop— bring the app-side listener up / downredterm-download <url> [-d desc] [-t title] [-p path]redterm-callback <url> [-d data] [-m METHOD] [-t secs]
Guest tools (installed under redterm- only — no termux- alias, no bridge round-trip)
redterm-startup-local— print a safe starter body for the user-managed
/root/.startup.localsession hook (#32). Create the hook with
redterm-startup-local > /root/.startup.local.
Device state
redterm-battery-status— level, status, health, plugged, temp, voltage, currentredterm-audio-info— playback/recording device inforedterm-telephony-deviceinfo—device_id(IMEI/MEID) andsim_serial_numberfrom the subscription (read reflectively; privileged identifiers answer only where the OS allows)redterm-telephony-cellinfo— current + neighbouring cellsredterm-wifi-connectioninfo— active connection (IP, speed, BSSID, frequency; the SSID is masked without a location grant)redterm-wifi-enable true|falseredterm-network-cidrs/redterm-network-interfaceredterm-storage-get <path>— stat a path on the deviceredterm-sensor(list) /redterm-sensor -s <name> [-n count] [-d ms](read)redterm-usb -l/-p <dev|vid pid>/-o <dev> [vid pid]/-f <dev> <file>redterm-camera-inforedterm-keystore list|create|sign|verify|destroy [alias] [-a alg] [-s size] [-c curve] [-d data] [-g sig] [--detailed]
Controls
redterm-volume [-p|-d|-i|-m|-u] [-s stream] [-f value]redterm-vibrate [-d ms] [-P pattern]redterm-brightness [0..255]redterm-notification [-t title] [-m msg] [-i id] [-r|--remove | -c|--clear]redterm-notification-list/redterm-notification-remove [-i id]redterm-notification-channel <id> [name]/-d <id>(create / delete)redterm-toast "text"redterm-clipboard-set "text" | -f file/redterm-clipboard-getredterm-media-scan [-r] [-v] <path…>redterm-dialog <confirm|checkbox|counter|date|radio|sheet|spinner|text|time> [-i hint] [-t title] [-v values] [-r range] [-d datefmt] [-m] [-p] [-n]— blocking, answers on stdoutredterm-job-scheduler [--script sh] [--period-ms N] [--network any|metered|unmetered] [--battery-not-low] [--storage-not-low] [--charging] [--persisted] [--cancel] [--cancel-all] [--job-id N]redterm-contact-list [name]redterm-share <text…> [-d mime] [-s subject] [-f files]redterm-tts-speak [-e engine] [-l lang] [-n region] [-v variant] [-p pitch] [-r rate] [-s stream] [text | stdin]/redterm-tts-engines [-e engine]redterm-media-player play [file] | info | pause | stopredterm-microphone-record [-f file [-l secs] [-e encoder] [-b kbps] [-r rate] [-c channels]] [-i] [-q]redterm-speech-to-text [-l lang] < audio
Storage access framework
redterm-saf-grant— opens the system tree picker and persists the read+write
grant for it; prints the tree URI. Every othersaf-*command is only as
usable as the trees this has granted.redterm-saf-create <tree-uri> <filename>/redterm-saf-dirs/redterm-saf-ls <tree-uri>redterm-saf-read <document-uri>/redterm-saf-rm <document-uri>/redterm-saf-write <document-uri> < data