Skip to content

Latest commit

 

History

History
42 lines (36 loc) · 1.98 KB

technical_specs.md

File metadata and controls

42 lines (36 loc) · 1.98 KB

Technical Specifications & Case Study

1. Case Study: How "AnLinux" Works

The user asked about AnLinux specifically. It is the classic example of a Simple Orchestrator.

1.1 Architecture

  • Type: Dashboard / Script Generator.
  • User Interaction:
    1. User selects a Distro (e.g., Ubuntu) and Desktop (e.g., XFCE).
    2. AnLinux generates a complex curl or wget command.
    3. Mechanism: It copies this command to the Android Clipboard.
    4. It launches the Termux App.
    5. User Manually Pastes and runs the command.
  • Code Insight: AnLinux does not "run" the code itself. It relies entirely on the user acting as the bridge.
  • Our Improvement: We can use Android Intents (RUN_COMMAND intent from com.termux.permission.RUN_COMMAND) to automatically execute these scripts without requiring the user to copy-paste, offering a much smoother "One-Click" experience than AnLinux.

2. Technical Specifications: The Intent System

To implement "Option B (Orchestrator)" with the "Wow" factor, we will use the Termux RUN_COMMAND Intent.

2.1 Required Permissions

In AndroidManifest.xml:

<uses-permission android:name="com.termux.permission.RUN_COMMAND" />

2.2 Termux Configuration

The user must manually edit ~/.termux/termux.properties once to allow external control (we can provide a setup script for this):

allow-external-apps = true

2.3 Intent Structure (Java/Kotlin)

Instead of manual clipboard copying, we send specific commands:

val intent = Intent()
intent.setClassName("com.termux", "com.termux.app.RunCommandService")
intent.action = "com.termux.RUN_COMMAND"
intent.putExtra("com.termux.RUN_COMMAND_PATH", "/data/data/com.termux/files/usr/bin/bash")
intent.putExtra("com.termux.RUN_COMMAND_ARGUMENTS", arrayOf("-c", "pkg install -y proot-distro && proot-distro install ubuntu"))
intent.putExtra("com.termux.RUN_COMMAND_WORKDIR", "/data/data/com.termux/files/home")
startService(intent)