Skip to content

feat(terminal): bundle everything into the apk#2197

Merged
RohitKushvaha01 merged 8 commits into
Acode-Foundation:mainfrom
RohitKushvaha01:main
Jun 12, 2026
Merged

feat(terminal): bundle everything into the apk#2197
RohitKushvaha01 merged 8 commits into
Acode-Foundation:mainfrom
RohitKushvaha01:main

Conversation

@RohitKushvaha01

@RohitKushvaha01 RohitKushvaha01 commented Jun 11, 2026

Copy link
Copy Markdown
Member

TODO

  • update axs with 16kb page size
  • test fdroid flavour

@greptile-apps

greptile-apps Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR bundles the Alpine Linux root filesystem and axs binaries directly into the APK, eliminating the need to download them for non-F-Droid builds. The F-Droid path retains the existing download-from-GitHub flow, while the non-F-Droid path now uses system.extractAsset to copy the bundled assets and creates a symlink to the native libaxs.so.

  • New extractAsset Java method in System.java reads an APK asset and writes it to disk; plugin.xml declares libaxs.so and alpine.rootfs for all three architectures as bundled resources.
  • Terminal.js install path now branches on the $FDROID env flag: F-Droid downloads libs from GitHub, non-F-Droid extracts bundled assets. URL construction for the F-Droid path is refactored into a split-string builder to obfuscate direct URLs.
  • init-sandbox.sh gains -b $NATIVE_DIR so the sandboxed environment can access native libraries placed there by the OS.

Confidence Score: 4/5

The non-F-Droid bundled-asset path works correctly, but the F-Droid download path assembles the wrong GitHub raw domain, causing every proot library download to fail on F-Droid builds.

The URL split-string builder for the F-Droid path omits the trailing s from githubusercontent, producing raw.githubusercontent.com instead of the correct raw.githubusercontent.com. All proot library downloads will fail with a DNS error on F-Droid installs until this is corrected.

src/plugins/terminal/www/Terminal.js — the rawGithubDomain string array and the F-Droid download flow.

Important Files Changed

Filename Overview
src/plugins/terminal/www/Terminal.js Major refactor of install/start flow to branch on F-Droid flag; F-Droid URL construction has a wrong raw GitHub domain that will break all library downloads.
src/plugins/system/android/com/foxdebug/system/System.java Adds extractAsset action and helper method for copying APK assets to disk; blocking I/O concern was already flagged in a previous review thread.
src/plugins/system/www/plugin.js Adds extractAsset JS bridge and a duplicate getNativeLibraryPath entry (pre-existing duplicate not introduced here).
src/plugins/proot/plugin.xml Bundles libaxs.so and alpine.rootfs assets for all three architectures via new source-file and resource-file entries.
src/plugins/terminal/scripts/init-sandbox.sh Adds -b $NATIVE_DIR bind-mount so proot can access native libraries in the non-F-Droid path; straightforward and correct.
src/plugins/terminal/src/android/Executor.java Disables loadLibrary action with a clear error message and comment-out of old code; no functional concern.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[install called] --> B{isFdroid === 'true'?}
    B -- F-Droid --> C[Build URLs via split-string builder]
    C --> D[Download alpine.tar.gz from alpinelinux.org]
    D --> E[Download axs from GitHub Releases]
    E --> F[Download proot libs from raw.githubusercontent.com ❌ wrong domain]
    B -- non-F-Droid --> G[system.extractAsset alpine.rootfs → alpine.tar.gz]
    G --> H[ln -s NATIVE_DIR/libaxs.so PREFIX/axs]
    F --> I[ensureDir + tar extract]
    H --> I
    I --> J[startAxs --installing]
    J --> K{FDROID in init-sandbox.sh?}
    K -- true --> L[PROOT_LOADER from PREFIX/ libs]
    K -- false --> M[PROOT_LOADER from NATIVE_DIR/ + bind -b NATIVE_DIR]
    L --> N[exec proot sandbox]
    M --> N
Loading

Reviews (3): Last reviewed commit: "Update Terminal.js" | Re-trigger Greptile

Comment thread src/plugins/system/android/com/foxdebug/system/System.java
Comment thread src/plugins/terminal/www/Terminal.js Outdated
Comment thread src/plugins/terminal/www/Terminal.js Outdated
Comment thread src/plugins/terminal/www/Terminal.js Outdated
@RohitKushvaha01

This comment has been minimized.

Comment thread src/plugins/terminal/www/Terminal.js
@RohitKushvaha01

This comment has been minimized.

Comment thread src/plugins/terminal/www/Terminal.js
@Victozee26

Victozee26 commented Jun 12, 2026

Copy link
Copy Markdown

so it basically gluing Alpine only

what about #2186 option 2

@UnschooledGamer

Copy link
Copy Markdown
Member

so it basically gluing Alpine only

what about #2186 option 2

@Victozee26 Hard Luck for Playstore users, they'll have to stick to one, other distro's rootfs are larger in size, so we can't include more rootfs bundled inside for those users.

@RohitKushvaha01

Copy link
Copy Markdown
Member Author

so it basically gluing Alpine only

what about #2186 option 2

@bajrangCoder is working a distro manager plugin that will include debian/ubuntu etc

@RohitKushvaha01 RohitKushvaha01 merged commit dcc871a into Acode-Foundation:main Jun 12, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in The Code Board - Acode Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants