Commit 6ece4b7
committed
fix(mobile): extended env actually installs — proot URL, DNS seed, wrapper refresh
The "install advanced tools on first launch" feature was silently broken
end-to-end on existing installs:
1. **proot URL was dead**: proot.gitlab.io/proot/bin/proot-aarch64-static
returns an HTML 404 page. The 3.7 KB HTML blob was written as
runtime/bin/proot, which sh then exec'd → syntax error on line 2
("<!DOCTYPE html>"), and every subsequent proot invocation (apk update,
apk add, per-tool wrappers) failed silently. Switch to the maintained
proot-me/proot v5.3.0 release on GitHub which ships a genuine static
aarch64 ELF (~1.4 MB).
2. **extended_env check was too weak**: returned true as soon as the rootfs
directory existed, regardless of whether `apk add` had actually
succeeded. So after a failed install attempt users were left with a
base Alpine minirootfs (apk-tools, busybox, libc-utils — no git, no
nano, no tmux), and the frontend's "already installed, skip" path
locked them out of a retry. Tighten the check to require
rootfs/usr/bin/git as a sentinel — if the git binary isn't there,
the install didn't complete and we must re-run it.
3. **rootfs had no DNS**: Alpine minirootfs ships without
/etc/resolv.conf, and proot hides the host /etc from the guest. apk
fetch, git-http, wget, ssh all errored with "bad address". Seed a
resolv.conf with public resolvers at rootfs extraction time AND on
every server start (idempotent refresh).
4. **proot-run wrapper baked in the rotating APK path**: the wrapper
contains the full nativeLibraryDir path, which Android rotates on
every APK upgrade. After an upgrade the wrapper pointed at a path
that no longer existed → proot process lookup silently failed. The
wrapper was only written inside install_extended_env, which only
runs once per device. Regenerate the wrapper on every server start
when the rootfs is present so it always matches the current install.
5. **PROOT_TMP_DIR missing**: proot needs a writable tmp for its shadow
filesystem. Default lookups land in paths the app sandbox can't
write, causing "can't create temporary file" errors on every
invocation. Export PROOT_TMP_DIR pointing to runtime/tmp and mkdir
-p it from inside the wrapper so it's always present.
Net effect: first-launch users now actually get git/nano/tmux/python/
node/vim/tree/htop/fzf/rg/bat once the ExtractionProgress screen
finishes, and APK upgrades keep them working without a manual re-run.
Validated on Mi 10 Pro (b7163823) after manual patching with the
matching shell commands.1 parent 24fea69 commit 6ece4b7
1 file changed
Lines changed: 87 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
45 | 54 | | |
46 | 55 | | |
47 | 56 | | |
| |||
465 | 474 | | |
466 | 475 | | |
467 | 476 | | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
468 | 520 | | |
469 | 521 | | |
470 | 522 | | |
| |||
746 | 798 | | |
747 | 799 | | |
748 | 800 | | |
749 | | - | |
750 | | - | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
751 | 810 | | |
752 | 811 | | |
753 | 812 | | |
| |||
827 | 886 | | |
828 | 887 | | |
829 | 888 | | |
830 | | - | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
831 | 911 | | |
832 | 912 | | |
833 | 913 | | |
| 914 | + | |
| 915 | + | |
834 | 916 | | |
835 | 917 | | |
836 | 918 | | |
| |||
846 | 928 | | |
847 | 929 | | |
848 | 930 | | |
| 931 | + | |
849 | 932 | | |
850 | 933 | | |
851 | 934 | | |
| |||
0 commit comments