mirror of
https://github.com/dikeckaan/mu300-linux.git
synced 2026-12-06 00:03:00 +00:00
Magisk zips: a second way in - unpacked on a computer, the zip is that computer's installer
Every release zip now also holds the project's installers for a computer (computer/, from android/magisk/computer/files.txt), START-HERE.md (en/tr/zh, with the zip's system, kernel and release written in) and launchers: start.sh/.cmd, start-gui.sh/.cmd, uninstall-linux.sh/.cmd. Unpacked, install.sh / install.ps1 / the window install exactly that zip's system and kernel from its own payload/, offline: tools/package.sh (and its PowerShell twin, gui/mu300gui/package.py) reads mu300/manifest as the zip's own installer does and checks both payload files against the manifest and the release's SHA256SUMS; no question about the system, kernel, release or panel, no self-update. MU300_PACKAGE / --package / -Package name another unpacked zip. The Magisk side is untouched: customize.sh unpacks only mu300/, module.prop, the switch module and system/. A test installs a zip with and without the computer's side through customize.sh on the fake device and compares; the real v2026.10.27 zips built by main and by this differ only in the new entries (and the new translations). About 0.33 MB more per zip. A mainline zip has no 5.4 bundle: build-boot-image.py takes --busybox/--logdw/--modules as optional only with --append-ramdisk, and checks that segment brings them (it replaces them anyway). adb is not bundled: the Android SDK licence (3.4) does not allow passing platform-tools on; START-HERE.md says where to get them. FINDINGS 111. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VVN2zDgf76kMDVSuWhHPUE
This commit is contained in:
1 parent
96c221d87d
commit
edb57d8075
37 files changed
+1658
-81
No files matched your search
@@ -22,7 +22,7 @@ jobs:
|
||||
run: python tools/check-i18n.py
|
||||
- name: Shell syntax
|
||||
shell: bash
|
||||
run: for f in install.sh uninstall.sh tools/i18n.sh tools/self-update.sh tools/linux-mode.sh tools/answers.sh tools/releases.sh tools/gui-launch.sh android/magisk/installer/mu300-install.sh android/magisk/installer/customize.sh tools/android-boot-image.sh tools/make-magisk-zips.sh; do sh -n "$f"; done
|
||||
run: for f in install.sh uninstall.sh tools/i18n.sh tools/self-update.sh tools/linux-mode.sh tools/answers.sh tools/releases.sh tools/gui-launch.sh tools/package.sh android/magisk/computer/start.sh android/magisk/computer/start-gui.sh android/magisk/computer/uninstall-linux.sh android/magisk/installer/mu300-install.sh android/magisk/installer/customize.sh tools/android-boot-image.sh tools/make-magisk-zips.sh; do sh -n "$f"; done
|
||||
- name: PowerShell 5.1 parse
|
||||
shell: powershell
|
||||
run: |
|
||||
|
||||
@@ -479,6 +479,10 @@ adbd (platform-tools 34.0.5), built static for both systems by `tools/adbd/build
|
||||
|
||||
### Installing from Android with a Magisk zip
|
||||
|
||||
**A zip has two ways in.** Installed as it is in Magisk, on the device, it installs its system and kernel there (this
|
||||
section). Unpacked on a computer, it is the computer's installer with that system and kernel in it, offline - see
|
||||
[A Magisk zip on a computer](#a-magisk-zip-on-a-computer) below.
|
||||
|
||||
If the device already runs a rooted Android with Magisk 26 or newer, Linux can be installed from the device itself,
|
||||
without a computer: from the Magisk app (reached through scrcpy, a web panel or a phone running adb) or from
|
||||
`adb shell`. The zips are built from the files of a release by the "Magisk installers" workflow
|
||||
@@ -526,6 +530,31 @@ After a successful install the zip stays as the Magisk module "MU300 Linux" (the
|
||||
[android/magisk/README.md](android/magisk/README.md), same id): its Action button and `su -c mu300-linux` start
|
||||
Linux from Android later.
|
||||
|
||||
#### A Magisk zip on a computer
|
||||
|
||||
Unpack the **whole** zip into a folder and start `start.cmd` (Windows) or `sh start.sh` (macOS, Linux);
|
||||
`start-gui.cmd` / `sh start-gui.sh` open the graphical installer's window straight away, and `uninstall-linux.cmd` /
|
||||
`sh uninstall-linux.sh` start the uninstaller. `START-HERE.md` in the zip says the same in English, Turkish and
|
||||
Chinese.
|
||||
|
||||
* It is this project's `install.sh` / `install.ps1` and the graphical installer, in the zip's `computer/` folder, of
|
||||
the release the zip belongs to. `computer/.mu300-package` tells them that the zip's payload is next to them
|
||||
(`MU300_PACKAGE=DIR`, `./install.sh --package DIR` or `.\install.ps1 -Package DIR` name another unpacked zip;
|
||||
`tools/package.sh`).
|
||||
* It installs exactly the system and the kernel of that zip, from its `payload/`, and downloads nothing: both files
|
||||
must have the checksum the zip's `mu300/manifest` names and the one the release's `mu300/SHA256SUMS` names. There
|
||||
is no question about the system, the kernel or the release, and the installer does not update itself. Everything
|
||||
else is the installer as always: the device's own Wi-Fi and modem files are read, the summary is shown and nothing
|
||||
is written before `INSTALL`.
|
||||
* The VPN module, when it is asked for, is still a download (it is not part of a zip), and the web panel for Ubuntu
|
||||
is not offered (add it later: `sudo mu300-extra install panel`).
|
||||
* **adb is not in the zip**: Google's platform-tools are under the Android SDK licence, whose section 3.4 does not
|
||||
allow passing them on. Download them from https://developer.android.com/tools/releases/platform-tools and unpack
|
||||
them into the zip's folder (`platform-tools/adb` next to `START-HERE.md`), or have adb on the PATH. The computer
|
||||
also needs Python 3.8+ and lz4 (Windows: the installer installs both when missing, which needs the internet once).
|
||||
* The computer's side adds about 0.33 MB to a zip (68 files); the payload is in it once. Magisk never sees it: its
|
||||
`customize.sh` unpacks only `module.prop`, `mu300/`, the switch module and `system/` (FINDINGS 111).
|
||||
|
||||
**What is written.** Linux goes to its own place: a free region of the internal storage behind the partitions, or an
|
||||
SD card (a card that already holds a Linux installation of this project is used first, as the device does when it
|
||||
boots). Beyond that:
|
||||
|
||||
@@ -8,7 +8,9 @@ boot slot. There are two ways to get it:
|
||||
the install it is called "MU300 Linux" instead of "MU300 Linux switch"; the module id is the same
|
||||
(`mu300_linux_switch`), so the two replace each other. The Action button, `mu300-linux` and everything below work
|
||||
the same. Their files come from this directory (`installer/` is the installation part, `mu300-linux-switch/` is
|
||||
this module), assembled by `tools/make-magisk-zips.sh`.
|
||||
this module), assembled by `tools/make-magisk-zips.sh`. Unpacked on a computer, the same zip is the computer's
|
||||
installer for its system and kernel (`computer/`, `START-HERE.md` and the launchers; `computer/files.txt` here lists
|
||||
what goes in, and the README's "A Magisk zip on a computer" says how it is used).
|
||||
* **The switch-only module**, for a device where Linux was installed from a computer (`./install.sh`). It installs
|
||||
nothing and only changes the boot slot:
|
||||
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
# MU300 Linux @TAG@: @SYSTEM@, kernel @KERNEL@
|
||||
|
||||
[English](#english) · [Türkçe](#türkçe) · [中文](#中文)
|
||||
|
||||
## English
|
||||
|
||||
This zip installs **@SYSTEM@ with kernel @KERNEL@** (release @TAG@) on a ZTE F50 / MU300, U30 Air or V50 that runs
|
||||
a rooted Android (Magisk 26 or newer). It can be used in two ways:
|
||||
|
||||
**1. On the device, with Magisk (no computer).** Do not unpack the zip. Put it on the device and open it in the Magisk
|
||||
app (Modules, Install from storage), or run `su -c 'magisk --install-module /sdcard/Download/<this zip>'`.
|
||||
|
||||
**2. From a computer.** Unpack the whole zip into a folder, connect the device by USB (USB debugging on, Magisk
|
||||
letting "Shell" have root) and start:
|
||||
|
||||
| | the installer | in a window |
|
||||
|---|---|---|
|
||||
| Windows | `start.cmd` | `start-gui.cmd` |
|
||||
| macOS, Linux | `sh start.sh` | `sh start-gui.sh` |
|
||||
|
||||
It installs exactly the system and the kernel of this zip, from the files in it (`payload/`), and downloads nothing:
|
||||
both files are checked against `mu300/manifest` and the release's `mu300/SHA256SUMS` first. The rest is the
|
||||
project's installer as always: it reads the device's own Wi-Fi and modem files, shows what it will write and waits for
|
||||
`INSTALL`. `uninstall-linux.cmd` / `sh uninstall-linux.sh` remove Linux again.
|
||||
|
||||
What the computer needs:
|
||||
|
||||
* **adb**: Google's platform-tools are not in this zip (their licence does not allow passing them on). Download them
|
||||
from https://developer.android.com/tools/releases/platform-tools and unpack them into this folder, so that
|
||||
`platform-tools/adb` (Windows: `platform-tools\adb.exe`) is next to this file - or have adb on the PATH.
|
||||
* **Python 3.8 or newer** and **lz4**. On Windows the installer installs both when they are missing (that needs the
|
||||
internet once); on macOS `brew install python lz4`, on Linux `python3` and `lz4` from the package manager. The
|
||||
window needs Python's tkinter too; the installer says how to get it.
|
||||
|
||||
More: https://github.com/dikeckaan/mu300-linux (README, wiki: Installation).
|
||||
|
||||
## Türkçe
|
||||
|
||||
Bu zip, rootlu Android (Magisk 26 veya daha yeni) çalışan bir ZTE F50 / MU300, U30 Air veya V50'ye **@SYSTEM@ ve
|
||||
@KERNEL@ çekirdeğini** (sürüm @TAG@) kurar. İki şekilde kullanılır:
|
||||
|
||||
**1. Cihazda, Magisk ile (bilgisayarsız).** Zip'i açmayın. Cihaza koyup Magisk uygulamasında açın (Modüller,
|
||||
Depolamadan yükle) ya da `su -c 'magisk --install-module /sdcard/Download/<bu zip>'` çalıştırın.
|
||||
|
||||
**2. Bilgisayardan.** Zip'in tamamını bir klasöre açın, cihazı USB ile bağlayın (USB hata ayıklama açık, Magisk
|
||||
"Shell"e root veriyor) ve başlatın: Windows'ta `start.cmd` (pencereyle: `start-gui.cmd`), macOS ve Linux'ta
|
||||
`sh start.sh` (pencereyle: `sh start-gui.sh`).
|
||||
|
||||
Yalnızca bu zip'teki sistemi ve çekirdeği, içindeki dosyalardan (`payload/`) kurar, hiçbir şey indirmez: iki dosya da
|
||||
önce `mu300/manifest` ve sürümün `mu300/SHA256SUMS` dosyasıyla doğrulanır. Gerisi projenin her zamanki kurulum
|
||||
programıdır: cihazın kendi Wi-Fi ve modem dosyalarını okur, ne yazacağını gösterir ve `INSTALL` bekler. Linux'u
|
||||
kaldırmak için: `uninstall-linux.cmd` / `sh uninstall-linux.sh`.
|
||||
|
||||
Bilgisayarda gerekenler: **adb** (Google'ın platform-tools paketi bu zip'te yok, lisansı dağıtıma izin vermiyor:
|
||||
https://developer.android.com/tools/releases/platform-tools adresinden indirip bu klasöre açın, `platform-tools/adb`
|
||||
bu dosyanın yanında olsun, ya da adb PATH'te olsun), **Python 3.8+** ve **lz4** (Windows'ta eksikse kurulum programı
|
||||
kurar, bir kez internet gerekir; macOS'ta `brew install python lz4`, Linux'ta paket yöneticisinden). Pencere için
|
||||
Python'un tkinter'i de gerekir.
|
||||
|
||||
## 中文
|
||||
|
||||
本 zip 在运行已 root 的 Android(Magisk 26 或更新)的 ZTE F50 / MU300、U30 Air 或 V50 上安装 **@SYSTEM@,内核
|
||||
@KERNEL@**(版本 @TAG@)。有两种用法:
|
||||
|
||||
**1. 在设备上用 Magisk 安装(无需电脑)。** 不要解压。把 zip 放到设备上,在 Magisk 应用中打开(模块 → 从本地安装),
|
||||
或运行 `su -c 'magisk --install-module /sdcard/Download/<本 zip>'`。
|
||||
|
||||
**2. 在电脑上安装。** 把整个 zip 解压到一个文件夹,用 USB 连接设备(打开 USB 调试,Magisk 允许 Shell 获取 root),
|
||||
然后运行:Windows 上 `start.cmd`(图形界面:`start-gui.cmd`),macOS 和 Linux 上 `sh start.sh`(图形界面:
|
||||
`sh start-gui.sh`)。
|
||||
|
||||
它只安装本 zip 中的系统和内核,使用 zip 自带的文件(`payload/`),不下载任何东西:两个文件都会先按 `mu300/manifest`
|
||||
和该版本的 `mu300/SHA256SUMS` 校验。其余与本项目的安装程序相同:读取设备自己的 Wi-Fi 和基带文件,显示将要写入的内容,
|
||||
等待输入 `INSTALL`。卸载 Linux:`uninstall-linux.cmd` / `sh uninstall-linux.sh`。
|
||||
|
||||
电脑需要:**adb**(本 zip 不含 Google 的 platform-tools,其许可不允许再分发:请从
|
||||
https://developer.android.com/tools/releases/platform-tools 下载并解压到本文件夹,使 `platform-tools/adb` 与本文件
|
||||
同级,或把 adb 加入 PATH)、**Python 3.8+** 和 **lz4**(Windows 上缺少时安装程序会自动安装,需要联网一次;macOS:
|
||||
`brew install python lz4`;Linux:用包管理器安装)。图形界面还需要 Python 的 tkinter。
|
||||
@@ -0,0 +1,49 @@
|
||||
# The files of this project that go into every Magisk zip as computer/ (tools/make-magisk-zips.sh): the installers
|
||||
# for a computer, their tools and the graphical installer - what install.sh, install.ps1, the two uninstallers and gui/
|
||||
# use when they install from the zip's own files (tools/package.sh). One path per line, relative to the top of the
|
||||
# project; a directory stands for every file in it. Not here: what only --build uses (docker, the kernel, the systems'
|
||||
# sources), and nothing of the payload, which the zip has once, in payload/. tests/test_magisk_zip.py checks that every
|
||||
# file these scripts name is in the list.
|
||||
install.sh
|
||||
install.ps1
|
||||
install.cmd
|
||||
uninstall.sh
|
||||
uninstall.ps1
|
||||
uninstall.cmd
|
||||
LICENSE
|
||||
tools/answers.sh
|
||||
tools/answers.ps1
|
||||
tools/i18n.sh
|
||||
tools/storage.sh
|
||||
tools/releases.sh
|
||||
tools/release_pick.py
|
||||
tools/package.sh
|
||||
tools/self-update.sh
|
||||
tools/gui-launch.sh
|
||||
tools/gui-launch.ps1
|
||||
tools/linux-mode.sh
|
||||
tools/android-bootchain.sh
|
||||
tools/android-install.sh
|
||||
tools/android-mount-mu300root.sh
|
||||
tools/install-magisk-module.sh
|
||||
tools/resize-last-partition.py
|
||||
tools/vendor-overlay.py
|
||||
tools/sha512crypt.py
|
||||
tools/backup-device.sh
|
||||
android-vendor/extract-subset.sh
|
||||
android-vendor/extract-gpu-subset.sh
|
||||
android-vendor/extract_subset.py
|
||||
android-vendor/pull_closure.py
|
||||
android-vendor/subset-files.txt
|
||||
android-vendor/gpu-files.txt
|
||||
android-vendor/ueventd-perms.sh
|
||||
boot/init
|
||||
boot/build-boot-image.py
|
||||
boot/module-order.txt
|
||||
boot/module-order-u30air.txt
|
||||
i18n/tr.tsv
|
||||
i18n/zh.tsv
|
||||
gui/mu300-gui.py
|
||||
gui/mu300gui
|
||||
android/magisk/mu300-linux-switch
|
||||
rootfs/overlay/opt/mu300/lib/vpn-orphan.sh
|
||||
@@ -0,0 +1,13 @@
|
||||
@echo off
|
||||
rem MU300 Linux from this zip, on a Windows computer, in a window: the graphical installer, with the system and the
|
||||
rem kernel of this zip, from its own files. It needs a Python 3.8 or newer with tkinter; the installer looks for one,
|
||||
rem offers to install it with winget, and goes on as the text installer when there is no window to be had.
|
||||
rem START-HERE.md says more.
|
||||
setlocal
|
||||
set "MU300_PACKAGE=%~dp0."
|
||||
set "MU300_GUI=1"
|
||||
if exist "%~dp0platform-tools\adb.exe" set "PATH=%~dp0platform-tools;%PATH%"
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0computer\install.ps1" %*
|
||||
set "MU300_RC=%ERRORLEVEL%"
|
||||
if not "%MU300_RC%"=="0" pause
|
||||
exit /b %MU300_RC%
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
# MU300 Linux from this zip, on a macOS or Linux computer, in a window: the graphical installer, with the system and
|
||||
# the kernel of this zip, from its own files. It needs a Python 3.8 or newer with tkinter; the installer looks for one,
|
||||
# offers the command that adds tkinter where it is missing, and goes on as the text installer when there is no window
|
||||
# to be had. START-HERE.md says more.
|
||||
HERE=$(cd "$(dirname "$0")" && pwd)
|
||||
# adb from Google's platform-tools unpacked into this folder (platform-tools/adb) needs no PATH entry
|
||||
if [ -x "$HERE/platform-tools/adb" ]; then PATH="$HERE/platform-tools:$PATH"; export PATH; fi
|
||||
MU300_PACKAGE=$HERE
|
||||
MU300_GUI=1
|
||||
export MU300_PACKAGE MU300_GUI
|
||||
exec sh "$HERE/computer/install.sh" "$@"
|
||||
@@ -0,0 +1,12 @@
|
||||
@echo off
|
||||
rem MU300 Linux from this zip, on a Windows computer: the installer, with the system and the kernel of this zip, from
|
||||
rem its own files - nothing is downloaded. It asks first whether to open its window (start-gui.cmd opens it without
|
||||
rem asking). START-HERE.md says what it needs. Options are install.ps1's: start.cmd -Check
|
||||
setlocal
|
||||
set "MU300_PACKAGE=%~dp0."
|
||||
rem adb from Google's platform-tools unpacked into this folder (platform-tools\adb.exe) needs no PATH entry
|
||||
if exist "%~dp0platform-tools\adb.exe" set "PATH=%~dp0platform-tools;%PATH%"
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0computer\install.ps1" %*
|
||||
set "MU300_RC=%ERRORLEVEL%"
|
||||
pause
|
||||
exit /b %MU300_RC%
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# MU300 Linux from this zip, on a macOS or Linux computer: the installer, with the system and the kernel of this zip,
|
||||
# from its own files - nothing is downloaded. It asks first whether to open its window (start-gui.sh opens it without
|
||||
# asking). START-HERE.md says what it needs. Options are install.sh's: sh start.sh --check, sh start.sh --help.
|
||||
HERE=$(cd "$(dirname "$0")" && pwd)
|
||||
# adb from Google's platform-tools unpacked into this folder (platform-tools/adb) needs no PATH entry
|
||||
if [ -x "$HERE/platform-tools/adb" ]; then PATH="$HERE/platform-tools:$PATH"; export PATH; fi
|
||||
MU300_PACKAGE=$HERE
|
||||
export MU300_PACKAGE
|
||||
exec sh "$HERE/computer/install.sh" "$@"
|
||||
@@ -0,0 +1,9 @@
|
||||
@echo off
|
||||
rem Remove MU300 Linux from the device again, from a Windows computer: the project's uninstaller (it asks before
|
||||
rem anything is written; START-HERE.md). Options are uninstall.ps1's.
|
||||
setlocal
|
||||
if exist "%~dp0platform-tools\adb.exe" set "PATH=%~dp0platform-tools;%PATH%"
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0computer\uninstall.ps1" %*
|
||||
set "MU300_RC=%ERRORLEVEL%"
|
||||
pause
|
||||
exit /b %MU300_RC%
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# Remove MU300 Linux from the device again, from a macOS or Linux computer: the project's uninstaller (it asks before
|
||||
# anything is written; START-HERE.md). Options are uninstall.sh's: sh uninstall-linux.sh --help.
|
||||
HERE=$(cd "$(dirname "$0")" && pwd)
|
||||
if [ -x "$HERE/platform-tools/adb" ]; then PATH="$HERE/platform-tools:$PATH"; export PATH; fi
|
||||
exec sh "$HERE/computer/uninstall.sh" "$@"
|
||||
@@ -69,6 +69,46 @@ def lz4_legacy(data):
|
||||
return bytes(out)
|
||||
|
||||
|
||||
def unlz4_legacy(data):
|
||||
"""LZ4 legacy frames (the magic, then blocks of <u32 length><LZ4 block>) back to bytes: the lz4 command, else the
|
||||
lz4 Python module, as lz4_legacy."""
|
||||
try:
|
||||
return subprocess.run(['lz4', '-dc'], input=data, capture_output=True, check=True).stdout
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
except subprocess.CalledProcessError:
|
||||
sys.exit('an appended ramdisk segment does not decompress')
|
||||
try:
|
||||
import lz4.block
|
||||
except ImportError:
|
||||
sys.exit("need the 'lz4' command or the lz4 Python module (pip install lz4)")
|
||||
out, i = bytearray(), 0
|
||||
while i < len(data):
|
||||
if data[i:i + 4] != bytes.fromhex('02214c18'):
|
||||
sys.exit('an appended ramdisk segment is not LZ4 legacy')
|
||||
i += 4
|
||||
while i + 4 <= len(data) and data[i:i + 4] != bytes.fromhex('02214c18'):
|
||||
n = struct.unpack_from('<I', data, i)[0]
|
||||
out += lz4.block.decompress(data[i + 4:i + 4 + n], uncompressed_size=8 << 20)
|
||||
i += 4 + n
|
||||
return bytes(out)
|
||||
|
||||
|
||||
def cpio_names(data):
|
||||
"""The names of a newc cpio archive (a ramdisk segment, decompressed)."""
|
||||
names, i = set(), 0
|
||||
while i + 110 <= len(data) and data[i:i + 6] == b'070701':
|
||||
size, nlen = int(data[i + 54:i + 62], 16), int(data[i + 94:i + 102], 16)
|
||||
name = data[i + 110:i + 110 + nlen - 1].decode('utf-8', 'replace')
|
||||
if name == 'TRAILER!!!':
|
||||
break
|
||||
names.add(name)
|
||||
i += 110 + nlen
|
||||
i += (-i) % 4
|
||||
i += size + (-size) % 4
|
||||
return names
|
||||
|
||||
|
||||
def cpio_archive(dirs, files):
|
||||
cpio = bytearray()
|
||||
ino = 1
|
||||
@@ -120,7 +160,8 @@ def main():
|
||||
ap.add_argument('--generic-ramdisk', action='store_true',
|
||||
help='write only the device-independent ramdisk segment (init, busybox, modules) to --out, for '
|
||||
'mu300-update to put behind the ramdisk of the boot image already on the device')
|
||||
ap.add_argument('--modules', required=True, type=Path, help='flat directory with the built .ko files')
|
||||
ap.add_argument('--modules', type=Path, help='flat directory with the built .ko files (may be left out with '
|
||||
'--append-ramdisk: that segment brings the modules and their order)')
|
||||
ap.add_argument('--module-order', type=Path, default=HERE / 'module-order.txt')
|
||||
ap.add_argument('--device-modules', action='append', default=[], metavar='NAME=DIR',
|
||||
help='modules built for another device of this family (u30air=out/u30air): they go to '
|
||||
@@ -135,8 +176,9 @@ def main():
|
||||
help='for experiments only: reboot SECONDS after switch_root unless /run/stay exists (with a '
|
||||
'one-shot trial, that is back to Android when the kernel boots without USB)')
|
||||
ap.add_argument('--init', type=Path, default=HERE / 'init')
|
||||
ap.add_argument('--busybox', required=True, type=Path, help='static arm64 busybox')
|
||||
ap.add_argument('--logdw', required=True, type=Path, help='tools/logdw build (static arm64)')
|
||||
ap.add_argument('--busybox', type=Path, help='static arm64 busybox (may be left out with --append-ramdisk, when '
|
||||
'that segment brings one)')
|
||||
ap.add_argument('--logdw', type=Path, help='tools/logdw build (static arm64; may be left out as --busybox)')
|
||||
ap.add_argument('--ueventd-perms', required=True, type=Path)
|
||||
ap.add_argument('--android-subset', type=Path, help='directory produced by android-vendor/extract-subset.sh')
|
||||
ap.add_argument('--append-ramdisk', type=Path,
|
||||
@@ -147,20 +189,37 @@ def main():
|
||||
a = ap.parse_args()
|
||||
if not a.generic_ramdisk and not (a.stock_boot and a.misc_head and a.kernel):
|
||||
ap.error('--stock-boot, --misc-head and --kernel are required unless --generic-ramdisk is given')
|
||||
# Without the 5.4 bundle (a Magisk zip of a mainline kernel, unpacked on a computer: tools/package.sh) the first
|
||||
# segment carries no busybox, logdw or modules of its own: the kernel's generic segment, unpacked after it, brings
|
||||
# them - and replaces what the first one has of them in any case. So it must bring every one that is left out.
|
||||
missing = [n for n, v in (('modules', a.modules), ('busybox', a.busybox), ('logdw', a.logdw)) if v is None]
|
||||
if missing:
|
||||
if a.generic_ramdisk or not a.append_ramdisk:
|
||||
ap.error('--' + ', --'.join(missing) + ' can be left out only with --append-ramdisk')
|
||||
names = cpio_names(unlz4_legacy(a.append_ramdisk.read_bytes()))
|
||||
want = {'busybox': ['bin/busybox'], 'logdw': ['bin/logdw'], 'modules': ['etc/module-order', 'init']}
|
||||
for n in missing:
|
||||
for f in want[n]:
|
||||
if f not in names:
|
||||
sys.exit(f'{a.append_ramdisk} has no {f}: --{n} is needed')
|
||||
|
||||
def text(path): # scripts and lists for the device's shell, LF whatever the checkout did (issue #7)
|
||||
return path.read_bytes().replace(b'\r\n', b'\n')
|
||||
|
||||
files = {
|
||||
'init': (text(a.init), stat.S_IFREG | 0o755),
|
||||
'bin/busybox': (a.busybox.read_bytes(), stat.S_IFREG | 0o755),
|
||||
'bin/sh': (b'busybox', stat.S_IFLNK | 0o777),
|
||||
'bin/logdw': (a.logdw.read_bytes(), stat.S_IFREG | 0o755),
|
||||
'etc/ueventd-perms.sh': (text(a.ueventd_perms), stat.S_IFREG | 0o755),
|
||||
'etc/module-order': (text(a.module_order), stat.S_IFREG | 0o644),
|
||||
}
|
||||
if a.busybox:
|
||||
files['bin/busybox'] = (a.busybox.read_bytes(), stat.S_IFREG | 0o755)
|
||||
if a.logdw:
|
||||
files['bin/logdw'] = (a.logdw.read_bytes(), stat.S_IFREG | 0o755)
|
||||
order = a.module_order.read_text().split() if a.modules else []
|
||||
if a.modules:
|
||||
files['etc/module-order'] = (text(a.module_order), stat.S_IFREG | 0o644)
|
||||
dirs = {'bin', 'sbin', 'etc', 'proc', 'sys', 'dev', 'run', 'tmp', 'root', 'config', 'linux-modules'}
|
||||
for name in a.module_order.read_text().split():
|
||||
for name in order:
|
||||
ko = a.modules / name
|
||||
if not ko.exists():
|
||||
sys.exit(f'missing module {ko}')
|
||||
@@ -179,7 +238,7 @@ def main():
|
||||
if ko.exists():
|
||||
files[f'linux-modules/{dev}/{name}'] = (ko.read_bytes(), stat.S_IFREG | 0o644)
|
||||
elif 'linux-modules/' + name not in files:
|
||||
if not (a.modules / name).exists():
|
||||
if not a.modules or not (a.modules / name).exists():
|
||||
sys.exit(f'missing module {name} for {dev} (neither {ko} nor in --modules)')
|
||||
files['linux-modules/' + name] = ((a.modules / name).read_bytes(), stat.S_IFREG | 0o644)
|
||||
if a.trial_guard and a.generic_ramdisk:
|
||||
@@ -306,7 +365,7 @@ def main():
|
||||
'sha256_head48m': hashlib.sha256(image[:PERSIST_LOG_OFFSET]).hexdigest(),
|
||||
'kernel_sha256': hashlib.sha256(kern).hexdigest(),
|
||||
'ramdisk_size': len(ram),
|
||||
'modules': len(a.module_order.read_text().split()),
|
||||
'modules': len(order),
|
||||
'misc_slot_b_trial_hex': linux_b_bc.hex(),
|
||||
'misc_slot_a_hex': android_a_bc.hex(),
|
||||
'misc_slot_b_hex': android_b_bc.hex(),
|
||||
|
||||
@@ -139,6 +139,7 @@ what replaced it. The table below gives each section's state.
|
||||
| 83 | An update dropped the jobs of OpenWrt's System > Scheduled Tasks (`/etc/crontabs`) | current (fixed; a user's report of the symptom, unit tests only) |
|
||||
| 86 | Updating from the panel: System > Update, an update from a file (a release's Magisk zip), and release signatures (`SHA256SUMS.sig`) | current (unit tests, a page test under Node, the commands in the image's container; the device protocol run on a U30 Air on openwrt-luci, 2026-10-15; F50 and Ubuntu not run) |
|
||||
| 95 | The ZTE V50 (MU3351), experimental: how it is told apart, and what kano measured on his (f6b0668d, 0438ab01) | experimental; nothing of it measured by this project (no V50 here): unit tests, the device trees of an F50 and a U30 Air, both mainline kernels built |
|
||||
| 111 | One zip, two ways in: Magisk on the device, or unpacked on a computer as the computer's installer (kano's two-entry package, `f6b0668d`); adb not bundled | current (unit and integration tests, the release's real zips built both ways and compared; no install from an unpacked zip on a device) |
|
||||
|
||||
## Hardware and firmware facts
|
||||
|
||||
@@ -6527,3 +6528,84 @@ another cause than runtime PM.
|
||||
4. `ls /sys/class/leds` has `v50:net1:*`, `v50:wifi:*`; `sudo mu300-led test` lights each lamp in turn.
|
||||
5. Mobile data on SIM 1, the hotspot on 5 GHz and 2.4 GHz (the Wi-Fi lamp white, then blue).
|
||||
6. Several reboots, then `sudo dumpe2fs -h` of the Linux filesystem: `FS Error count` absent or 0, files kept.
|
||||
|
||||
|
||||
## A Magisk zip on a computer
|
||||
|
||||
### 111. One zip, two ways in: Magisk on the device, or unpacked on a computer as the computer's installer
|
||||
|
||||
**Status: current; unit and integration tests only - no device was used (other work had the devices).** The owner
|
||||
asked for kano's two-entry package for this project's zips: kano (kanoqwq, branch `clean-tf-7.2`, MIT) ships one ZIP
|
||||
that Magisk installs and that, unpacked, is a desktop installer (`f6b0668d` "add desktop deployment", `53ef7b1a`,
|
||||
`1f8f03fb`, `0e19fe32`). His was read, none of it run, no binary of it taken.
|
||||
|
||||
**What a zip is now.** Everything it held stays where it was, byte for byte, with the same zip modes (checked: the 11
|
||||
zips of v2026.10.27 built with `tools/make-magisk-zips.sh` of `main` and of this change differ in the new entries and
|
||||
in `mu300/i18n/*.tsv`, which gained this change's translations, and in nothing else). Added at the top:
|
||||
`START-HERE.md` (the zip's system, kernel and release written in; English, Turkish, Chinese), `start.sh`/`start.cmd`,
|
||||
`start-gui.sh`/`start-gui.cmd`, `uninstall-linux.sh`/`.cmd`, and `computer/`: the project's installers for a computer
|
||||
(`android/magisk/computer/files.txt`: `install.sh`, `install.ps1`, the uninstallers, their `tools/`, `boot/init` and
|
||||
`build-boot-image.py`, the vendor extractors, `i18n/`, `gui/`, the switch module) with `computer/.mu300-package`.
|
||||
68 files, 0.99 MB unpacked, **0.33 MB** more per zip (v2026.10.27: 331 412 to 331 422 bytes). The payload is in a
|
||||
zip once: the computer's installer reads `payload/` where it is.
|
||||
|
||||
**Why Magisk cannot see it.** `customize.sh` sets `SKIPUNZIP=1` and unpacks exactly `mu300/*`, `module.prop`,
|
||||
`action.sh`, `switch.sh`, `bootchain.sh` and `system/*`; nothing added is under those names. A test runs
|
||||
`customize.sh` in a fake Magisk environment on a zip built with the computer's side and on the same zip without it -
|
||||
a dry run and a whole installation on the fake device - and compares the output, `boot_a`, `misc`, what `boot_b`
|
||||
holds and the module: equal (`tests/test_magisk_zip.py`, `MagiskPathUnchanged`). The release's real zips, both
|
||||
builds, also pass `ReleaseZips` (each zip's own installer, a dry run). The web installer's `zip.js` reads the central
|
||||
directory only for `mu300/manifest` and `mu300/install.sh`: a test reads the 11 built zips with it.
|
||||
|
||||
**How the computer's side installs that zip's system and kernel.** `tools/package.sh` (and the same in `install.ps1`,
|
||||
and `gui/mu300gui/package.py` for the window): the package is `MU300_PACKAGE`, `--package DIR` / `-Package DIR`, or
|
||||
the folder above `computer/` when `.mu300-package` is there (the launchers set `MU300_PACKAGE` to their own folder
|
||||
and put `platform-tools/` on the PATH when it is there). Its `mu300/manifest` is read as the zip's own installer reads
|
||||
it (only its nine keys, never sourced, every value exactly one a release has - they become file names; Ubuntu 26.04
|
||||
with 5.4 refused). Then: no self-update (the installer that came with the files is the one that knows them), the
|
||||
release is the manifest's tag, and the questions of the system, Ubuntu, kernel, release, beta and web panel are not
|
||||
put. At the `download` step both payload files must have the checksum the manifest names **and** the one the
|
||||
release's `mu300/SHA256SUMS` names (`verify` events; a mismatch or a missing file stops the run before anything is
|
||||
written). The VPN module stays a download when it is asked for; the web panel is a release file, not a zip's. A
|
||||
V50 with a 5.4 zip is refused at the choices, with the zip to take.
|
||||
|
||||
**The boot image without the 5.4 bundle.** `install.sh` always unpacked `mu300-kernel.tar.gz` for the first ramdisk
|
||||
segment's busybox, logdw and 5.4 modules, even with a mainline kernel - and a 6.18 or 7.2 zip has no 5.4 bundle (it
|
||||
would add 27 MB to 8 zips). Under a mainline kernel those three are dead weight: the kernel's generic segment is
|
||||
unpacked after the first and brings its own `bin/busybox`, `bin/logdw`, `etc/module-order`, modules and `init`
|
||||
(this checkout's `init` goes behind both, as before). The zip's own Magisk installer never put them in (its device
|
||||
segment plus the bundle's generic one). So `build-boot-image.py` now takes `--busybox`, `--logdw` and `--modules`
|
||||
as optional **only with `--append-ramdisk`**, and then decompresses that segment and refuses when it lacks any of
|
||||
`bin/busybox`, `bin/logdw`, `etc/module-order`, `init`. A package with a mainline kernel builds the image that way;
|
||||
everything else (every copy of the project, a 5.4 package) builds it exactly as before. Checked with the real 7.2
|
||||
bundle of v2026.10.27: built, 1 879 018 bytes of ramdisk, no 5.4 module in it.
|
||||
|
||||
**adb: not bundled.** Google's platform-tools come under the Android Software Development Kit License Agreement
|
||||
(https://developer.android.com/studio/terms), section 3.4: "you may not copy (except for backup purposes), modify,
|
||||
adapt, redistribute, decompile, reverse engineer, disassemble, or create derivative works of the SDK or any part of
|
||||
the SDK", except "to the extent required by applicable third party licenses"; 3.5 leaves the open-source components
|
||||
to their own licences. adb's source is Apache-2.0, but the prebuilt binaries and the Windows USB DLLs are Google's
|
||||
SDK distribution - not clearly allowed, so not bundled. kano's GUI release does bundle `adb.exe` and its two DLLs
|
||||
with an `ADB-NOTICE.txt` (`installer/platform-tools.json` pins platform-tools r37.0.1). Here `START-HERE.md` says
|
||||
where to download them and to unpack them into the zip's folder; `find_adb` / `FindAdb` and the launchers find
|
||||
`platform-tools/adb` there.
|
||||
|
||||
**kano's and this one.** His package moves the original Magisk files into `payload/` and wraps them with a
|
||||
path-switching `customize.sh`; his desktop installer (`desktop/installer.py`, an EXE when built) is a deployment of
|
||||
its own - TF card, a userdata image, a GPT partition, offline shrink in a desktop initramfs, reset and resume, SSH
|
||||
updates - for OpenWrt only, with a filtered copy of the rootfs prepared on the computer. Here the Magisk files stay
|
||||
where they are, and the computer's side is this project's installers, which already handle every system, the SD
|
||||
card, the free region, the boot chain and the GUI, pointed at the zip's payload: nothing of the install logic is
|
||||
duplicated. Not taken: his EXE, his own deployment modes, the bundled adb (above); his reset-and-resume flow is
|
||||
§112's subject.
|
||||
|
||||
**Tests.** `tests/test_magisk_zip.py` (the computer's side: files, CRLF launchers, exec bits, `START-HERE.md`, no
|
||||
platform-tools, the list covers every file the installers name; `MagiskPathUnchanged`), `tests/test_package.py`
|
||||
(`tools/package.sh`; `computer/install.sh` of real built zips against the fake adb, as far as the first pull: no
|
||||
question about the system or kernel, the facts, a V50 and a 5.4 zip, a damaged manifest, `--build`, `start.sh`; the
|
||||
window's choices and answers), `tests/test_boot_image.py` (the image without the 5.4 bundle, and the refusals),
|
||||
`tests/web/logic.test.mjs` and `tests/test_web_installer.py` (zip.js), `tests/installer.Tests.ps1` and
|
||||
`tests/answers.Tests.ps1` (the PowerShell side).
|
||||
|
||||
**Not measured.** An install from an unpacked zip on a device, on any platform; Windows Explorer's unpacking (the
|
||||
launchers are CRLF and need no exec bit there; macOS and Linux keep the bits, and `sh start.sh` needs none).
|
||||
@@ -101,6 +101,14 @@ The variables that were there before work as they did (`MU300_WORK`, `MU300_RELE
|
||||
`MU300_VPN_URL`, `MU300_VPN_MODULE`, `MU300_FETCH_JOBS`, `MU300_NO_SELF_UPDATE`); `install.ps1` now reads
|
||||
`MU300_LANG`, `MU300_RELEASE`, `MU300_RELEASE_URL` and `MU300_WORK` where its parameters are not given.
|
||||
|
||||
**An unpacked Magisk zip** (`MU300_PACKAGE=DIR`, `--package DIR` / `-Package DIR`, or the zip's own `computer/`
|
||||
with its `.mu300-package`; `tools/package.sh`): the system, the Ubuntu, the kernel and the release are the zip's, so
|
||||
`MU300_ANS_SYSTEMS`, `MU300_OPENWRT`, `MU300_ANS_BOOT_OS`, `MU300_ANS_UBUNTU`, `MU300_ANS_KERNEL`, `MU300_ANS_BETA` and
|
||||
`MU300_ANS_PANEL` are never asked (and `MU300_RELEASE`, `MU300_RELEASE_URL` are not used): a program sets only the
|
||||
others. The `download` step checks the two files of the zip instead (`verify` events, `ok` or `mismatch`), and a
|
||||
manifest that is not one of a release's stops the run before the device is asked anything. The graphical installer
|
||||
started from such a folder offers that system and kernel only.
|
||||
|
||||
### The variables of `uninstall.sh` / `uninstall.ps1`
|
||||
|
||||
| variable | values | the question |
|
||||
@@ -167,6 +175,7 @@ The stages of an installation, in order: `preflight` 2, `storage` 6, `choices` 1
|
||||
| `verdict`, `verdict.code` | the result line of the check, and `tested`, `both`, `one`, `openwrt`, `existing`, `sd`, `dirty`, `sd-only` |
|
||||
| `makeroom.first`, `.end`, `.usable_end`, `.min_android`, `.min_linux`, `.max_linux` | where `userdata` fills the disk: its sectors, and the limits of a split, in sectors |
|
||||
| `release` | the release this run installs |
|
||||
| `package`, `package.system`, `package.kernel`, `package.release` | an unpacked Magisk zip this run installs from: its folder, and what it holds |
|
||||
| `backup.boot`, `backup.misc`, `backup.sha256` | `--backup`: the two files and the boot image's hash |
|
||||
|
||||
The facts before `root` need no root, and they are sent before the check for it: a device without root still says
|
||||
|
||||
+28
-6
@@ -674,6 +674,25 @@ class App:
|
||||
return b
|
||||
|
||||
room = ch.place_bytes(f)
|
||||
if ctl.package and ctl.package.get('error'):
|
||||
add(banner(body, _('{1} is not an unpacked Magisk zip of a release that this installer can read (its mu300/manifest is not valid). Unpack the zip again.', ctl.package['dir']), 'bad'))
|
||||
if ch.package:
|
||||
self._package_card(body, add, ch)
|
||||
else:
|
||||
self._choose_system_kernel_release(body, add, ctl, f, ch, room, check, radio)
|
||||
self._choose_rest(body, add, ctl, f, ch, check)
|
||||
|
||||
def _package_card(self, body, add, ch):
|
||||
"""An unpacked Magisk zip: what it installs, and nothing to choose about it."""
|
||||
pkg = ch.package
|
||||
names = {'openwrt': 'OpenWrt 25.12', 'openwrt-luci': _('OpenWrt with the MU300 control panel'),
|
||||
'ubuntu-24.04': 'Ubuntu 24.04 LTS', 'ubuntu-26.04': 'Ubuntu 26.04 LTS'}
|
||||
o, i = card(body, _('This package'), _('This window was started from an unpacked Magisk zip: it installs the system and the kernel of that zip, from its own files, and downloads nothing. Another system or kernel: the zip of that combination.'))
|
||||
add(o)
|
||||
facts(i, [(_('System'), names.get(pkg['system'], pkg['system'])), (_('Kernel'), pkg['kernel']), (_('Release'), pkg['tag']),
|
||||
(_('Folder'), pkg['dir']), (_('Files'), size(pkg.get('bytes', 0)))]).pack(fill='x')
|
||||
|
||||
def _choose_system_kernel_release(self, body, add, ctl, f, ch, room, check, radio):
|
||||
o, i = card(body, _('Systems'), _('One or both. With both, mu300-os switches between them later.'))
|
||||
add(o)
|
||||
check(i, 'Ubuntu LTS', 'ubuntu', _('The full distribution with apt; about 500 MiB of RAM in use. Needs {1}.', size(f.need('ubuntu'))),
|
||||
@@ -718,6 +737,7 @@ class App:
|
||||
ttk.Label(i, text=_('To download: {1} in {2} files (checked against the release\'s SHA256 sums).', size(total), len(plan)),
|
||||
style='Card.Small.TLabel').pack(anchor='w', pady=(S2, 0))
|
||||
|
||||
def _choose_rest(self, body, add, ctl, f, ch, check):
|
||||
o, i = card(body, _('Starting'))
|
||||
add(o)
|
||||
check(i, _('Start Linux by default instead of Android'), 'default_linux',
|
||||
@@ -735,8 +755,9 @@ class App:
|
||||
check(i, _('The Mali GPU (OpenCL) userspace, about 90 MiB'), 'gpu')
|
||||
check(i, _('The VPN module (about 40 MB more to download, 120 MB on the device)'), 'vpn',
|
||||
_('mu300-vpn with Xray and sing-box. A system being replaced whose VPN is on needs it: the installer stops otherwise. It can be added later: sudo mu300-extra install vpn'))
|
||||
check(i, _('The web panel for Ubuntu (about 24 MB more to download, 50 MB on the device)'), 'panel',
|
||||
_('Cockpit with an MU300 page, on the LAN only. It can be added later: sudo mu300-extra install panel'), enabled=ch.ubuntu)
|
||||
if not ch.package: # (a file of the release, not of a zip)
|
||||
check(i, _('The web panel for Ubuntu (about 24 MB more to download, 50 MB on the device)'), 'panel',
|
||||
_('Cockpit with an MU300 page, on the LAN only. It can be added later: sudo mu300-extra install panel'), enabled=ch.ubuntu)
|
||||
check(i, _('Let only this computer in over adb to Linux'), 'adb',
|
||||
_('adb to Linux over USB is on and lets every computer in: a root shell without a password for anyone who plugs in a cable. With this, only this computer\'s adb key (~/.android/adbkey.pub) is let in.'))
|
||||
|
||||
@@ -765,10 +786,11 @@ class App:
|
||||
if self.advanced:
|
||||
g = ttk.Frame(i, style='Card.TFrame')
|
||||
g.pack(fill='x', pady=(S2, 0))
|
||||
ttk.Radiobutton(g, text=_('Another release, by its tag:'), variable=self.v['release_mode'], value='tag', style='Card.TRadiobutton').grid(row=0, column=0, sticky='w')
|
||||
ttk.Entry(g, textvariable=self.v['release_tag'], width=18).grid(row=0, column=1, sticky='w', padx=S2)
|
||||
ttk.Label(g, text=_('A mirror with the release\'s files (URL):'), style='Card.TLabel').grid(row=1, column=0, sticky='w', pady=2)
|
||||
ttk.Entry(g, textvariable=self.v['release_url'], width=32).grid(row=1, column=1, sticky='w', padx=S2)
|
||||
if not ch.package: # (a package is its own release)
|
||||
ttk.Radiobutton(g, text=_('Another release, by its tag:'), variable=self.v['release_mode'], value='tag', style='Card.TRadiobutton').grid(row=0, column=0, sticky='w')
|
||||
ttk.Entry(g, textvariable=self.v['release_tag'], width=18).grid(row=0, column=1, sticky='w', padx=S2)
|
||||
ttk.Label(g, text=_('A mirror with the release\'s files (URL):'), style='Card.TLabel').grid(row=1, column=0, sticky='w', pady=2)
|
||||
ttk.Entry(g, textvariable=self.v['release_url'], width=32).grid(row=1, column=1, sticky='w', padx=S2)
|
||||
ttk.Label(g, text=_('Parallel connections per download:'), style='Card.TLabel').grid(row=2, column=0, sticky='w', pady=2)
|
||||
ttk.Combobox(g, textvariable=self.v['fetch_jobs'], values=['1', '2', '4', '8', '16'], width=4, state='readonly').grid(row=2, column=1, sticky='w', padx=S2)
|
||||
ttk.Label(g, text=_('Another place for the VPN module (URL):'), style='Card.TLabel').grid(row=3, column=0, sticky='w', pady=2)
|
||||
|
||||
@@ -11,7 +11,7 @@ import sys
|
||||
import threading
|
||||
import time
|
||||
|
||||
from . import TOP, adb as adbmod, releases, runner
|
||||
from . import TOP, adb as adbmod, package as packagemod, releases, runner
|
||||
from .i18n import _, language
|
||||
from .masking import Masker
|
||||
from .model import (BACKUP_STEPS, CHECK_STEPS, INSTALL_STEPS, MAKEROOM_STEPS, UNINSTALL_STEPS, Choices, Facts, Progress,
|
||||
@@ -59,6 +59,10 @@ class Controller:
|
||||
self.releases = {'latest': None, 'beta': None, 'files': {}}
|
||||
self.releases_state = 'idle' # idle | running | ok | failed
|
||||
self.choices = Choices()
|
||||
# an unpacked Magisk zip (package.py): its system and kernel, and nothing to ask GitHub
|
||||
self.package = packagemod.load(top, self.environ)
|
||||
if self.package and not self.package.get('error'):
|
||||
self.choices.apply_package(self.package)
|
||||
self.run = None
|
||||
self.run_kind = '' # check | backup | install | makeroom | uninstall | command
|
||||
self.progress = None
|
||||
@@ -86,7 +90,8 @@ class Controller:
|
||||
def start(self):
|
||||
"""Begin watching: find adb, list the devices again and again, ask GitHub for the releases once."""
|
||||
self._thread(self._watch)
|
||||
self.fetch_releases()
|
||||
if not self.package:
|
||||
self.fetch_releases()
|
||||
|
||||
def close(self):
|
||||
self._stop.set()
|
||||
@@ -404,7 +409,7 @@ class Controller:
|
||||
if room and c.ubuntu and c.openwrt and room < f.need('both'):
|
||||
# both do not fit: the one that does (the installers refuse the choice; here it is not offered)
|
||||
c.ubuntu, c.openwrt = (room >= f.need('ubuntu')), (room < f.need('ubuntu'))
|
||||
if not c.kernel_ok():
|
||||
if not c.kernel_ok() and not c.package:
|
||||
c.kernel = '6.18'
|
||||
|
||||
# ---- the log
|
||||
|
||||
+43
-17
@@ -186,6 +186,20 @@ class Choices:
|
||||
self.fetch_jobs = 8 # advanced: MU300_FETCH_JOBS
|
||||
self.vpn_url = '' # advanced: MU300_VPN_URL
|
||||
self.vpn_module = '' # advanced: MU300_VPN_MODULE
|
||||
self.package = None # an unpacked Magisk zip (package.load): its system and kernel only
|
||||
|
||||
def apply_package(self, pkg):
|
||||
"""The choices a package makes itself: its system (one), its Ubuntu, its kernel and its release."""
|
||||
self.package = pkg
|
||||
self.ubuntu = pkg['os'] == 'ubuntu'
|
||||
self.openwrt = not self.ubuntu
|
||||
self.openwrt_flavor = 'luci' if pkg['os'] == 'openwrt-luci' else 'plain'
|
||||
self.ubuntu_version = pkg['ubuntu'] or '24.04'
|
||||
self.boot_os = 'ubuntu' if self.ubuntu else 'openwrt'
|
||||
self.kernel = pkg['kernel']
|
||||
self.release = pkg['tag']
|
||||
self.release_url = ''
|
||||
self.panel = False # a file of the release, not of the zip
|
||||
|
||||
def systems(self):
|
||||
"""The systems as the installers name them: ubuntu, openwrt or openwrt-luci."""
|
||||
@@ -266,7 +280,9 @@ def problems(c, facts):
|
||||
out.append(('storage', _('The free space is not empty. Type overwrite to use it anyway.')))
|
||||
if (c.ubuntu or c.openwrt) and c.place_bytes(facts) and c.place_bytes(facts) < c.needs(facts):
|
||||
out.append(('systems', _('That choice needs about {1} and the place has {2}.', size(c.needs(facts)), size(c.place_bytes(facts)))))
|
||||
if c.kernel == '5.4' and c.device == 'v50':
|
||||
if c.kernel == '5.4' and c.device == 'v50' and c.package:
|
||||
out.append(('kernel', _('The ZTE V50 runs a mainline kernel only: take the zip for kernel 6.18 or 7.2 of this release')))
|
||||
elif c.kernel == '5.4' and c.device == 'v50':
|
||||
out.append(('kernel', _('The ZTE V50 runs a mainline kernel only (6.18 or 7.2).')))
|
||||
elif not c.kernel_ok():
|
||||
out.append(('kernel', _('Ubuntu 26.04 needs a mainline kernel: choose 6.18 or 7.2.')))
|
||||
@@ -306,19 +322,21 @@ def answers(c, facts, lang, serial):
|
||||
a['MU300_ANS_INTERNAL_OVER_CARD'] = c.internal_word
|
||||
if c.storage != 'sd' and facts.num('region.dirty') > 0 and not facts.existing and c.overwrite_word:
|
||||
a['MU300_ANS_OVERWRITE'] = c.overwrite_word
|
||||
if c.release_url:
|
||||
a['MU300_RELEASE_URL'] = c.release_url
|
||||
if c.release:
|
||||
a['MU300_RELEASE'] = c.release
|
||||
else:
|
||||
a['MU300_ANS_BETA'] = 'no' # "the newest full release" was chosen here, with the beta on offer beside it
|
||||
a['MU300_ANS_SYSTEMS'] = '3' if (c.ubuntu and c.openwrt) else ('1' if c.ubuntu else '2')
|
||||
if c.openwrt:
|
||||
a['MU300_OPENWRT'] = c.openwrt_flavor
|
||||
if c.ubuntu and c.openwrt:
|
||||
a['MU300_ANS_BOOT_OS'] = c.boot_system()
|
||||
if c.ubuntu:
|
||||
a['MU300_ANS_UBUNTU'] = c.ubuntu_version
|
||||
# a package (an unpacked Magisk zip) is its own release, system, Ubuntu and kernel: the installer asks none of these
|
||||
if not c.package:
|
||||
if c.release_url:
|
||||
a['MU300_RELEASE_URL'] = c.release_url
|
||||
if c.release:
|
||||
a['MU300_RELEASE'] = c.release
|
||||
else:
|
||||
a['MU300_ANS_BETA'] = 'no' # "the newest full release" was chosen here, with the beta on offer beside it
|
||||
a['MU300_ANS_SYSTEMS'] = '3' if (c.ubuntu and c.openwrt) else ('1' if c.ubuntu else '2')
|
||||
if c.openwrt:
|
||||
a['MU300_OPENWRT'] = c.openwrt_flavor
|
||||
if c.ubuntu and c.openwrt:
|
||||
a['MU300_ANS_BOOT_OS'] = c.boot_system()
|
||||
if c.ubuntu:
|
||||
a['MU300_ANS_UBUNTU'] = c.ubuntu_version
|
||||
a['MU300_ANS_DEFAULT_LINUX'] = yn(c.default_linux)
|
||||
if c.default_linux:
|
||||
a['MU300_ANS_BOOT_ATTEMPTS'] = str(c.boot_attempts)
|
||||
@@ -330,9 +348,10 @@ def answers(c, facts, lang, serial):
|
||||
if c.vpn and c.vpn_module:
|
||||
a['MU300_VPN_MODULE'] = c.vpn_module
|
||||
a['MU300_ANS_ADB'] = yn(c.adb)
|
||||
if c.ubuntu:
|
||||
if c.ubuntu and not c.package:
|
||||
a['MU300_ANS_PANEL'] = yn(c.panel)
|
||||
a['MU300_ANS_KERNEL'] = c.kernel
|
||||
if not c.package:
|
||||
a['MU300_ANS_KERNEL'] = c.kernel
|
||||
if c.place_existing(facts):
|
||||
a['MU300_ANS_EXISTING'] = c.existing
|
||||
if c.storage == 'sd' and c.formats(facts) and c.erase_sd_word:
|
||||
@@ -376,7 +395,10 @@ def uninstall_answers(lang, serial, wipe, sd_wipe, grow=False, erase_word=''):
|
||||
|
||||
def download_plan(c, files):
|
||||
"""The files of the release this installation downloads, as the installers choose them: [(name, bytes)] and
|
||||
their sum. FILES is {name: bytes} of the release (releases.py); a size the list does not have counts as 0."""
|
||||
their sum. FILES is {name: bytes} of the release (releases.py); a size the list does not have counts as 0. A
|
||||
package downloads nothing."""
|
||||
if c.package:
|
||||
return [], 0
|
||||
names = ['mu300-kernel.tar.gz']
|
||||
if c.kernel != '5.4':
|
||||
names.append('mu300-kernel-%s.tar.gz' % c.kernel)
|
||||
@@ -394,6 +416,8 @@ def work_need(c, files):
|
||||
"""About how much room the work directory on this computer needs: the downloads, the kernel bundles unpacked,
|
||||
the device's own files and the images that are built from them."""
|
||||
_plan, total = download_plan(c, files)
|
||||
if c.package:
|
||||
total = c.package.get('bytes', 0) # its files are there already; what is built from them is not
|
||||
return int(total * 1.6) + 400 * MIB
|
||||
|
||||
|
||||
@@ -404,6 +428,8 @@ def summary(c, facts, release):
|
||||
rows = [(_('Systems'), ', '.join(systems) + (' (' + _('boots: {1}', names[c.boot_system()]) + ')' if len(systems) > 1 else ''))]
|
||||
rows.append((_('Kernel'), c.kernel))
|
||||
rows.append((_('Release'), c.release or release or _('the newest release')))
|
||||
if c.package:
|
||||
rows.append((_('From'), _('this unpacked Magisk zip, nothing downloaded: {1}', c.package['dir'])))
|
||||
rows.append((_('Where'), _('SD card') if c.storage == 'sd' else _('internal storage')))
|
||||
if c.place_existing(facts):
|
||||
rows.append((_('Existing installation'), _('update: settings and data are kept') if c.existing == 'update' else _('wipe: start from scratch')))
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
"""A release's Magisk zip unpacked on this computer (tools/package.sh, START-HERE.md in the zip): the installers then
|
||||
install its system and its kernel from its own files, and download nothing. The window offers exactly that - no
|
||||
other system, kernel or release - and asks GitHub nothing.
|
||||
|
||||
The zip's computer/ directory (the TOP of this window) holds the file .mu300-package; MU300_PACKAGE names another
|
||||
unpacked zip. The manifest is read as the zip's own installer and tools/package.sh read it: only its keys, every value
|
||||
exactly one a release has. The checksums are the installer's to check (it stops with a mismatch before it writes).
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
|
||||
from . import TOP
|
||||
|
||||
SYSTEMS = {'openwrt': ('openwrt', '', 'mu300-openwrt-rootfs.tar.gz'),
|
||||
'openwrt-luci': ('openwrt-luci', '', 'mu300-openwrt-luci-rootfs.tar.gz'),
|
||||
'ubuntu-24.04': ('ubuntu', '24.04', 'mu300-ubuntu-rootfs.tar.gz'),
|
||||
'ubuntu-26.04': ('ubuntu', '26.04', 'mu300-ubuntu-26.04-rootfs.tar.gz')}
|
||||
KERNELS = {'5.4': 'mu300-kernel.tar.gz', '6.18': 'mu300-kernel-6.18.tar.gz', '7.2': 'mu300-kernel-7.2.tar.gz'}
|
||||
KEYS = ('TAG', 'SYSTEM', 'OS', 'UBUNTU', 'KERNEL', 'KERNEL_ASSET', 'ROOTFS_ASSET', 'SHA256_KERNEL', 'SHA256_ROOTFS')
|
||||
|
||||
|
||||
def find(top=TOP, environ=None):
|
||||
"""The directory of the unpacked zip, or None (a copy of the project)."""
|
||||
environ = os.environ if environ is None else environ
|
||||
if environ.get('MU300_PACKAGE'):
|
||||
return environ['MU300_PACKAGE']
|
||||
if os.path.isfile(os.path.join(top, '.mu300-package')):
|
||||
return os.path.dirname(os.path.abspath(top))
|
||||
return None
|
||||
|
||||
|
||||
def parse(text):
|
||||
"""The manifest's values, or None when it is not the manifest of a release's zip."""
|
||||
m = dict.fromkeys(KEYS, '')
|
||||
for line in text.splitlines():
|
||||
k, sep, v = line.partition('=')
|
||||
if sep and k in m:
|
||||
m[k] = v.rstrip('\r')
|
||||
if not re.fullmatch(r'v[0-9][0-9A-Za-z._-]*', m['TAG']) or '..' in m['TAG']:
|
||||
return None
|
||||
if SYSTEMS.get(m['SYSTEM']) != (m['OS'], m['UBUNTU'], m['ROOTFS_ASSET']):
|
||||
return None
|
||||
if KERNELS.get(m['KERNEL']) != m['KERNEL_ASSET'] or (m['UBUNTU'] == '26.04' and m['KERNEL'] == '5.4'):
|
||||
return None
|
||||
if not all(re.fullmatch(r'[0-9a-f]{64}', m[k]) for k in ('SHA256_KERNEL', 'SHA256_ROOTFS')):
|
||||
return None
|
||||
return m
|
||||
|
||||
|
||||
def load(top=TOP, environ=None):
|
||||
"""{'dir', 'tag', 'system', 'os', 'ubuntu', 'kernel', 'files': {name: bytes}, 'bytes'} of the unpacked zip this
|
||||
window installs from, {'dir', 'error'} when there is one but its manifest is not valid, or None."""
|
||||
d = find(top, environ)
|
||||
if not d:
|
||||
return None
|
||||
d = os.path.abspath(d)
|
||||
try:
|
||||
with open(os.path.join(d, 'mu300', 'manifest'), encoding='utf-8', errors='replace') as f:
|
||||
m = parse(f.read())
|
||||
except OSError:
|
||||
m = None
|
||||
if m is None:
|
||||
return {'dir': d, 'error': 'manifest'}
|
||||
files = {}
|
||||
for name in (m['KERNEL_ASSET'], m['ROOTFS_ASSET']):
|
||||
try:
|
||||
files[name] = os.path.getsize(os.path.join(d, 'payload', name))
|
||||
except OSError:
|
||||
files[name] = 0
|
||||
return {'dir': d, 'tag': m['TAG'], 'system': m['SYSTEM'], 'os': m['OS'], 'ubuntu': m['UBUNTU'], 'kernel': m['KERNEL'],
|
||||
'files': files, 'bytes': sum(files.values())}
|
||||
+17
@@ -789,3 +789,20 @@ ZTE V50: EXPERIMENTAL, tested by nobody in this project (kano ported it); mainli
|
||||
The ZTE V50 runs a mainline kernel only: install a prebuilt release (without --build) ZTE V50 yalnızca ana hat (mainline) çekirdekle çalışır: hazır bir sürüm kurun (--build olmadan)
|
||||
The ZTE V50 runs a mainline kernel only (6.18 or 7.2). ZTE V50 yalnızca ana hat (mainline) çekirdekle çalışır (6.18 ya da 7.2).
|
||||
The ZTE V50 runs only a mainline kernel of a release that knows it: take the zip for kernel 6.18 or 7.2 (of a newer release if this one has none) ZTE V50 yalnızca onu tanıyan bir sürümün ana hat (mainline) çekirdeğiyle çalışır: 6.18 ya da 7.2 çekirdeğinin zip dosyasını alın (bu sürümde yoksa daha yeni bir sürümün)
|
||||
--build builds the systems itself: run it from a copy of the project, not from an unpacked Magisk zip --build sistemleri kendisi derler: onu açılmış bir Magisk zip'inden değil, projenin bir kopyasından çalıştırın
|
||||
Package: {1} with kernel {2}, release {3} (unpacked Magisk zip at {4}) Paket: {1}, {2} çekirdeği, sürüm {3} ({4} konumunda açılmış Magisk zip'i)
|
||||
This package installs {1} with kernel {2} (release {3}); nothing is downloaded. Bu paket {1} ve {2} çekirdeğini kurar (sürüm {3}); hiçbir şey indirilmez.
|
||||
Another system or kernel: the zip of that combination, or ./install.sh of the project. Başka bir sistem ya da çekirdek için: o birleşimin zip'i ya da projenin ./install.sh dosyası.
|
||||
The ZTE V50 runs a mainline kernel only: take the zip for kernel 6.18 or 7.2 of this release ZTE V50 yalnızca ana hat (mainline) çekirdekle çalışır: bu sürümün 6.18 ya da 7.2 çekirdekli zip'ini alın
|
||||
It is not part of this package. Bu paketin parçası değildir.
|
||||
Checking the files of this package Bu paketin dosyaları doğrulanıyor
|
||||
no unpacked Magisk zip at {1} {1} konumunda açılmış bir Magisk zip'i yok
|
||||
{1} is not an unpacked Magisk zip of a release (it has no mu300/manifest and mu300/SHA256SUMS) {1} bir sürümün açılmış Magisk zip'i değil (mu300/manifest ve mu300/SHA256SUMS yok)
|
||||
the package is incomplete or damaged (its manifest is not valid) paket eksik ya da bozuk (manifest dosyası geçersiz)
|
||||
{1} is missing from the package (payload/) {1} pakette yok (payload/)
|
||||
This package Bu paket
|
||||
This window was started from an unpacked Magisk zip: it installs the system and the kernel of that zip, from its own files, and downloads nothing. Another system or kernel: the zip of that combination. Bu pencere açılmış bir Magisk zip'inden başlatıldı: o zip'in sistemini ve çekirdeğini kendi dosyalarından kurar, hiçbir şey indirmez. Başka bir sistem ya da çekirdek için o birleşimin zip'ini kullanın.
|
||||
{1} is not an unpacked Magisk zip of a release that this installer can read (its mu300/manifest is not valid). Unpack the zip again. {1}, bu kurulum programının okuyabildiği, bir sürümün açılmış Magisk zip'i değil (mu300/manifest geçersiz). Zip'i yeniden açın.
|
||||
Files Dosyalar
|
||||
From Kaynak
|
||||
this unpacked Magisk zip, nothing downloaded: {1} bu açılmış Magisk zip'i, hiçbir şey indirilmeden: {1}
|
||||
|
Can't render this file because it contains an unexpected character in line 112 and column 18.
|
+17
@@ -789,3 +789,20 @@ ZTE V50: EXPERIMENTAL, tested by nobody in this project (kano ported it); mainli
|
||||
The ZTE V50 runs a mainline kernel only: install a prebuilt release (without --build) ZTE V50 只能使用主线内核:请安装预编译的版本(不加 --build)
|
||||
The ZTE V50 runs a mainline kernel only (6.18 or 7.2). ZTE V50 只能使用主线内核(6.18 或 7.2)。
|
||||
The ZTE V50 runs only a mainline kernel of a release that knows it: take the zip for kernel 6.18 or 7.2 (of a newer release if this one has none) ZTE V50 只能使用认识它的版本中的主线内核:请选择 6.18 或 7.2 内核的 zip(本版本没有时请用更新的版本)
|
||||
--build builds the systems itself: run it from a copy of the project, not from an unpacked Magisk zip --build 会自行构建系统:请在本项目的副本中运行,而不是在解压的 Magisk zip 中
|
||||
Package: {1} with kernel {2}, release {3} (unpacked Magisk zip at {4}) 安装包:{1},内核 {2},版本 {3}(解压的 Magisk zip 位于 {4})
|
||||
This package installs {1} with kernel {2} (release {3}); nothing is downloaded. 本安装包安装 {1},内核 {2}(版本 {3});不下载任何东西。
|
||||
Another system or kernel: the zip of that combination, or ./install.sh of the project. 要安装其他系统或内核:请使用对应组合的 zip,或本项目的 ./install.sh。
|
||||
The ZTE V50 runs a mainline kernel only: take the zip for kernel 6.18 or 7.2 of this release ZTE V50 只能使用主线内核:请使用本版本中 6.18 或 7.2 内核的 zip
|
||||
It is not part of this package. 它不包含在本安装包中。
|
||||
Checking the files of this package 正在校验本安装包的文件
|
||||
no unpacked Magisk zip at {1} {1} 处没有解压的 Magisk zip
|
||||
{1} is not an unpacked Magisk zip of a release (it has no mu300/manifest and mu300/SHA256SUMS) {1} 不是某个版本解压后的 Magisk zip(缺少 mu300/manifest 和 mu300/SHA256SUMS)
|
||||
the package is incomplete or damaged (its manifest is not valid) 安装包不完整或已损坏(其 manifest 无效)
|
||||
{1} is missing from the package (payload/) 安装包中缺少 {1}(payload/)
|
||||
This package 本安装包
|
||||
This window was started from an unpacked Magisk zip: it installs the system and the kernel of that zip, from its own files, and downloads nothing. Another system or kernel: the zip of that combination. 本窗口是从解压的 Magisk zip 启动的:它用该 zip 自带的文件安装其中的系统和内核,不下载任何东西。要安装其他系统或内核,请使用对应组合的 zip。
|
||||
{1} is not an unpacked Magisk zip of a release that this installer can read (its mu300/manifest is not valid). Unpack the zip again. {1} 不是本安装程序能读取的某个版本解压后的 Magisk zip(其 mu300/manifest 无效)。请重新解压该 zip。
|
||||
Files 文件
|
||||
From 来源
|
||||
this unpacked Magisk zip, nothing downloaded: {1} 本解压的 Magisk zip,不下载任何东西:{1}
|
||||
|
Can't render this file because it contains an unexpected character in line 112 and column 18.
|
+126
-15
@@ -20,6 +20,9 @@
|
||||
-Lang, -Release, -ReleaseUrl and -Work.
|
||||
.\install.ps1 -NoBootchainSync leave the Linux slot's boot chain as it is (for experts; the default copies
|
||||
uboot, sml, teecfg, trustos and vbmeta of Android's slot there, backed up first)
|
||||
.\install.ps1 -Package DIR install the system and the kernel of a release's Magisk zip unpacked at DIR, from
|
||||
its files and without a download ($env:MU300_PACKAGE; the zip's own computer\install.ps1,
|
||||
which its start.cmd runs, finds them by itself: START-HERE.md in the zip)
|
||||
|
||||
Needs: adb. Python 3 and its lz4 module are installed for this user when missing (winget or python.org, then
|
||||
pip); Windows 10/11 provide tar and curl.
|
||||
@@ -54,7 +57,8 @@ param(
|
||||
[switch]$Backup, # only copy Android's boot image and the first block of misc to this computer
|
||||
[switch]$AdbPath, # only print the adb that would be used
|
||||
[switch]$NoSelfUpdate, # do not bring this copy up to date with GitHub first
|
||||
[switch]$NoBootchainSync # leave the Linux slot's boot chain as it is ($env:MU300_SYNC_BOOTCHAIN = '0' too)
|
||||
[switch]$NoBootchainSync, # leave the Linux slot's boot chain as it is ($env:MU300_SYNC_BOOTCHAIN = '0' too)
|
||||
[string]$Package = '' # an unpacked Magisk zip of a release: its system and kernel, nothing downloaded
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
@@ -500,8 +504,73 @@ if ($AdbPath) {
|
||||
exit 0
|
||||
}
|
||||
Progress 'hello' 'script' 'install.ps1' 'version' '1' 'mode' $(if ($Check) { 'check' } elseif ($Backup) { 'backup' } else { 'prebuilt' })
|
||||
|
||||
# ---------------------------------------------------------------- a package (tools/package.sh for install.sh)
|
||||
# A release's Magisk zip, unpacked on a computer, is an installer for that computer too: its computer\ directory is
|
||||
# this project's installers, with a file .mu300-package in it, and the system and the kernel of the zip lie next to
|
||||
# it - payload\<the two assets>, mu300\manifest naming them and mu300\SHA256SUMS, the release's own checksums. Then
|
||||
# exactly that system and that kernel are installed from those files, nothing is downloaded and the installer does not
|
||||
# update itself (it is the one that came with the files). -Package DIR or $env:MU300_PACKAGE names another one.
|
||||
# PackageDir: the directory of the unpacked zip, or '' (a copy of the project)
|
||||
function PackageDir([string]$Given, [string]$TopDir) {
|
||||
if ($Given) { return $Given }
|
||||
if ($TopDir -and (Test-Path -LiteralPath (Join-Path $TopDir '.mu300-package'))) { return (Split-Path -Parent $TopDir) }
|
||||
return ''
|
||||
}
|
||||
# PackageManifest: the manifest of an unpacked zip, read as the zip's own installer reads it (only its keys, every
|
||||
# value exactly one a release has: they become file names), as a hashtable; $null when it is not valid
|
||||
function PackageManifest([string]$Dir) {
|
||||
$f = Join-Path (Join-Path $Dir 'mu300') 'manifest'
|
||||
if (-not (Test-Path -LiteralPath $f -PathType Leaf)) { return $null }
|
||||
$m = @{ TAG = ''; SYSTEM = ''; OS = ''; UBUNTU = ''; KERNEL = ''; KERNEL_ASSET = ''; ROOTFS_ASSET = ''; SHA256_KERNEL = ''; SHA256_ROOTFS = '' }
|
||||
foreach ($line in [IO.File]::ReadAllLines($f)) {
|
||||
$i = $line.IndexOf('=')
|
||||
if ($i -le 0) { continue }
|
||||
$k = $line.Substring(0, $i)
|
||||
if ($m.ContainsKey($k) -and $k -ceq $k.ToUpperInvariant()) { $m[$k] = $line.Substring($i + 1).TrimEnd("`r") }
|
||||
}
|
||||
if ($m.TAG -cnotmatch '^v[0-9][0-9A-Za-z._-]*$' -or $m.TAG.Contains('..')) { return $null }
|
||||
$sys = @('openwrt:openwrt::mu300-openwrt-rootfs.tar.gz', 'openwrt-luci:openwrt-luci::mu300-openwrt-luci-rootfs.tar.gz',
|
||||
'ubuntu-24.04:ubuntu:24.04:mu300-ubuntu-rootfs.tar.gz', 'ubuntu-26.04:ubuntu:26.04:mu300-ubuntu-26.04-rootfs.tar.gz')
|
||||
if ($sys -cnotcontains "$($m.SYSTEM):$($m.OS):$($m.UBUNTU):$($m.ROOTFS_ASSET)") { return $null }
|
||||
if (@('5.4:mu300-kernel.tar.gz', '6.18:mu300-kernel-6.18.tar.gz', '7.2:mu300-kernel-7.2.tar.gz') -cnotcontains "$($m.KERNEL):$($m.KERNEL_ASSET)") { return $null }
|
||||
if ($m.UBUNTU -eq '26.04' -and $m.KERNEL -eq '5.4') { return $null }
|
||||
foreach ($h in $m.SHA256_KERNEL, $m.SHA256_ROOTFS) { if ($h -cnotmatch '^[0-9a-f]{64}$') { return $null } }
|
||||
return $m
|
||||
}
|
||||
# PackageCheck: why a payload file of an unpacked zip cannot be used ('' when it can): it must be there, with the
|
||||
# checksum the manifest names ($Want) and the one the release's SHA256SUMS names
|
||||
function PackageCheck([string]$Dir, [string]$Name, [string]$Want) {
|
||||
$sums = Join-Path (Join-Path $Dir 'mu300') 'SHA256SUMS'
|
||||
$listed = ''
|
||||
if (Test-Path -LiteralPath $sums) {
|
||||
foreach ($line in [IO.File]::ReadAllLines($sums)) {
|
||||
$p = $line.TrimEnd("`r") -split '\s+', 2
|
||||
if ($p.Count -eq 2 -and $p[1].TrimStart('*') -ceq $Name) { $listed = $p[0]; break }
|
||||
}
|
||||
}
|
||||
$f = Join-Path (Join-Path $Dir 'payload') $Name
|
||||
if (-not (Test-Path -LiteralPath $f -PathType Leaf)) { return 'missing' }
|
||||
$have = (Get-FileHash -LiteralPath $f -Algorithm SHA256).Hash.ToLowerInvariant()
|
||||
if (-not $listed -or $have -cne $Want -or $have -cne $listed) { return 'mismatch' }
|
||||
return ''
|
||||
}
|
||||
$PKG = PackageDir $(if ($Package) { $Package } else { [string]$env:MU300_PACKAGE }) $Top
|
||||
$PM = $null
|
||||
if ($PKG) {
|
||||
if (-not (Test-Path -LiteralPath $PKG -PathType Container)) { Die (T 'no unpacked Magisk zip at {1}' $PKG) }
|
||||
$PKG = (Resolve-Path -LiteralPath $PKG).Path
|
||||
if (-not (Test-Path -LiteralPath (Join-Path $PKG 'mu300\manifest')) -or -not (Test-Path -LiteralPath (Join-Path $PKG 'mu300\SHA256SUMS'))) {
|
||||
Die (T '{1} is not an unpacked Magisk zip of a release (it has no mu300/manifest and mu300/SHA256SUMS)' $PKG)
|
||||
}
|
||||
$PM = PackageManifest $PKG
|
||||
if (-not $PM) { Die (T 'the package is incomplete or damaged (its manifest is not valid)') }
|
||||
$Release = $PM.TAG; $ReleaseUrl = ''
|
||||
Info 'package' $PKG; Info 'package.system' $PM.SYSTEM; Info 'package.kernel' $PM.KERNEL; Info 'package.release' $PM.TAG
|
||||
Write-Host (T 'Package: {1} with kernel {2}, release {3} (unpacked Magisk zip at {4})' $PM.SYSTEM $PM.KERNEL $PM.TAG $PKG)
|
||||
}
|
||||
# first of all, make this the newest installer (it runs the updated one and ends when it changed)
|
||||
if (SelfUpdate) {
|
||||
if (-not $PKG -and (SelfUpdate)) {
|
||||
$env:MU300_SELF_UPDATED = '1'
|
||||
AnswersReexport
|
||||
$PSBoundParameters['Lang'] = $Lang
|
||||
@@ -1205,6 +1274,18 @@ Info 'release' $Release
|
||||
|
||||
Step 'choices' 10
|
||||
Say (T 'What should be installed?')
|
||||
if ($PKG) {
|
||||
# a package's system, Ubuntu and kernel are its own: nothing to ask, only whether they fit here
|
||||
Write-Host (' ' + (T 'This package installs {1} with kernel {2} (release {3}); nothing is downloaded.' $PM.SYSTEM $PM.KERNEL $PM.TAG))
|
||||
Write-Host (' ' + (T 'Another system or kernel: the zip of that combination, or ./install.sh of the project.'))
|
||||
$OSES = @($PM.OS); $BOOT_OS = $PM.OS; $UBUNTU = $(if ($PM.UBUNTU) { $PM.UBUNTU } else { '24.04' })
|
||||
if ($DEVICE -eq 'v50' -and $PM.KERNEL -eq '5.4') { Die (T 'The ZTE V50 runs a mainline kernel only: take the zip for kernel 6.18 or 7.2 of this release') }
|
||||
$need = if ($PM.OS -eq 'ubuntu') { $NEED_UBUNTU } else { $NEED_OPENWRT }
|
||||
if ($SIZE -lt $need) {
|
||||
$needMib = [int64]($need / 1MB); $haveMib = [int64]($SIZE / 1MB)
|
||||
Die (T 'that choice needs about {1} MiB and this device has {2} MiB of free space' $needMib $haveMib)
|
||||
}
|
||||
} else {
|
||||
Write-Host (' ' + (T '1) Ubuntu LTS: 24.04 or 26.04, asked next (full distribution, apt, ~500 MiB RAM in use)'))
|
||||
Write-Host (' ' + (T '2) OpenWrt {1} (router, LuCI web UI, ~140 MiB RAM in use)' '25.12.5'))
|
||||
Write-Host (' ' + (T '3) both (switch later with: mu300-os ubuntu|openwrt)'))
|
||||
@@ -1251,6 +1332,7 @@ if ($OSES -contains 'ubuntu') {
|
||||
default { Die (T 'invalid choice') }
|
||||
}
|
||||
}
|
||||
}
|
||||
# the release file of a system: Ubuntu 26.04 has its own, 24.04 keeps the name it always had
|
||||
function RootfsFile($os) { if ($os -eq 'ubuntu' -and $UBUNTU -eq '26.04') { 'mu300-ubuntu-26.04-rootfs.tar.gz' } else { "mu300-$os-rootfs.tar.gz" } }
|
||||
$DEFAULT_LINUX = if ((Ask (T 'Boot Linux by default instead of Android (falls back to Android if Linux fails)? (yes/no)') 'yes' 'MU300_ANS_DEFAULT_LINUX') -eq 'yes') { 1 } else { 0 }
|
||||
@@ -1309,9 +1391,12 @@ $EXTRA_PANEL = $null
|
||||
if ($OSES -contains 'ubuntu') {
|
||||
Write-Host (' ' + (T 'The web panel for Ubuntu (Cockpit with an MU300 page: signal, SMS, VPN, Wi-Fi, updates, a terminal; on the LAN only) is optional. It can also be added later on the device:'))
|
||||
Write-Host ' sudo mu300-extra install panel'
|
||||
$px = Ask (T 'Install the web panel for Ubuntu (about 24 MB more to download, 50 MB on the device)? (yes/no)') 'no' 'MU300_ANS_PANEL'
|
||||
# (not part of a package: it is a file of the release, not of the zip)
|
||||
if ($PKG) { Write-Host (' ' + (T 'It is not part of this package.')) }
|
||||
else { $px = Ask (T 'Install the web panel for Ubuntu (about 24 MB more to download, 50 MB on the device)? (yes/no)') 'no' 'MU300_ANS_PANEL' }
|
||||
}
|
||||
$KERNEL = $null
|
||||
if ($PKG) { $KERNEL = $PM.KERNEL } else {
|
||||
Say (T 'Which kernel?')
|
||||
Write-Host (' ' + (T "1) 5.4 Unisoc's vendor kernel (Android 12 base): the longest tested, everything this project supports"))
|
||||
Write-Host (' ' + (T '2) 6.18 mainline Linux, current long-term (LTS) release: newer drivers and security fixes, the same'))
|
||||
@@ -1333,6 +1418,7 @@ while (-not $KERNEL) {
|
||||
default { Write-Host (' ' + (T 'enter 1, 2 or 3')) }
|
||||
}
|
||||
}
|
||||
}
|
||||
$FORMAT = 0; $WIPE_LEGACY = 0; $UPDATE = 0
|
||||
if ($existing -eq 'no') {
|
||||
$FORMAT = 1
|
||||
@@ -1405,9 +1491,26 @@ if ($LINUX_SLOT -eq 'a' -and $Release -match '^v\d{4}\.\d{2}\.\d{2}' -and [strin
|
||||
Die (T 'Android runs from slot b, and release {1} cannot boot Linux from slot a; use {2} or newer' $Release 'v2026.10.10')
|
||||
}
|
||||
Step 'download' 20
|
||||
Say (T 'Downloading release {1}' $Release)
|
||||
$REL = "$Work\release\$Release"
|
||||
New-Item -ItemType Directory -Force -Path $REL | Out-Null
|
||||
# $ASSETS: where the release's files are - downloaded into $REL, or a package's payload\ (the kernels are unpacked
|
||||
# into $REL either way)
|
||||
$ASSETS = $REL
|
||||
$vpnFromModule = $false
|
||||
if ($PKG) {
|
||||
Say (T 'Checking the files of this package')
|
||||
$ASSETS = Join-Path $PKG 'payload'
|
||||
foreach ($pf in @(@($PM.KERNEL_ASSET, $PM.SHA256_KERNEL), @($PM.ROOTFS_ASSET, $PM.SHA256_ROOTFS))) {
|
||||
Write-Host " $($pf[0])"
|
||||
$why = PackageCheck $PKG $pf[0] $pf[1]
|
||||
if ($why -eq 'missing') { Die (T '{1} is missing from the package (payload/)' $pf[0]) }
|
||||
if ($why) { Progress 'verify' 'file' $pf[0] 'result' 'mismatch'; Die (T 'checksum mismatch for {1}' $pf[0]) }
|
||||
Progress 'verify' 'file' $pf[0] 'result' 'ok'
|
||||
}
|
||||
# the VPN is not in a zip: the module of its own repository, which is a download
|
||||
if ($vx -eq 'yes') { $vpnFromModule = $true }
|
||||
} else {
|
||||
Say (T 'Downloading release {1}' $Release)
|
||||
$base = if ($ReleaseUrl) { $ReleaseUrl } else { "https://github.com/$Repo/releases/download/$Release" }
|
||||
Invoke-WebRequest "$base/SHA256SUMS" -OutFile "$REL\SHA256SUMS" -UseBasicParsing
|
||||
$sums = @{}
|
||||
@@ -1419,7 +1522,6 @@ $files = @('mu300-kernel.tar.gz') + ($OSES | ForEach-Object { RootfsFile $_ })
|
||||
if ($KERNEL -ne '5.4') { $files += "mu300-kernel-$KERNEL.tar.gz" }
|
||||
# the VPN: a release from before the module (its systems carry mu300-vpn) has the engines as its own vpn extra, from the
|
||||
# same SHA256SUMS; a newer one has neither, and the module comes from its own repository (below)
|
||||
$vpnFromModule = $false
|
||||
if ($vx -eq 'yes') {
|
||||
if ($sums.ContainsKey('mu300-extra-vpn.tar.gz')) { $files += 'mu300-extra-vpn.tar.gz'; $EXTRA_VPN = "$REL\mu300-extra-vpn.tar.gz" }
|
||||
else { $vpnFromModule = $true }
|
||||
@@ -1445,20 +1547,27 @@ foreach ($f in $files) {
|
||||
Progress 'verify' 'file' $f 'result' 'ok'
|
||||
} else { Progress 'verify' 'file' $f 'result' 'cached' }
|
||||
}
|
||||
}
|
||||
if ($vpnFromModule) { FetchVpnModule }
|
||||
# the 5.4 bundle: its kernel, and for every kernel the busybox, logdw and modules of the boot image's first segment.
|
||||
# A package with a mainline kernel has no 5.4 bundle: its boot image is that kernel with its own generic segment,
|
||||
# which brings init's busybox, logdw and modules (build-boot-image.py checks that it does).
|
||||
$HAVE54 = (-not $PKG) -or $KERNEL -eq '5.4'
|
||||
Remove-Item -Recurse -Force "$REL\kernel" -ErrorAction SilentlyContinue
|
||||
New-Item -ItemType Directory -Force -Path "$REL\kernel" | Out-Null
|
||||
& tar -xzf "$REL\mu300-kernel.tar.gz" -C "$REL\kernel"
|
||||
# the 5.4 modules of a device of its own (u30air); the V50 has none, it runs as the F50 does (its mainline kernel is
|
||||
# checked below)
|
||||
if (($DEVICE -notin @('f50', 'v50')) -and -not (Test-Path "$REL\kernel\modules-$DEVICE")) { Die (T 'release {1} does not support this device yet; use a newer one' $Release) }
|
||||
if ($HAVE54) {
|
||||
New-Item -ItemType Directory -Force -Path "$REL\kernel" | Out-Null
|
||||
& tar -xzf "$ASSETS\mu300-kernel.tar.gz" -C "$REL\kernel"
|
||||
# the 5.4 modules of a device of its own (u30air); the V50 has none, it runs as the F50 does (its mainline
|
||||
# kernel is checked below)
|
||||
if (($DEVICE -notin @('f50', 'v50')) -and -not (Test-Path "$REL\kernel\modules-$DEVICE")) { Die (T 'release {1} does not support this device yet; use a newer one' $Release) }
|
||||
}
|
||||
# a mainline kernel (6.18, 7.2): its bundle, unpacked
|
||||
$KMAIN = $null
|
||||
if ($KERNEL -ne '5.4') {
|
||||
$KMAIN = "$REL\kernel-$KERNEL"
|
||||
Remove-Item -Recurse -Force $KMAIN -ErrorAction SilentlyContinue
|
||||
New-Item -ItemType Directory -Force -Path $KMAIN | Out-Null
|
||||
& tar -xzf "$REL\mu300-kernel-$KERNEL.tar.gz" -C $KMAIN
|
||||
& tar -xzf "$ASSETS\mu300-kernel-$KERNEL.tar.gz" -C $KMAIN
|
||||
foreach ($k in 'Image', 'ramdisk-generic.lz4', 'kernel.release') {
|
||||
if (-not (Test-Path "$KMAIN\$k")) { Die (T '{1} is incomplete' "mu300-kernel-$KERNEL.tar.gz") }
|
||||
}
|
||||
@@ -1492,10 +1601,12 @@ WriteUnix "$Work\init" (((Get-Content -Raw "$Top\boot\init") -replace '(?m)^ROOT
|
||||
# image that "mu300-update kernel 6.18" (or 7.2) writes on the device
|
||||
$bootArgs = @("$Top\boot\build-boot-image.py", '--stock-boot', "$Work\dumps\boot_$ANDROID_SLOT.img", '--misc-head', "$Work\dumps\misc-head.bin",
|
||||
'--kernel', $(if ($KMAIN) { "$KMAIN\Image" } else { "$REL\kernel\Image" }),
|
||||
'--modules', "$REL\kernel\modules", '--init', "$Work\init", '--busybox', "$REL\kernel\busybox",
|
||||
'--logdw', "$REL\kernel\logdw", '--ueventd-perms', "$Top\android-vendor\ueventd-perms.sh",
|
||||
'--init', "$Work\init", '--ueventd-perms', "$Top\android-vendor\ueventd-perms.sh",
|
||||
'--android-subset', "$Work\android-subset", '--out', "$Work\boot-linux-slot$LINUX_SLOT.img", '--device', $DEVICE, '--linux-slot', $LINUX_SLOT)
|
||||
if (Test-Path "$REL\kernel\modules-u30air") { $bootArgs += @('--device-modules', "u30air=$REL\kernel\modules-u30air") }
|
||||
if ($HAVE54) {
|
||||
$bootArgs += @('--modules', "$REL\kernel\modules", '--busybox', "$REL\kernel\busybox", '--logdw', "$REL\kernel\logdw")
|
||||
if (Test-Path "$REL\kernel\modules-u30air") { $bootArgs += @('--device-modules', "u30air=$REL\kernel\modules-u30air") }
|
||||
}
|
||||
if ($KMAIN) { $bootArgs += @('--append-ramdisk', "$KMAIN\ramdisk-generic.lz4") }
|
||||
# a failed build must stop here: otherwise an earlier image (or none) would be written to the device
|
||||
Remove-Item "$Work\boot-linux-slot$LINUX_SLOT.*" -ErrorAction SilentlyContinue
|
||||
@@ -1529,7 +1640,7 @@ Step 'copy' 75
|
||||
Say (T 'Copying to the device')
|
||||
foreach ($f in 'android-mount-mu300root.sh', 'android-install.sh', 'android-bootchain.sh') { PushUnix "$Top\tools\$f" "$T/$f" | Out-Null }
|
||||
foreach ($os in $OSES) {
|
||||
& adb push "$REL\$(RootfsFile $os)" "$T/mu300-$os.tar.gz" | Out-Null
|
||||
& adb push "$ASSETS\$(RootfsFile $os)" "$T/mu300-$os.tar.gz" | Out-Null
|
||||
& adb push "$Work\mu300-vendor-$os.tar.gz" "$T/mu300-vendor-$os.tar.gz" | Out-Null
|
||||
}
|
||||
# android-install.sh puts every pushed mu300-extra-<name>.tar.gz onto the Linux partition (extra/<name>); the VPN
|
||||
|
||||
+72
-17
@@ -11,6 +11,9 @@
|
||||
# ./install.sh --backup only copy what an installation reads first to this computer: Android's boot image
|
||||
# and the first block of misc, checked against the device (writes nothing to it)
|
||||
# ./install.sh --adb-path print the adb this installer would use, and stop
|
||||
# ./install.sh --package DIR install the system and the kernel of a release's Magisk zip unpacked at DIR, from its
|
||||
# files and without a download (MU300_PACKAGE=DIR; the zip's own computer/install.sh,
|
||||
# which its start.sh runs, finds them by itself: START-HERE.md in the zip, tools/package.sh)
|
||||
# ./install.sh --answers FILE ask nothing: every question is answered by its variable, from FILE (NAME=value
|
||||
# lines) or the environment; a question without an answer is an error that names the
|
||||
# variable. MU300_PROGRESS=1 adds a machine-readable progress stream. For programs
|
||||
@@ -70,6 +73,7 @@ T=/data/local/tmp
|
||||
MODE=prebuilt; CHECK_ONLY=0; BACKUP_ONLY=0; ADB_PATH_ONLY=0; ANSWERS_FILE=; _opt=
|
||||
for a in "$@"; do
|
||||
if [ "$_opt" = answers ]; then ANSWERS_FILE=$a; _opt=; continue; fi
|
||||
if [ "$_opt" = package ]; then MU300_PACKAGE=$a; export MU300_PACKAGE; _opt=; continue; fi
|
||||
case $a in
|
||||
--check) CHECK_ONLY=1 ;;
|
||||
--build) MODE=build ;;
|
||||
@@ -78,11 +82,13 @@ for a in "$@"; do
|
||||
--adb-path) ADB_PATH_ONLY=1 ;;
|
||||
--answers) _opt=answers ;;
|
||||
--answers=*) ANSWERS_FILE=${a#--answers=} ;;
|
||||
--package) _opt=package ;;
|
||||
--package=*) MU300_PACKAGE=${a#--package=}; export MU300_PACKAGE ;;
|
||||
-h|--help) sed -n '2,/^set -eu/{/^set -eu/d;s/^# \{0,1\}//p;}' "$0"; exit 0 ;;
|
||||
*) echo "unknown option $a (see --help)" >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
[ -z "$_opt" ] || { echo "--answers needs a file (see --help)" >&2; exit 2; }
|
||||
[ -z "$_opt" ] || { echo "--$_opt needs a file or directory (see --help)" >&2; exit 2; }
|
||||
. "$TOP/tools/answers.sh" # say, die, ask; the answers mode and the progress stream
|
||||
answers_setup # (before anything reads a MU300_* variable: an answers file sets them)
|
||||
RELEASE=${MU300_RELEASE:-}
|
||||
@@ -90,6 +96,7 @@ REPO=${MU300_REPO:-dikeckaan/mu300-linux}
|
||||
. "$TOP/tools/i18n.sh"
|
||||
. "$TOP/tools/storage.sh"
|
||||
. "$TOP/tools/releases.sh"
|
||||
. "$TOP/tools/package.sh"
|
||||
# adb from platform-tools unzipped next to the project (or into the usual places) needs no PATH entry
|
||||
find_adb() {
|
||||
command -v adb >/dev/null && return 0
|
||||
@@ -105,9 +112,19 @@ if [ $ANSWERS_MODE = 1 ]; then
|
||||
fi
|
||||
choose_language
|
||||
progress hello script install.sh version 1 mode "$([ $CHECK_ONLY = 1 ] && echo check || { [ $BACKUP_ONLY = 1 ] && echo backup || echo $MODE; })"
|
||||
# an unpacked Magisk zip (tools/package.sh): its system and kernel, its release, no download and no self-update -
|
||||
# the installer that came with the files is the one that knows them
|
||||
PKG=$(package_dir)
|
||||
if [ -n "$PKG" ]; then
|
||||
package_load "$PKG"
|
||||
[ $MODE != build ] || die "$(t '--build builds the systems itself: run it from a copy of the project, not from an unpacked Magisk zip')"
|
||||
RELEASE=$PKG_TAG
|
||||
info package "$PKG"; info package.system "$PKG_SYSTEM"; info package.kernel "$PKG_KERNEL"; info package.release "$PKG_TAG"
|
||||
echo "$(t 'Package: {1} with kernel {2}, release {3} (unpacked Magisk zip at {4})' "$PKG_SYSTEM" "$PKG_KERNEL" "$PKG_TAG" "$PKG")"
|
||||
fi
|
||||
# first of all, make this the newest installer (it restarts itself when it changed)
|
||||
. "$TOP/tools/self-update.sh"
|
||||
self_update "$0" "$@"
|
||||
[ -n "$PKG" ] || self_update "$0" "$@"
|
||||
# the graphical installer, offered once to a person who starts a plain installation
|
||||
. "$TOP/tools/gui-launch.sh"
|
||||
[ $CHECK_ONLY = 1 ] || [ $BACKUP_ONLY = 1 ] || [ $MODE != prebuilt ] || gui_offer
|
||||
@@ -257,6 +274,8 @@ step preflight 2
|
||||
say "$(t 'Checking host tools and device')"
|
||||
need="adb"
|
||||
[ $CHECK_ONLY = 1 ] || [ $BACKUP_ONLY = 1 ] || { [ $MODE = build ] && need="adb docker python3 lz4" || need="adb python3 lz4 curl"; }
|
||||
# (a package downloads nothing: curl only for the VPN module, when it is wanted)
|
||||
[ -z "$PKG" ] || [ $CHECK_ONLY = 1 ] || [ $BACKUP_ONLY = 1 ] || need="adb python3 lz4"
|
||||
find_adb || true
|
||||
for c in $need; do command -v $c >/dev/null || die "$(t '{1} not found' "$c")"; done
|
||||
if [ $CHECK_ONLY = 0 ] && [ $MODE = build ]; then
|
||||
@@ -619,6 +638,21 @@ fi
|
||||
info release "$RELEASE"
|
||||
step choices 10
|
||||
say "$(t 'What should be installed?')"
|
||||
# --- package-choices begin
|
||||
# package_choices: a package's system, Ubuntu and kernel are its own - nothing to ask, only whether they fit here
|
||||
package_choices() {
|
||||
echo " $(t 'This package installs {1} with kernel {2} (release {3}); nothing is downloaded.' "$PKG_SYSTEM" "$PKG_KERNEL" "$PKG_TAG")"
|
||||
echo " $(t 'Another system or kernel: the zip of that combination, or ./install.sh of the project.')"
|
||||
OSES=$PKG_OS; BOOT_OS=$PKG_OS; UBUNTU=${PKG_UBUNTU:-24.04}; KERNEL=$PKG_KERNEL
|
||||
[ "$DEVICE" != v50 ] || [ "$KERNEL" != 5.4 ] ||
|
||||
die "$(t 'The ZTE V50 runs a mainline kernel only: take the zip for kernel 6.18 or 7.2 of this release')"
|
||||
need=$NEED_OPENWRT; [ "$OSES" = ubuntu ] && need=$NEED_UBUNTU
|
||||
[ $SIZE -ge $need ] || die "$(t 'that choice needs about {1} MiB and this device has {2} MiB of free space' "$((need / 1048576))" "$((SIZE / 1048576))")"
|
||||
}
|
||||
# --- package-choices end
|
||||
if [ -n "$PKG" ]; then
|
||||
package_choices
|
||||
else
|
||||
echo " $(t '1) Ubuntu LTS: 24.04 or 26.04, asked next (full distribution, apt, ~500 MiB RAM in use)')"
|
||||
echo " $(t '2) OpenWrt {1} (router, LuCI web UI, ~140 MiB RAM in use)' "$OWRT_VER")"
|
||||
echo " $(t '3) both (switch later with: mu300-os ubuntu|openwrt)')"
|
||||
@@ -662,6 +696,7 @@ case " $OSES " in *" ubuntu "*) if [ $MODE = prebuilt ]; then
|
||||
ask uv "$(t 'Ubuntu')" 1 MU300_ANS_UBUNTU
|
||||
case $uv in 1|24.04) UBUNTU=24.04 ;; 2|26.04) UBUNTU=26.04 ;; *) die "$(t 'invalid choice')" ;; esac
|
||||
fi ;; esac
|
||||
fi
|
||||
# the release file of a system: Ubuntu 26.04 has its own, 24.04 keeps the name it always had
|
||||
rootfs_file() { if [ "$1" = ubuntu ] && [ "$UBUNTU" = 26.04 ]; then echo mu300-ubuntu-26.04-rootfs.tar.gz; else echo "mu300-$1-rootfs.tar.gz"; fi; }
|
||||
ask dl "$(t 'Boot Linux by default instead of Android (falls back to Android if Linux fails)? (yes/no)')" yes MU300_ANS_DEFAULT_LINUX
|
||||
@@ -723,10 +758,12 @@ EXTRA_PANEL=
|
||||
case " $OSES " in *" ubuntu "*)
|
||||
echo " $(t 'The web panel for Ubuntu (Cockpit with an MU300 page: signal, SMS, VPN, Wi-Fi, updates, a terminal; on the LAN only) is optional. It can also be added later on the device:')"
|
||||
echo " sudo mu300-extra install panel"
|
||||
ask px "$(t 'Install the web panel for Ubuntu (about 24 MB more to download, 50 MB on the device)? (yes/no)')" no MU300_ANS_PANEL ;;
|
||||
# (not part of a package: it is a file of the release, not of the zip)
|
||||
if [ -n "$PKG" ]; then echo " $(t 'It is not part of this package.')"
|
||||
else ask px "$(t 'Install the web panel for Ubuntu (about 24 MB more to download, 50 MB on the device)? (yes/no)')" no MU300_ANS_PANEL; fi ;;
|
||||
esac
|
||||
KERNEL=5.4
|
||||
if [ $MODE = prebuilt ]; then
|
||||
[ -n "$PKG" ] || KERNEL=5.4
|
||||
if [ $MODE = prebuilt ] && [ -z "$PKG" ]; then
|
||||
say "$(t 'Which kernel?')"
|
||||
echo " $(t "1) 5.4 Unisoc's vendor kernel (Android 12 base): the longest tested, everything this project supports")"
|
||||
echo " $(t '2) 6.18 mainline Linux, current long-term (LTS) release: newer drivers and security fixes, the same')"
|
||||
@@ -809,6 +846,18 @@ if [ $MODE = prebuilt ]; then
|
||||
slot_release_ok "$RELEASE" # (RELEASE: release_resolve, before the questions)
|
||||
REL=$WORK/release/$RELEASE
|
||||
mkdir -p "$REL"
|
||||
# ASSETS: where the release's files are - downloaded into REL, or a package's payload/ (the kernels are unpacked into
|
||||
# REL either way)
|
||||
ASSETS=$REL
|
||||
VPN_FROM_MODULE=
|
||||
if [ -n "$PKG" ]; then
|
||||
step download 20
|
||||
say "$(t 'Checking the files of this package')"
|
||||
ASSETS=$PKG/payload
|
||||
package_verify
|
||||
# the VPN is not in a zip: the module of its own repository, which is a download
|
||||
[ "$vx" != yes ] || VPN_FROM_MODULE=1
|
||||
else
|
||||
# MU300_RELEASE_URL: another location with the same files (e.g. a local test server)
|
||||
base=${MU300_RELEASE_URL:-https://github.com/$REPO/releases/download/$RELEASE}
|
||||
step download 20
|
||||
@@ -819,7 +868,6 @@ files=mu300-kernel.tar.gz
|
||||
for os in $OSES; do files="$files $(rootfs_file $os)"; done
|
||||
# the VPN: a release from before the module (its systems carry mu300-vpn) has the engines as its own vpn extra, from the
|
||||
# same SHA256SUMS; a newer one has neither, and the module comes from its own repository (below)
|
||||
VPN_FROM_MODULE=
|
||||
if [ "$vx" = yes ]; then
|
||||
if awk '$2 == "mu300-extra-vpn.tar.gz" || $2 == "*mu300-extra-vpn.tar.gz" {f = 1} END {exit !f}' "$REL/SHA256SUMS"; then
|
||||
files="$files mu300-extra-vpn.tar.gz"; EXTRA_VPN=$REL/mu300-extra-vpn.tar.gz
|
||||
@@ -849,18 +897,25 @@ for f in $files; do
|
||||
progress verify file "$f" result cached
|
||||
fi
|
||||
done
|
||||
fi
|
||||
[ -z "$VPN_FROM_MODULE" ] || fetch_vpn_module
|
||||
rm -rf "$REL/kernel" && mkdir -p "$REL/kernel" && tar -xzf "$REL/mu300-kernel.tar.gz" -C "$REL/kernel"
|
||||
KOUT=$REL/kernel
|
||||
# the 5.4 modules of a device of its own (u30air); the V50 has none, it runs as the F50 does (its mainline kernel is
|
||||
# checked below)
|
||||
case $DEVICE in f50|v50) ;; *) [ -d "$KOUT/modules-$DEVICE" ] || die "$(t 'release {1} does not support this device yet; use a newer one' "$RELEASE")" ;; esac
|
||||
BUSYBOX=$KOUT/busybox; LOGDW=$KOUT/logdw
|
||||
# the 5.4 bundle: its kernel, and for every kernel the busybox, logdw and modules of the boot image's first segment.
|
||||
# A package with a mainline kernel has no 5.4 bundle: its boot image is that kernel with its own generic segment,
|
||||
# which brings init's busybox, logdw and modules (build-boot-image.py checks that it does).
|
||||
KOUT=; BUSYBOX=; LOGDW=
|
||||
if [ -z "$PKG" ] || [ "$KERNEL" = 5.4 ]; then
|
||||
rm -rf "$REL/kernel" && mkdir -p "$REL/kernel" && tar -xzf "$ASSETS/mu300-kernel.tar.gz" -C "$REL/kernel"
|
||||
KOUT=$REL/kernel
|
||||
# the 5.4 modules of a device of its own (u30air); the V50 has none, it runs as the F50 does (its mainline kernel
|
||||
# is checked below)
|
||||
case $DEVICE in f50|v50) ;; *) [ -d "$KOUT/modules-$DEVICE" ] || die "$(t 'release {1} does not support this device yet; use a newer one' "$RELEASE")" ;; esac
|
||||
BUSYBOX=$KOUT/busybox; LOGDW=$KOUT/logdw
|
||||
fi
|
||||
# a mainline kernel (6.18, 7.2): its bundle, unpacked
|
||||
KMAIN=
|
||||
if [ "$KERNEL" != 5.4 ]; then
|
||||
KMAIN=$REL/kernel-$KERNEL
|
||||
rm -rf "$KMAIN" && mkdir -p "$KMAIN" && tar -xzf "$REL/mu300-kernel-$KERNEL.tar.gz" -C "$KMAIN"
|
||||
rm -rf "$KMAIN" && mkdir -p "$KMAIN" && tar -xzf "$ASSETS/mu300-kernel-$KERNEL.tar.gz" -C "$KMAIN"
|
||||
[ -s "$KMAIN/Image" ] && [ -s "$KMAIN/ramdisk-generic.lz4" ] && [ -s "$KMAIN/kernel.release" ] || die "$(t '{1} is incomplete' "mu300-kernel-$KERNEL.tar.gz")"
|
||||
# a bundle names the devices it runs on; older mainline kernels do not bring up the U30 Air's USB (FINDINGS 33c)
|
||||
[ $DEVICE = f50 ] || grep -qw $DEVICE "$KMAIN/devices" 2>/dev/null || die "$(t 'release {1} does not support this device yet; use a newer one' "$RELEASE")"
|
||||
@@ -938,9 +993,9 @@ sed "s/^ROOT_OFFSET=[0-9]*/ROOT_OFFSET=$OFF/" "$TOP/boot/init" > "$WORK/init"
|
||||
# image that "mu300-update kernel 6.18" (or 7.2) writes on the device
|
||||
python3 "$TOP/boot/build-boot-image.py" --stock-boot "$WORK/dumps/boot_$ANDROID_SLOT.img" --misc-head "$WORK/dumps/misc-head.bin" \
|
||||
--kernel "${KMAIN:-$KOUT}/Image" ${KMAIN:+--append-ramdisk "$KMAIN/ramdisk-generic.lz4"} \
|
||||
--modules "$KOUT/modules" --init "$WORK/init" --busybox "$BUSYBOX" --device "$DEVICE" \
|
||||
$([ -d "$KOUT/modules-u30air" ] && echo --device-modules "u30air=$KOUT/modules-u30air") \
|
||||
--logdw "$LOGDW" --ueventd-perms "$TOP/android-vendor/ueventd-perms.sh" \
|
||||
${KOUT:+--modules "$KOUT/modules"} --init "$WORK/init" ${BUSYBOX:+--busybox "$BUSYBOX"} --device "$DEVICE" \
|
||||
$([ -n "$KOUT" ] && [ -d "$KOUT/modules-u30air" ] && echo --device-modules "u30air=$KOUT/modules-u30air") \
|
||||
${LOGDW:+--logdw "$LOGDW"} --ueventd-perms "$TOP/android-vendor/ueventd-perms.sh" \
|
||||
--android-subset "$WORK/android-subset" --linux-slot "$LINUX_SLOT" --out "$WORK/boot-linux-slot$LINUX_SLOT.img" >/dev/null
|
||||
|
||||
# ---------------------------------------------------------------- confirm and install
|
||||
@@ -970,7 +1025,7 @@ say "$(t 'Copying to the device')"
|
||||
adb push "$TOP/tools/android-mount-mu300root.sh" "$TOP/tools/android-install.sh" "$TOP/tools/android-bootchain.sh" $T/ >/dev/null
|
||||
for os in $OSES; do
|
||||
if [ $MODE = prebuilt ]; then
|
||||
adb push "$REL/$(rootfs_file $os)" $T/mu300-$os.tar.gz >/dev/null
|
||||
adb push "$ASSETS/$(rootfs_file $os)" $T/mu300-$os.tar.gz >/dev/null
|
||||
adb push "$WORK/mu300-vendor-$os.tar.gz" $T/mu300-vendor-$os.tar.gz >/dev/null
|
||||
else
|
||||
adb push "$WORK/mu300-$os.tar.gz" $T/mu300-$os.tar.gz >/dev/null
|
||||
|
||||
@@ -316,6 +316,39 @@ Check 'environment: the password is never shown' ($r.Out -match 'hunter2') $fals
|
||||
Check 'environment: adb sees the answers' (@(Calls '' | Where-Object { @($_.answers | ForEach-Object { "$_".ToUpper() }) -contains 'MU300_ANS_KERNEL' }).Count -gt 0) $true
|
||||
Check 'environment: adb never sees the password' (@(Calls '' | Where-Object { @($_.answers | ForEach-Object { "$_".ToUpper() }) -contains 'MU300_ANS_PASSWORD' }).Count) 0
|
||||
|
||||
# ---- an unpacked Magisk zip (-Package / MU300_PACKAGE): its system, kernel and release; nothing asked about them -----
|
||||
$pk = Join-Path $fx 'package'
|
||||
New-Item -ItemType Directory -Force -Path (Join-Path $pk 'mu300'), (Join-Path $pk 'payload') | Out-Null
|
||||
[IO.File]::WriteAllText((Join-Path $pk 'payload\mu300-kernel-7.2.tar.gz'), 'kernel bundle')
|
||||
[IO.File]::WriteAllText((Join-Path $pk 'payload\mu300-ubuntu-26.04-rootfs.tar.gz'), 'ubuntu system')
|
||||
$hk = (Get-FileHash (Join-Path $pk 'payload\mu300-kernel-7.2.tar.gz') -Algorithm SHA256).Hash.ToLower()
|
||||
$hr = (Get-FileHash (Join-Path $pk 'payload\mu300-ubuntu-26.04-rootfs.tar.gz') -Algorithm SHA256).Hash.ToLower()
|
||||
$pkManifest = "TAG=v2026.10.27`nSYSTEM=ubuntu-26.04`nOS=ubuntu`nUBUNTU=26.04`nKERNEL=7.2`nKERNEL_ASSET=mu300-kernel-7.2.tar.gz`nROOTFS_ASSET=mu300-ubuntu-26.04-rootfs.tar.gz`nSHA256_KERNEL=$hk`nSHA256_ROOTFS=$hr`n"
|
||||
[IO.File]::WriteAllText((Join-Path $pk 'mu300\manifest'), $pkManifest)
|
||||
[IO.File]::WriteAllText((Join-Path $pk 'mu300\SHA256SUMS'), "$hk mu300-kernel-7.2.tar.gz`n$hr mu300-ubuntu-26.04-rootfs.tar.gz`n")
|
||||
$pkAnswers = [ordered]@{ MU300_ANS_DEFAULT_LINUX = 'yes'; MU300_ANS_BOOT_ATTEMPTS = '5'; MU300_ANS_HOTSPOT = 'yes'; MU300_ANS_GPU = 'no'
|
||||
MU300_ANS_VPN = 'no'; MU300_ANS_ADB = 'no'; MU300_ANS_PASSWORD = 'hunter2secret'; MU300_ANS_CONFIRM = 'INSTALL' }
|
||||
Device 'pull' $false
|
||||
$r = RunScript 'install.ps1' "-AnswersFile `"$(AnswersFileOf $pkAnswers)`"" @{ MU300_PACKAGE = $pk; MU300_RELEASE = '' }
|
||||
Check 'package: no question about the system, the kernel or the release' ($r.Asked -join ' ') 'MU300_ANS_DEFAULT_LINUX=yes MU300_ANS_BOOT_ATTEMPTS=5 MU300_ANS_HOTSPOT=yes MU300_ANS_GPU=no MU300_ANS_VPN=no MU300_ANS_ADB=no MU300_ANS_PASSWORD='
|
||||
if ($r.Asked.Count -ne 7) { Write-Host $r.Out }
|
||||
Check 'package: what it is' "$($r.Facts['package.system']) $($r.Facts['package.kernel']) $($r.Facts['package.release']) $($r.Facts['release'])" 'ubuntu-26.04 7.2 v2026.10.27 v2026.10.27'
|
||||
Check 'package: says so' ($r.Out -match 'This package installs ubuntu-26.04 with kernel 7.2 \(release v2026.10.27\); nothing is downloaded.') $true
|
||||
Check 'package: no web panel' ($r.Out -match 'It is not part of this package.') $true
|
||||
Check 'package: stops at the pull' (LastEvent $r).message 'pulling boot_a failed'
|
||||
Check "package: nothing written: $(UntouchedWhy)" (Untouched) 0
|
||||
# a manifest that is not one of a release's: stopped before the device is asked anything
|
||||
[IO.File]::WriteAllText((Join-Path $pk 'mu300\manifest'), $pkManifest.Replace('KERNEL=7.2', 'KERNEL=9.9'))
|
||||
Device 'pull' $false
|
||||
$r = RunScript 'install.ps1' "-AnswersFile `"$(AnswersFileOf $pkAnswers)`"" @{ MU300_PACKAGE = $pk }
|
||||
Check 'package, bad manifest: stops' "$($r.Rc) $((LastEvent $r).message)" '1 the package is incomplete or damaged (its manifest is not valid)'
|
||||
Check 'package, bad manifest: the device was not asked' @(Calls '').Count 0
|
||||
# the same with -Package
|
||||
[IO.File]::WriteAllText((Join-Path $pk 'mu300\manifest'), $pkManifest)
|
||||
Device 'pull' $false
|
||||
$r = RunScript 'install.ps1' "-Package `"$pk`" -AnswersFile `"$(AnswersFileOf $pkAnswers)`""
|
||||
Check 'package by -Package' $r.Facts['package.kernel'] '7.2'
|
||||
|
||||
# ---- -AdbPath: asks the device nothing -----------------------------------------------------------------------------
|
||||
Device
|
||||
New-Item -ItemType Directory -Force -Path (Join-Path $fx 'platform-tools') | Out-Null
|
||||
|
||||
+2
-1
@@ -26,6 +26,7 @@ DEFAULT = {
|
||||
'serial': '324950664950',
|
||||
'model': 'F50', # ro.product.model; 'U30_Air' for the other device, anything else is unknown
|
||||
'device': 'MU300', # ro.product.device
|
||||
'platform': 'ums9620', # ro.board.platform (the V50 is told apart by it too)
|
||||
'adb_state': 'device', # device | unauthorized | offline | none (nothing attached)
|
||||
'extra_devices': [], # more lines of `adb devices -l`
|
||||
'root': True, # su works
|
||||
@@ -115,7 +116,7 @@ def props(st):
|
||||
'ro.boot.flash.locked': st['locked'], 'ro.boot.verifiedbootstate': st['verified'],
|
||||
'ro.boot.vbmeta.device_state': st['device_state'],
|
||||
'ro.boot.slot_suffix': '_' + st['slot'], 'sys.boot_completed': st['boot_completed'],
|
||||
'ro.serialno': st['serial'],
|
||||
'ro.serialno': st['serial'], 'ro.board.platform': st.get('platform', 'ums9620'),
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ function Check($name, $got, $want) {
|
||||
|
||||
# the functions under test, straight from install.ps1
|
||||
$ast = [System.Management.Automation.Language.Parser]::ParseFile((Join-Path $Top "install.ps1"), [ref]$null, [ref]$null)
|
||||
$want = 'LoadLanguage', 'T', 'NormalizeAnswer', 'AndroidLines', 'LinuxAdbSerials', 'Gib', 'ChooseStorage', 'StorageDefault', 'InternalOverCard', 'SdState', 'SdKernelOk', 'InstallEnvText', 'ChooseOpenWrt', 'AdbPubKey', 'BootchainLine', 'BootchainRefused'
|
||||
$want = 'LoadLanguage', 'T', 'NormalizeAnswer', 'AndroidLines', 'LinuxAdbSerials', 'Gib', 'ChooseStorage', 'StorageDefault', 'InternalOverCard', 'SdState', 'SdKernelOk', 'InstallEnvText', 'ChooseOpenWrt', 'AdbPubKey', 'BootchainLine', 'BootchainRefused', 'PackageDir', 'PackageManifest', 'PackageCheck'
|
||||
$defs = $ast.FindAll({ param($n) $n -is [System.Management.Automation.Language.FunctionDefinitionAst] -and $want -contains $n.Name }, $true)
|
||||
foreach ($d in $defs) { . ([scriptblock]::Create($d.Extent.Text)) }
|
||||
foreach ($w in 'LoadLanguage', 'T', 'NormalizeAnswer') {
|
||||
@@ -908,5 +908,45 @@ if ($env:OS -ne 'Windows_NT') {
|
||||
Remove-Item -Recurse -Force $gx -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# ---- a package: an unpacked Magisk zip (tools/package.sh is the same for install.sh) ------------------------------------
|
||||
$px = Join-Path ([IO.Path]::GetTempPath()) ('mu300-package-' + [guid]::NewGuid())
|
||||
New-Item -ItemType Directory -Force -Path (Join-Path $px 'computer'), (Join-Path $px 'mu300'), (Join-Path $px 'payload') | Out-Null
|
||||
Check 'package: none' (PackageDir '' (Join-Path $px 'computer')) ''
|
||||
[IO.File]::WriteAllText((Join-Path $px 'computer\.mu300-package'), "x`n")
|
||||
Check 'package: by the mark' (PackageDir '' (Join-Path $px 'computer')) $px
|
||||
Check 'package: named' (PackageDir 'D:\other' (Join-Path $px 'computer')) 'D:\other'
|
||||
[IO.File]::WriteAllText((Join-Path $px 'payload\mu300-kernel-6.18.tar.gz'), 'kernel bundle')
|
||||
[IO.File]::WriteAllText((Join-Path $px 'payload\mu300-openwrt-rootfs.tar.gz'), 'openwrt system')
|
||||
$hk = (Get-FileHash (Join-Path $px 'payload\mu300-kernel-6.18.tar.gz') -Algorithm SHA256).Hash.ToLower()
|
||||
$hr = (Get-FileHash (Join-Path $px 'payload\mu300-openwrt-rootfs.tar.gz') -Algorithm SHA256).Hash.ToLower()
|
||||
function PkgManifest([hashtable]$Over) {
|
||||
$m = [ordered]@{ TAG = 'v2026.10.27'; SYSTEM = 'openwrt'; OS = 'openwrt'; UBUNTU = ''; KERNEL = '6.18'; KERNEL_ASSET = 'mu300-kernel-6.18.tar.gz'
|
||||
ROOTFS_ASSET = 'mu300-openwrt-rootfs.tar.gz'; SHA256_KERNEL = $hk; SHA256_ROOTFS = $hr }
|
||||
if ($Over) { foreach ($k in $Over.Keys) { $m[$k] = $Over[$k] } }
|
||||
[IO.File]::WriteAllText((Join-Path $px 'mu300\manifest'), (($m.Keys | ForEach-Object { "$_=$($m[$_])" }) -join "`r`n") + "`r`n")
|
||||
return (PackageManifest $px)
|
||||
}
|
||||
$pm = PkgManifest
|
||||
Check 'package: read' "$($pm.TAG) $($pm.SYSTEM) $($pm.OS) [$($pm.UBUNTU)] $($pm.KERNEL) $($pm.KERNEL_ASSET) $($pm.ROOTFS_ASSET)" 'v2026.10.27 openwrt openwrt [] 6.18 mu300-kernel-6.18.tar.gz mu300-openwrt-rootfs.tar.gz'
|
||||
foreach ($bad in @(@{ TAG = '2026.10.27' }, @{ TAG = 'v1..2' }, @{ TAG = 'v1;x' }, @{ SYSTEM = 'ubuntu' }, @{ ROOTFS_ASSET = '..\..\x' },
|
||||
@{ KERNEL = '6.19' }, @{ KERNEL_ASSET = 'mu300-kernel.tar.gz' }, @{ SHA256_KERNEL = ('X' * 64) }, @{ SHA256_ROOTFS = 'ab' },
|
||||
@{ SYSTEM = 'ubuntu-26.04'; OS = 'ubuntu'; UBUNTU = '26.04'; ROOTFS_ASSET = 'mu300-ubuntu-26.04-rootfs.tar.gz'; KERNEL = '5.4'; KERNEL_ASSET = 'mu300-kernel.tar.gz' })) {
|
||||
Check "package: refused $(@($bad.Keys) -join ',')=$(@($bad.Values) -join ',')" ($null -eq (PkgManifest $bad)) $true
|
||||
}
|
||||
# a key in another case is not one of the manifest's (the installer on the device reads TAG, not tag)
|
||||
[IO.File]::WriteAllText((Join-Path $px 'mu300\manifest'), "tag=v2026.10.27`n")
|
||||
Check 'package: keys are exact' ($null -eq (PackageManifest $px)) $true
|
||||
$pm = PkgManifest
|
||||
[IO.File]::WriteAllText((Join-Path $px 'mu300\SHA256SUMS'), "$hk mu300-kernel-6.18.tar.gz`n$hr *mu300-openwrt-rootfs.tar.gz`n")
|
||||
Check 'package: both match' "[$(PackageCheck $px 'mu300-kernel-6.18.tar.gz' $hk)][$(PackageCheck $px 'mu300-openwrt-rootfs.tar.gz' $hr)]" '[][]'
|
||||
Check 'package: not the manifest''s' (PackageCheck $px 'mu300-openwrt-rootfs.tar.gz' ('0' * 64)) 'mismatch'
|
||||
[IO.File]::WriteAllText((Join-Path $px 'mu300\SHA256SUMS'), "$hk mu300-kernel-6.18.tar.gz`n$('0' * 64) mu300-openwrt-rootfs.tar.gz`n")
|
||||
Check 'package: not SHA256SUMS''s' (PackageCheck $px 'mu300-openwrt-rootfs.tar.gz' $hr) 'mismatch'
|
||||
[IO.File]::WriteAllText((Join-Path $px 'mu300\SHA256SUMS'), "$hk mu300-kernel-6.18.tar.gz`n")
|
||||
Check 'package: not in SHA256SUMS' (PackageCheck $px 'mu300-openwrt-rootfs.tar.gz' $hr) 'mismatch'
|
||||
Remove-Item (Join-Path $px 'payload\mu300-kernel-6.18.tar.gz')
|
||||
Check 'package: missing' (PackageCheck $px 'mu300-kernel-6.18.tar.gz' $hk) 'missing'
|
||||
Remove-Item -Recurse -Force $px -ErrorAction SilentlyContinue
|
||||
|
||||
Write-Host "$script:passed passed, $script:failed failed"
|
||||
exit $script:failed
|
||||
@@ -232,6 +232,73 @@ class SlotBlocks(Fixtures):
|
||||
self.assertNotEqual(r.returncode, 0)
|
||||
|
||||
|
||||
@unittest.skipIf(not HAVE_LZ4, 'neither the lz4 command nor the lz4 Python module is installed')
|
||||
class WithoutTheFirstSegmentsBinaries(Fixtures):
|
||||
"""A Magisk zip of a mainline kernel, unpacked on a computer (tools/package.sh), has no 5.4 bundle: the boot image's
|
||||
first segment then carries no busybox, logdw or modules, and the kernel's generic segment - unpacked after it,
|
||||
replacing what the first one has of those anyway - must bring every one of them."""
|
||||
|
||||
def image(self, appended, *drop):
|
||||
fake_stock(self.tmp / 'stock.img')
|
||||
fake_misc(self.tmp / 'misc.bin')
|
||||
(self.tmp / 'Image').write_bytes(b'\x7fkernel' * 100)
|
||||
out = self.tmp / 'boot.img'
|
||||
args = {'--modules': str(self.mods), '--busybox': str(self.tmp / 'busybox'), '--logdw': str(self.tmp / 'logdw')}
|
||||
argv = [sys.executable, str(BOOT / 'build-boot-image.py'), '--stock-boot', str(self.tmp / 'stock.img'),
|
||||
'--misc-head', str(self.tmp / 'misc.bin'), '--kernel', str(self.tmp / 'Image'), '--device', 'f50',
|
||||
'--ueventd-perms', str(TOP / 'android-vendor' / 'ueventd-perms.sh'), '--out', str(out)]
|
||||
for k, v in args.items():
|
||||
if k not in drop:
|
||||
argv += [k, v]
|
||||
if appended:
|
||||
argv += ['--append-ramdisk', str(appended)]
|
||||
return subprocess.run(argv, capture_output=True, text=True), out
|
||||
|
||||
def segment(self, files):
|
||||
"""an appended segment holding FILES (names), made with the builder's own functions"""
|
||||
import importlib.util
|
||||
spec = importlib.util.spec_from_file_location('bbi', BOOT / 'build-boot-image.py')
|
||||
mod = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(mod)
|
||||
seg = self.tmp / 'segment.lz4'
|
||||
seg.write_bytes(mod.lz4_legacy(mod.cpio_archive({'bin', 'etc'}, {n: (b'x', 0o100644) for n in files})))
|
||||
return seg
|
||||
|
||||
def test_the_generic_segment_brings_them(self):
|
||||
r, generic = self.build()
|
||||
self.assertEqual(r.returncode, 0, r.stderr)
|
||||
r, out = self.image(generic, '--modules', '--busybox', '--logdw')
|
||||
self.assertEqual(r.returncode, 0, r.stderr)
|
||||
img = out.read_bytes()
|
||||
ksz, rsz = struct.unpack_from('<II', img, 8)
|
||||
roff = 4096 + (ksz + 4095) // 4096 * 4096
|
||||
ram = img[roff:roff + rsz]
|
||||
first = cpio_files(unlz4_legacy(ram)) # (the first archive: cpio_files stops at its trailer)
|
||||
for f in ('bin/busybox', 'bin/logdw', 'etc/module-order'):
|
||||
self.assertNotIn(f, first)
|
||||
self.assertFalse([f for f in first if f.startswith('linux-modules/') and f.endswith('.ko')])
|
||||
for f in ('init', 'etc/mu300-device', 'etc/mu300-linux-slot', 'etc/misc-bc-slot-b-trial.bin', 'bin/sh'):
|
||||
self.assertIn(f, first)
|
||||
# behind it the generic segment, unchanged, and then this checkout's init
|
||||
self.assertIn(generic.read_bytes(), ram)
|
||||
self.assertEqual(json.loads((self.tmp / 'boot.json').read_text())['modules'], 0)
|
||||
|
||||
def test_what_the_generic_segment_lacks_is_refused(self):
|
||||
for files, drop, word in ((['init', 'etc/module-order', 'bin/busybox'], '--logdw', 'bin/logdw'),
|
||||
(['init', 'etc/module-order', 'bin/logdw'], '--busybox', 'bin/busybox'),
|
||||
(['init', 'bin/busybox', 'bin/logdw'], '--modules', 'etc/module-order')):
|
||||
r, out = self.image(self.segment(files), drop)
|
||||
self.assertNotEqual(r.returncode, 0, drop)
|
||||
self.assertIn(word, r.stderr)
|
||||
self.assertFalse(out.exists())
|
||||
|
||||
def test_only_with_an_appended_segment(self):
|
||||
for drop in ('--modules', '--busybox', '--logdw'):
|
||||
r, out = self.image(None, drop)
|
||||
self.assertNotEqual(r.returncode, 0, drop)
|
||||
self.assertIn('only with --append-ramdisk', r.stderr)
|
||||
|
||||
|
||||
class ModuleOrder(unittest.TestCase):
|
||||
def test_u30air_order(self):
|
||||
base = (BOOT / 'module-order.txt').read_text().split()
|
||||
|
||||
@@ -1184,6 +1184,26 @@ class Window(unittest.TestCase):
|
||||
self.assertIn('Parallel connections per download', show('install', 2))
|
||||
self.assertIn('Never copied by the installer', show('install', 3))
|
||||
self.assertIn('Ubuntu 26.04', show('install', 4))
|
||||
# started from an unpacked Magisk zip: its system and kernel, nothing to choose about them, nothing to download
|
||||
import copy
|
||||
saved = ctl.choices
|
||||
pkg = {'dir': '/somewhere/mu300-magisk-v2026.10.23-openwrt-luci-k7.2', 'tag': 'v2026.10.23', 'system': 'openwrt-luci',
|
||||
'os': 'openwrt-luci', 'ubuntu': '', 'kernel': '7.2', 'files': {}, 'bytes': 45 << 20}
|
||||
ctl.choices = copy.copy(saved)
|
||||
ctl.choices.apply_package(pkg)
|
||||
ctl.package = pkg
|
||||
a._sync()
|
||||
page = show('install', 2)
|
||||
self.assertIn('This package', page)
|
||||
self.assertIn('OpenWrt with the MU300 control panel', page)
|
||||
for gone in ('Ubuntu LTS', 'The beta: v2026.10.25', 'The web panel for Ubuntu'):
|
||||
self.assertNotIn(gone, page)
|
||||
self.assertEqual(ctl.problems(), [])
|
||||
self.assertIn('this unpacked Magisk zip, nothing downloaded', show('install', 4))
|
||||
ctl.package = {'dir': '/somewhere/else', 'error': 'manifest'}
|
||||
self.assertIn('is not an unpacked Magisk zip of a release that this installer can read', show('install', 2))
|
||||
ctl.choices, ctl.package = saved, None
|
||||
a._sync()
|
||||
# other devices: no root, a locked bootloader, data in the free space, a card, no room
|
||||
ctl.facts = facts(root='no'); ctl.check_state = 'failed'; ctl.check_error = 'su does not work on the device'
|
||||
self.assertIn('Without root nothing can be installed', show('install', 0))
|
||||
|
||||
@@ -457,7 +457,7 @@ class Storage(ShellTest):
|
||||
|
||||
def test_installer_refuses_a_card_install_with_a_kernel_that_cannot_read_it(self):
|
||||
src = (TOP / 'install.sh').read_text()
|
||||
unpack = src.index('tar -xzf "$REL/mu300-kernel-$KERNEL.tar.gz" -C "$KMAIN"')
|
||||
unpack = src.index('tar -xzf "$ASSETS/mu300-kernel-$KERNEL.tar.gz" -C "$KMAIN"')
|
||||
check = src.index('sd_kernel_ok "$KMAIN" || die')
|
||||
self.assertLess(unpack, check)
|
||||
self.assertLess(check, src.index("say \"$(t 'Adding the vendor files from your device to the images')\""))
|
||||
@@ -1256,7 +1256,7 @@ class VpnOnInTheReplacedSystem(ShellTest):
|
||||
|
||||
def question(self, shell, probe, answer):
|
||||
src = (TOP / 'install.sh').read_text()
|
||||
block = src[src.index('vx_default=no\n'):src.index('\nKERNEL=5.4\n')]
|
||||
block = src[src.index('vx_default=no\n'):src.index('\n[ -n "$PKG" ] || KERNEL=5.4\n')]
|
||||
block = block[:block.index('\nEXTRA_VPN=')]
|
||||
code = (f'TOP="{TOP}"; . "$TOP/tools/i18n.sh"; MU300_LANG=en; OSES="ubuntu openwrt"; '
|
||||
'die() { echo "DIE $*"; exit 1; }; '
|
||||
|
||||
+253
-7
@@ -1,9 +1,14 @@
|
||||
"""The zip: customize.sh in a fake Magisk installer environment, tools/make-magisk-zips.sh and, on a release's real
|
||||
zips (MU300_MAGISK_ZIPS), the allow-list, the manifest against the payload and a dry run of each zip's installer."""
|
||||
zips (MU300_MAGISK_ZIPS), the allow-list, the manifest against the payload and a dry run of each zip's installer.
|
||||
A zip is also an installer for a computer once unpacked (computer/, START-HERE.md, the launchers): what that adds, and
|
||||
that the Magisk side of a zip installs exactly as it does without it."""
|
||||
import hashlib
|
||||
import io
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import stat
|
||||
import struct
|
||||
import subprocess
|
||||
import tarfile
|
||||
import tempfile
|
||||
@@ -13,8 +18,36 @@ from pathlib import Path
|
||||
|
||||
from fakedevice import FakeDevice
|
||||
from helpers import TOP, ShellTest, shells
|
||||
from test_android_boot_image import MAGISKBOOT, fake_android_root
|
||||
from test_magisk_installer import MU300_FILES
|
||||
from test_android_boot_image import MAGISKBOOT, cpio_all, fake_android_root, leaves, ramdisk_of
|
||||
from test_boot_image import unlz4_legacy
|
||||
from test_magisk_installer import MU300_FILES, generic_ramdisk, tar_gz
|
||||
|
||||
COMPUTER_DIR = TOP / 'android/magisk/computer'
|
||||
LAUNCHERS = ('START-HERE.md', 'start.sh', 'start.cmd', 'start-gui.sh', 'start-gui.cmd', 'uninstall-linux.sh',
|
||||
'uninstall-linux.cmd')
|
||||
|
||||
|
||||
def computer_files():
|
||||
"""The project's files that go into a zip as computer/<path> (android/magisk/computer/files.txt, a directory
|
||||
standing for its files, never a cache of Python's or a hidden file), as make-magisk-zips.sh expands it."""
|
||||
out = set()
|
||||
for line in (COMPUTER_DIR / 'files.txt').read_text().splitlines():
|
||||
line = line.split('#', 1)[0].strip()
|
||||
if not line:
|
||||
continue
|
||||
p = TOP / line
|
||||
if p.is_dir():
|
||||
for f in p.rglob('*'):
|
||||
rel = f.relative_to(TOP).as_posix()
|
||||
if f.is_file() and not f.name.startswith('.') and not f.name.endswith('.pyc') and '__pycache__' not in rel:
|
||||
out.add(rel)
|
||||
else:
|
||||
out.add(line)
|
||||
return out
|
||||
|
||||
|
||||
# what a zip holds for a computer, beside what it holds for Magisk
|
||||
COMPUTER = set(LAUNCHERS) | {'computer/.mu300-package'} | {'computer/' + f for f in computer_files()}
|
||||
|
||||
MAGISK_ENV = r'''
|
||||
ui_print() { echo "$1"; }
|
||||
@@ -88,10 +121,11 @@ class Customize(ShellTest):
|
||||
self.assertNotIn('ran', r.stdout)
|
||||
|
||||
|
||||
ALLOWED = {'META-INF/com/google/android/update-binary', 'META-INF/com/google/android/updater-script',
|
||||
'module.prop', 'customize.sh', 'action.sh', 'switch.sh', 'bootchain.sh', 'system/bin/mu300-linux',
|
||||
# the release's own checksums: what an update from the zip is checked against (mu300-update apply --from)
|
||||
'mu300/SHA256SUMS'} | set(MU300_FILES)
|
||||
MAGISK = {'META-INF/com/google/android/update-binary', 'META-INF/com/google/android/updater-script',
|
||||
'module.prop', 'customize.sh', 'action.sh', 'switch.sh', 'bootchain.sh', 'system/bin/mu300-linux',
|
||||
# the release's own checksums: what an update from the zip is checked against (mu300-update apply --from)
|
||||
'mu300/SHA256SUMS'} | set(MU300_FILES)
|
||||
ALLOWED = MAGISK | COMPUTER
|
||||
# a signed release's zips carry its signature too
|
||||
SIGNATURE = 'mu300/SHA256SUMS.sig'
|
||||
ASSETS = ('mu300-kernel.tar.gz', 'mu300-kernel-6.18.tar.gz', 'mu300-kernel-7.2.tar.gz', 'mu300-openwrt-rootfs.tar.gz',
|
||||
@@ -221,6 +255,218 @@ class Builder(unittest.TestCase):
|
||||
self.assertFalse([n for n in zipfile.ZipFile(zp).namelist() if n.endswith('mu300-install.conf')])
|
||||
|
||||
|
||||
|
||||
class ComputerSide(unittest.TestCase):
|
||||
"""Unpacked on a computer a zip is an installer: computer/ is the project's installers, START-HERE.md and the
|
||||
launchers are at the top, and computer/.mu300-package tells install.sh that the payload is next to it."""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.tmp = Path(tempfile.mkdtemp(prefix='mu300-zips-computer-'))
|
||||
fake_release(cls.tmp / 'v2026.10.06')
|
||||
r = subprocess.run(['sh', str(TOP / 'tools/make-magisk-zips.sh'), str(cls.tmp / 'v2026.10.06'), str(cls.tmp / 'out')],
|
||||
capture_output=True, text=True)
|
||||
assert r.returncode == 0, r.stderr
|
||||
cls.zip = zipfile.ZipFile(cls.tmp / 'out/mu300-magisk-v2026.10.06-ubuntu-26.04-k7.2.zip')
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.zip.close()
|
||||
shutil.rmtree(cls.tmp, ignore_errors=True)
|
||||
|
||||
def test_the_installers_of_this_checkout(self):
|
||||
names = set(self.zip.namelist())
|
||||
self.assertEqual(COMPUTER - names, set())
|
||||
for f in computer_files():
|
||||
data = self.zip.read('computer/' + f)
|
||||
want = (TOP / f).read_bytes()
|
||||
if f.endswith('.cmd'): # for cmd.exe: CRLF, whatever the checkout has
|
||||
want = want.replace(b'\r\n', b'\n').replace(b'\n', b'\r\n')
|
||||
self.assertEqual(data, want, f)
|
||||
# the essentials, by name: a list that lost one would not be noticed until a computer ran it
|
||||
for f in ('install.sh', 'install.ps1', 'uninstall.sh', 'uninstall.ps1', 'tools/package.sh', 'tools/answers.sh',
|
||||
'boot/build-boot-image.py', 'boot/init', 'gui/mu300-gui.py', 'gui/mu300gui/package.py',
|
||||
'android/magisk/mu300-linux-switch/switch.sh', 'i18n/tr.tsv'):
|
||||
self.assertIn('computer/' + f, names)
|
||||
self.assertFalse([n for n in names if '__pycache__' in n or n.endswith('.pyc')])
|
||||
|
||||
def test_the_payload_is_there_once(self):
|
||||
# the computer's installers use payload/ where it is: no second copy of a system or a kernel
|
||||
tars = [n for n in self.zip.namelist() if n.endswith('.tar.gz')]
|
||||
self.assertEqual(sorted(tars), ['payload/mu300-kernel-7.2.tar.gz', 'payload/mu300-ubuntu-26.04-rootfs.tar.gz'])
|
||||
|
||||
def test_start_here_names_this_zip(self):
|
||||
text = self.zip.read('START-HERE.md').decode()
|
||||
self.assertIn('ubuntu-26.04', text)
|
||||
self.assertIn('7.2', text)
|
||||
self.assertIn('v2026.10.06', text)
|
||||
self.assertNotRegex(text, r'@[A-Z]+@')
|
||||
for word in ('Türkçe', '中文', 'start.cmd', 'start-gui.sh', 'platform-tools', 'magisk --install-module'):
|
||||
self.assertIn(word, text)
|
||||
|
||||
def test_launchers(self):
|
||||
for name in LAUNCHERS:
|
||||
info = self.zip.getinfo(name)
|
||||
data = self.zip.read(name)
|
||||
if name.endswith('.cmd'):
|
||||
self.assertNotIn(b'\n', data.replace(b'\r\n', b''), name)
|
||||
self.assertTrue(data.startswith(b'@echo off\r\n'), name)
|
||||
if name.endswith('.sh'):
|
||||
self.assertEqual(stat.S_IMODE(info.external_attr >> 16) & 0o111, 0o111, name)
|
||||
self.assertNotIn(b'\r', data, name)
|
||||
for name in ('start.sh', 'start-gui.sh', 'start.cmd', 'start-gui.cmd'):
|
||||
self.assertIn(b'MU300_PACKAGE', self.zip.read(name), name)
|
||||
for name in ('start-gui.sh', 'start-gui.cmd'):
|
||||
self.assertIn(b'MU300_GUI=1', self.zip.read(name), name)
|
||||
self.assertEqual(stat.S_IMODE(self.zip.getinfo('computer/install.sh').external_attr >> 16) & 0o111, 0o111)
|
||||
self.assertIn('computer/.mu300-package', self.zip.namelist())
|
||||
|
||||
def test_no_platform_tools(self):
|
||||
# Google's SDK licence (3.4) does not allow passing them on: START-HERE.md says where to get them
|
||||
self.assertFalse([n for n in self.zip.namelist() if re.search(r'(^|/)(adb|adb\.exe|AdbWinApi\.dll|fastboot)$', n)])
|
||||
|
||||
def test_the_magisk_side_unpacks_none_of_it(self):
|
||||
# customize.sh unpacks named entries only: a file of the computer's side never reaches the device's module
|
||||
src = (TOP / 'android/magisk/installer/customize.sh').read_text()
|
||||
m = re.search(r"unzip -o -q \"\$ZIPFILE\" (.+?) -d", src)
|
||||
self.assertEqual(m.group(1), "'mu300/*' module.prop action.sh switch.sh bootchain.sh 'system/*'")
|
||||
self.assertIn('SKIPUNZIP=1', src)
|
||||
for n in COMPUTER:
|
||||
self.assertFalse(n.startswith(('mu300/', 'system/')) or n in MAGISK, n)
|
||||
|
||||
|
||||
class ComputerFilesList(unittest.TestCase):
|
||||
"""android/magisk/computer/files.txt holds every file the computer's installers name ($TOP/... in the shell
|
||||
scripts, $Top\\... and Join-Path $Top in the PowerShell ones), except what only --build or the release uses."""
|
||||
BUILD_ONLY = ('out', 'work', 'release/', 'kernel', 'openwrt/', 'rootfs', 'upstream/', 'tools/adbd/', 'tools/gpu',
|
||||
'tools/make-extra.sh', 'tools/cockpit-i18n.py', 'tools/sign-release.sh', 'platform-tools', '.git',
|
||||
'.mu300-keep', '.mu300-source', 'tools/', 'tools', 'i18n/', 'android/magisk/installer',
|
||||
'rootfs/overlay/opt/mu300/bin/mu300-update', 'rootfs/overlay/opt/mu300/lib/release.pub',
|
||||
'rootfs/panel/', 'gui', 'tools/android-boot-image.sh')
|
||||
|
||||
def test_every_file_named_is_listed(self):
|
||||
listed = computer_files()
|
||||
listed_dirs = {f.rsplit('/', 1)[0] for f in listed}
|
||||
scripts = [f for f in sorted(listed) if f.endswith(('.sh', '.ps1')) and not f.startswith('android/magisk/mu300-linux-switch')]
|
||||
missing = []
|
||||
for f in scripts:
|
||||
text = (TOP / f).read_text(encoding='utf-8')
|
||||
refs = re.findall(r'\$TOP/([A-Za-z0-9_./-]+)', text)
|
||||
refs += [r.replace('\\', '/') for r in re.findall(r'\$Top\\([A-Za-z0-9_.\\-]+)', text)]
|
||||
refs += [r.replace('\\', '/') for r in re.findall(r"Join-Path \$Top '([A-Za-z0-9_.\\-]+)", text)]
|
||||
for ref in refs:
|
||||
ref = ref.rstrip('/.')
|
||||
if not ref or ref in self.BUILD_ONLY or any(ref.startswith(b) for b in self.BUILD_ONLY if b.endswith('/')):
|
||||
continue
|
||||
if not (TOP / ref).exists():
|
||||
continue # a name put together at run time (openwrt/mu300-$os...)
|
||||
if ref not in listed and ref not in listed_dirs:
|
||||
missing.append(f'{f}: {ref}')
|
||||
self.assertEqual(missing, [])
|
||||
|
||||
|
||||
def full_fake_release(rel):
|
||||
"""REL like a release, with kernel bundles and systems the zip's own installer can install on the fake device of
|
||||
tests/fakedevice.py (test_magisk_installer.InstallerCase.zip makes them the same way)"""
|
||||
rel.mkdir(parents=True)
|
||||
sums = []
|
||||
for a in ASSETS:
|
||||
if a.startswith('mu300-kernel'):
|
||||
krel = '5.4.254-mu300' if a == 'mu300-kernel.tar.gz' else a[len('mu300-kernel-'):-len('.tar.gz')] + '.0-mu300'
|
||||
files = {'Image': b'\x7fkernel' * 1000, 'ramdisk-generic.lz4': generic_ramdisk(),
|
||||
'modules/mu300-test.ko': b'\x7fELF test module', 'kernel.release': (krel + '\n').encode(),
|
||||
'devices': b'f50 u30air\n', 'features': b'sdcard\n'}
|
||||
if a == 'mu300-kernel.tar.gz':
|
||||
files['busybox'] = b'#!busybox\n'
|
||||
data = tar_gz(files)
|
||||
else:
|
||||
os_ = 'ubuntu' if 'ubuntu' in a else ('openwrt-luci' if 'luci' in a else 'openwrt')
|
||||
data = tar_gz({'etc/os-release': f'ID={os_}\n'.encode()})
|
||||
(rel / a).write_bytes(data)
|
||||
sums.append(f'{hashlib.sha256(data).hexdigest()} {a}\n')
|
||||
(rel / 'mu300-update').write_bytes(b'#!/bin/sh\n')
|
||||
sums.append(f'{hashlib.sha256(b"#!/bin/sh" + chr(10).encode()).hexdigest()} mu300-update\n')
|
||||
(rel / 'SHA256SUMS').write_text(''.join(sums))
|
||||
|
||||
|
||||
@unittest.skipUnless(BUSYBOX, 'no busybox')
|
||||
class MagiskPathUnchanged(ShellTest):
|
||||
"""The Magisk side of a zip built with its computer side installs exactly as the same zip without it (the layout
|
||||
of the zips before computer/ was added): customize.sh, in a fake Magisk installer environment, runs the zip's own
|
||||
installer on the fake device - a dry run and a whole installation - and both zips give the same output, the
|
||||
same boot partitions, misc and module."""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.rel_tmp = Path(tempfile.mkdtemp(prefix='mu300-zips-magisk-'))
|
||||
full_fake_release(cls.rel_tmp / 'v2026.10.06')
|
||||
r = subprocess.run(['sh', str(TOP / 'tools/make-magisk-zips.sh'), str(cls.rel_tmp / 'v2026.10.06'), str(cls.rel_tmp / 'out')],
|
||||
capture_output=True, text=True)
|
||||
assert r.returncode == 0, r.stderr
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
shutil.rmtree(cls.rel_tmp, ignore_errors=True)
|
||||
|
||||
def without_computer_side(self, src, dst):
|
||||
with zipfile.ZipFile(src) as zi, zipfile.ZipFile(dst, 'w') as zo:
|
||||
for i in zi.infolist():
|
||||
if i.filename not in COMPUTER:
|
||||
zo.writestr(i, zi.read(i.filename))
|
||||
return dst
|
||||
|
||||
def run_zip(self, zp, conf):
|
||||
shutil.rmtree(self.tmp / 'fake', ignore_errors=True)
|
||||
fake = FakeDevice(self.tmp, self.stubs)
|
||||
fake_android_root(fake.root / 'android')
|
||||
(fake.root / 'magisk/busybox').symlink_to(BUSYBOX)
|
||||
if conf:
|
||||
(fake.root / 'sdcard/mu300-install.conf').write_text(conf)
|
||||
mod = self.tmp / 'modpath'
|
||||
shutil.rmtree(mod, ignore_errors=True)
|
||||
shutil.rmtree(self.tmp / 't', ignore_errors=True)
|
||||
(self.tmp / 't').mkdir()
|
||||
env = {k: str(v) for k, v in fake.env(self.tmp / 'unused', self.stubs / 'magiskboot').items()}
|
||||
code = (MAGISK_ENV + f'ZIPFILE="{zp}"; MODPATH="{mod}"; TMPDIR="{self.tmp}/t"; set +e +u; '
|
||||
f'. "{TOP}/android/magisk/installer/customize.sh"; echo "customize returned"')
|
||||
r = subprocess.run([BUSYBOX, 'sh', '-c', code], capture_output=True, text=True, env=self.env(**env), timeout=300)
|
||||
by = fake.root / 'dev/block/by-name'
|
||||
state = {n: hashlib.sha256((by / n).read_bytes()).hexdigest() for n in ('boot_a', 'misc')}
|
||||
# boot_b: what it holds, not its bytes - the device segment's cpio carries the times its files were made
|
||||
img = (by / 'boot_b').read_bytes()
|
||||
if img[44:54] == b'loglevel=5':
|
||||
ksz = struct.unpack_from('<I', img, 8)[0]
|
||||
state['boot_b'] = (img[44:44 + 1536], hashlib.sha256(img[4096:4096 + ksz]).hexdigest(),
|
||||
{n: hashlib.sha256(d).hexdigest() + str(x) for n, (k, x, d) in
|
||||
leaves(cpio_all(unlz4_legacy(ramdisk_of(img)))).items()})
|
||||
else:
|
||||
state['boot_b'] = hashlib.sha256(img).hexdigest()
|
||||
state['module'] = sorted(str(p.relative_to(mod)) for p in mod.rglob('*')) if mod.exists() else None
|
||||
out = re.sub(r'mu300-magisk\.\w+', 'mu300-magisk.X', r.stdout)
|
||||
out = re.sub(r'\$6\$[^$\s]+\$\S+', '$6$salt$hash', out)
|
||||
return r, out, state
|
||||
|
||||
def test_dry_run_and_install_as_before(self):
|
||||
self.stub('magiskboot', MAGISKBOOT)
|
||||
for name in ('mu300-magisk-v2026.10.06-openwrt-k6.18.zip', 'mu300-magisk-v2026.10.06-ubuntu-24.04-k5.4.zip'):
|
||||
now = self.rel_tmp / 'out' / name
|
||||
before = self.without_computer_side(now, self.tmp / ('before-' + name))
|
||||
self.assertTrue(set(zipfile.ZipFile(now).namelist()) - set(zipfile.ZipFile(before).namelist()))
|
||||
for conf, rc_word in (('MU300_DRY_RUN=1\n', 'Dry run'), ('', None)):
|
||||
r1, out1, st1 = self.run_zip(before, conf)
|
||||
r2, out2, st2 = self.run_zip(now, conf)
|
||||
if rc_word:
|
||||
self.assertIn(rc_word, out1)
|
||||
self.assertIsNone(st1['module'])
|
||||
else:
|
||||
self.assertNotIn('ABORT', out1, out1 + r1.stderr)
|
||||
self.assertIn('switch.sh', st1['module'])
|
||||
self.assertIsInstance(st1['boot_b'], tuple) # a Linux boot image was written
|
||||
self.assertIn('etc/mu300-device', st1['boot_b'][2])
|
||||
self.assertEqual(out2, out1, name)
|
||||
self.assertEqual(st2, st1, name)
|
||||
|
||||
|
||||
class Workflow(unittest.TestCase):
|
||||
def test_package_lists_are_fresh_before_the_tools_are_installed(self):
|
||||
# a runner image's lists go stale; apt-get install then asks for package versions the mirror dropped
|
||||
|
||||
@@ -0,0 +1,304 @@
|
||||
"""A release's Magisk zip unpacked on a computer (tools/package.sh, android/magisk/computer/START-HERE.md): install.sh
|
||||
installs that zip's system and kernel from its own payload and downloads nothing. The manifest is read as the zip's
|
||||
own installer reads it, the payload is checked against it and against the release's SHA256SUMS, and an install from a
|
||||
real unpacked zip (tools/make-magisk-zips.sh) asks no question about the system, the kernel or the release - against
|
||||
the fake adb of tests/fakeadb.py, as far as the first pull. The graphical installer's side: package.py, and the
|
||||
choices and answers of a package."""
|
||||
import hashlib
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
|
||||
from helpers import TOP, ShellTest
|
||||
from test_answers import Device, events
|
||||
from test_magisk_zip import fake_release
|
||||
|
||||
sys.path.insert(0, str(TOP / 'gui'))
|
||||
from mu300gui import model, package # noqa: E402
|
||||
|
||||
KB = b'kernel bundle'
|
||||
ROOTFS = b'openwrt system'
|
||||
|
||||
|
||||
def manifest(**kw):
|
||||
m = dict(TAG='v2026.10.27', SYSTEM='openwrt', OS='openwrt', UBUNTU='', KERNEL='6.18',
|
||||
KERNEL_ASSET='mu300-kernel-6.18.tar.gz', ROOTFS_ASSET='mu300-openwrt-rootfs.tar.gz',
|
||||
SHA256_KERNEL=hashlib.sha256(KB).hexdigest(), SHA256_ROOTFS=hashlib.sha256(ROOTFS).hexdigest())
|
||||
m.update(kw)
|
||||
return ''.join(f'{k}={v}\n' for k, v in m.items())
|
||||
|
||||
|
||||
def make_package(d, text=None, sums=None, kernel=KB, rootfs=ROOTFS):
|
||||
"""D laid out like an unpacked zip: mu300/manifest, mu300/SHA256SUMS, payload/"""
|
||||
(d / 'mu300').mkdir(parents=True, exist_ok=True)
|
||||
(d / 'payload').mkdir(exist_ok=True)
|
||||
(d / 'mu300/manifest').write_text(manifest() if text is None else text)
|
||||
if sums is None:
|
||||
sums = (f'{hashlib.sha256(KB).hexdigest()} mu300-kernel-6.18.tar.gz\n'
|
||||
f'{hashlib.sha256(ROOTFS).hexdigest()} mu300-openwrt-rootfs.tar.gz\n')
|
||||
(d / 'mu300/SHA256SUMS').write_text(sums)
|
||||
if kernel is not None:
|
||||
(d / 'payload/mu300-kernel-6.18.tar.gz').write_bytes(kernel)
|
||||
if rootfs is not None:
|
||||
(d / 'payload/mu300-openwrt-rootfs.tar.gz').write_bytes(rootfs)
|
||||
return d
|
||||
|
||||
|
||||
class Library(ShellTest):
|
||||
PRE = (f'TOP="{TOP}"; t() {{ printf "%s" "$1"; shift; for a; do printf " [%s]" "$a"; done; }}; '
|
||||
'die() { echo "DIE: $*"; exit 1; }; progress() { echo "EVENT $*"; }; . "$TOP/tools/package.sh"; ')
|
||||
|
||||
def lib(self, shell, code, **env):
|
||||
return self.sh(shell, self.PRE + code, **env)
|
||||
|
||||
def test_where_the_package_is(self):
|
||||
top = self.tmp / 'pkg' / 'computer'
|
||||
top.mkdir(parents=True)
|
||||
for shell in self.each_shell():
|
||||
r = self.sh(shell, f'TOP="{top}"; . "{TOP}/tools/package.sh"; echo "[$(package_dir)]"')
|
||||
self.assertIn('[]', r.stdout) # a copy of the project
|
||||
(top / '.mu300-package').write_text('x\n')
|
||||
r = self.sh(shell, f'TOP="{top}"; . "{TOP}/tools/package.sh"; echo "[$(package_dir)]"')
|
||||
self.assertIn(f'[{top}/..]', r.stdout) # an unpacked zip: the directory above
|
||||
r = self.sh(shell, f'TOP="{top}"; . "{TOP}/tools/package.sh"; echo "[$(package_dir)]"', MU300_PACKAGE='/else')
|
||||
self.assertIn('[/else]', r.stdout) # MU300_PACKAGE names another
|
||||
(top / '.mu300-package').unlink()
|
||||
|
||||
def test_a_valid_manifest(self):
|
||||
d = make_package(self.tmp / 'p')
|
||||
for shell in self.each_shell():
|
||||
r = self.lib(shell, f'package_load "{d}/mu300/.."; echo "$PKG|$PKG_TAG|$PKG_SYSTEM|$PKG_OS|$PKG_UBUNTU|$PKG_KERNEL|$PKG_KERNEL_ASSET|$PKG_ROOTFS_ASSET"')
|
||||
self.assertEqual(r.returncode, 0, r.stdout + r.stderr)
|
||||
self.assertIn(f'{d}|v2026.10.27|openwrt|openwrt||6.18|mu300-kernel-6.18.tar.gz|mu300-openwrt-rootfs.tar.gz', r.stdout)
|
||||
# CRLF (a zip unpacked and edited on Windows) reads the same
|
||||
(d / 'mu300/manifest').write_text(manifest().replace('\n', '\r\n'))
|
||||
for shell in self.each_shell():
|
||||
r = self.lib(shell, f'package_load "{d}"; echo "[$PKG_KERNEL][$PKG_SHA256_ROOTFS]"')
|
||||
self.assertIn(f'[6.18][{hashlib.sha256(ROOTFS).hexdigest()}]', r.stdout)
|
||||
|
||||
def test_every_value_must_be_one_a_release_has(self):
|
||||
bad = [dict(TAG='2026.10.27'), dict(TAG='v1/../x'), dict(TAG='v1..2'), dict(TAG='v1;rm'),
|
||||
dict(SYSTEM='ubuntu'), dict(OS='ubuntu'), dict(ROOTFS_ASSET='../../etc/passwd'),
|
||||
dict(ROOTFS_ASSET='mu300-ubuntu-rootfs.tar.gz'), dict(KERNEL='6.19'), dict(KERNEL_ASSET='mu300-kernel.tar.gz'),
|
||||
dict(SHA256_KERNEL='x' * 64), dict(SHA256_ROOTFS='ab'),
|
||||
dict(SYSTEM='ubuntu-26.04', OS='ubuntu', UBUNTU='26.04', ROOTFS_ASSET='mu300-ubuntu-26.04-rootfs.tar.gz',
|
||||
KERNEL='5.4', KERNEL_ASSET='mu300-kernel.tar.gz')]
|
||||
for kw in bad:
|
||||
d = make_package(self.tmp / 'bad', text=manifest(**kw))
|
||||
for shell in self.each_shell():
|
||||
r = self.lib(shell, f'package_load "{d}"; echo LOADED')
|
||||
self.assertEqual(r.returncode, 1, kw)
|
||||
self.assertIn('DIE: the package is incomplete or damaged', r.stdout, kw)
|
||||
self.assertNotIn('LOADED', r.stdout)
|
||||
# a manifest is read, never run
|
||||
d = make_package(self.tmp / 'run', text=manifest() + '$(touch pwned)=1\nTAG=v1`touch pwned`\n')
|
||||
for shell in self.each_shell():
|
||||
r = self.lib(shell, f'cd "{self.tmp}"; package_load "{d}"; echo LOADED')
|
||||
self.assertEqual(r.returncode, 1)
|
||||
self.assertFalse((self.tmp / 'pwned').exists())
|
||||
|
||||
def test_not_a_package(self):
|
||||
for shell in self.each_shell():
|
||||
r = self.lib(shell, f'package_load "{self.tmp}/nothing"')
|
||||
self.assertIn('DIE: no unpacked Magisk zip at', r.stdout)
|
||||
r = self.lib(shell, f'package_load "{self.tmp}"')
|
||||
self.assertIn('is not an unpacked Magisk zip of a release', r.stdout)
|
||||
|
||||
def test_the_payload_is_checked_against_both(self):
|
||||
good = make_package(self.tmp / 'good')
|
||||
for shell in self.each_shell():
|
||||
r = self.lib(shell, f'package_load "{good}"; package_verify; echo VERIFIED')
|
||||
self.assertIn('VERIFIED', r.stdout, r.stdout + r.stderr)
|
||||
self.assertIn('EVENT verify file mu300-kernel-6.18.tar.gz result ok', r.stdout)
|
||||
self.assertIn('EVENT verify file mu300-openwrt-rootfs.tar.gz result ok', r.stdout)
|
||||
cases = {
|
||||
'a payload file that is not what the manifest says': dict(rootfs=b'another system'),
|
||||
'SHA256SUMS that does not name it': dict(sums=f'{hashlib.sha256(KB).hexdigest()} mu300-kernel-6.18.tar.gz\n'),
|
||||
'SHA256SUMS that says otherwise': dict(sums=f'{hashlib.sha256(KB).hexdigest()} mu300-kernel-6.18.tar.gz\n'
|
||||
f'{"0" * 64} mu300-openwrt-rootfs.tar.gz\n'),
|
||||
}
|
||||
for why, kw in cases.items():
|
||||
d = make_package(self.tmp / why.replace(' ', '-'), **kw)
|
||||
for shell in self.each_shell():
|
||||
r = self.lib(shell, f'package_load "{d}"; package_verify; echo VERIFIED')
|
||||
self.assertEqual(r.returncode, 1, why)
|
||||
self.assertIn('EVENT verify file mu300-openwrt-rootfs.tar.gz result mismatch', r.stdout, why)
|
||||
self.assertIn('DIE: checksum mismatch for {1} [mu300-openwrt-rootfs.tar.gz]', r.stdout, why)
|
||||
d = make_package(self.tmp / 'missing', kernel=None)
|
||||
for shell in self.each_shell():
|
||||
r = self.lib(shell, f'package_load "{d}"; package_verify; echo VERIFIED')
|
||||
self.assertIn('DIE: {1} is missing from the package (payload/) [mu300-kernel-6.18.tar.gz]', r.stdout)
|
||||
|
||||
|
||||
class FromAnUnpackedZip(Device):
|
||||
"""computer/install.sh of a real zip (tools/make-magisk-zips.sh, the fake release of test_magisk_zip), unpacked,
|
||||
in answers mode against the fake adb: it finds the payload next to it by itself."""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.zips = Path(tempfile.mkdtemp(prefix='mu300-package-'))
|
||||
fake_release(cls.zips / 'v2026.10.06')
|
||||
r = subprocess.run(['sh', str(TOP / 'tools/make-magisk-zips.sh'), str(cls.zips / 'v2026.10.06'), str(cls.zips / 'out')],
|
||||
capture_output=True, text=True)
|
||||
assert r.returncode == 0, r.stderr
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
shutil.rmtree(cls.zips, ignore_errors=True)
|
||||
|
||||
def unpack(self, name):
|
||||
d = self.tmp / 'unpacked' / name
|
||||
shutil.rmtree(d, ignore_errors=True)
|
||||
with zipfile.ZipFile(self.zips / 'out' / f'mu300-magisk-v2026.10.06-{name}.zip') as z:
|
||||
z.extractall(d)
|
||||
return d
|
||||
|
||||
def install(self, shell, pkg, answers, **env):
|
||||
f = self.tmp / 'answers.txt'
|
||||
f.write_text(''.join(f'{k}={v}\n' for k, v in answers.items()))
|
||||
f.chmod(0o600)
|
||||
e = dict(MU300_PROGRESS='1')
|
||||
e.update(env)
|
||||
r = self.run_script(shell, str(pkg / 'computer/install.sh'), '--answers', str(f), **e)
|
||||
ev = events(r.stdout)
|
||||
asked = [e['id'] for e in ev if e['event'] == 'question' and 'state' not in e]
|
||||
return r, ev, asked
|
||||
|
||||
ANSWERS = dict(MU300_ANS_DEFAULT_LINUX='yes', MU300_ANS_BOOT_ATTEMPTS='5', MU300_ANS_HOTSPOT='yes', MU300_ANS_GPU='no',
|
||||
MU300_ANS_VPN='no', MU300_ANS_ADB='no', MU300_ANS_PASSWORD='hunter2secret', MU300_ANS_CONFIRM='INSTALL')
|
||||
|
||||
def test_the_package_answers_the_system_the_kernel_and_the_release(self):
|
||||
pkg = self.unpack('ubuntu-26.04-k7.2')
|
||||
for shell in self.each_shell():
|
||||
self.device(pull=False)
|
||||
# no MU300_RELEASE: a package is its own release, and nothing asks GitHub (no curl here works)
|
||||
r, ev, asked = self.install(shell, pkg, self.ANSWERS, MU300_RELEASE='')
|
||||
self.assertEqual(asked, ['MU300_ANS_DEFAULT_LINUX', 'MU300_ANS_BOOT_ATTEMPTS', 'MU300_ANS_HOTSPOT', 'MU300_ANS_GPU',
|
||||
'MU300_ANS_VPN', 'MU300_ANS_ADB', 'MU300_ANS_PASSWORD'], r.stdout + r.stderr)
|
||||
facts = {e['key']: e['value'] for e in ev if e['event'] == 'info'}
|
||||
self.assertEqual(facts['package'], str(pkg))
|
||||
self.assertEqual((facts['package.system'], facts['package.kernel'], facts['package.release'], facts['release']),
|
||||
('ubuntu-26.04', '7.2', 'v2026.10.06', 'v2026.10.06'))
|
||||
self.assertIn('This package installs ubuntu-26.04 with kernel 7.2 (release v2026.10.06); nothing is downloaded.', r.stdout)
|
||||
self.assertIn('It is not part of this package.', r.stdout) # the web panel
|
||||
self.assertNotIn('Updating the installer', r.stdout) # no self-update
|
||||
self.assertIn('could not read /dev/block/by-name/boot_a from the device', ev[-1]['message'])
|
||||
self.assert_nothing_written()
|
||||
self.assertEqual([c['argv'] for c in self.calls() if 'MU300_ANS_PASSWORD' in c['answers']], [])
|
||||
self.assertNotIn('hunter2secret', r.stdout + r.stderr)
|
||||
|
||||
def test_another_package_another_system(self):
|
||||
pkg = self.unpack('openwrt-luci-k5.4')
|
||||
for shell in self.each_shell():
|
||||
self.device(pull=False)
|
||||
r, ev, asked = self.install(shell, pkg, self.ANSWERS)
|
||||
self.assertNotIn('MU300_ANS_SYSTEMS', asked)
|
||||
self.assertNotIn('MU300_OPENWRT', asked)
|
||||
self.assertNotIn('MU300_ANS_KERNEL', asked)
|
||||
self.assertIn('This package installs openwrt-luci with kernel 5.4', r.stdout)
|
||||
self.assertIn('could not read /dev/block/by-name/boot_a', ev[-1]['message'])
|
||||
|
||||
def test_the_v50_and_a_54_package(self):
|
||||
pkg = self.unpack('openwrt-k5.4')
|
||||
for shell in self.each_shell():
|
||||
self.device(pull=False, model='V50', device='MU3351', platform='ums9620')
|
||||
r, ev, asked = self.install(shell, pkg, self.ANSWERS)
|
||||
self.assertEqual(ev[-1]['event'], 'error')
|
||||
self.assertIn('take the zip for kernel 6.18 or 7.2 of this release', ev[-1]['message'])
|
||||
self.assertEqual(self.calls('pull'), [])
|
||||
self.assert_nothing_written()
|
||||
|
||||
def test_a_damaged_manifest_stops_before_the_device(self):
|
||||
pkg = self.unpack('openwrt-k6.18')
|
||||
(pkg / 'mu300/manifest').write_text((pkg / 'mu300/manifest').read_text().replace('KERNEL=6.18', 'KERNEL=9.9'))
|
||||
for shell in self.each_shell():
|
||||
self.device(pull=False)
|
||||
r, ev, asked = self.install(shell, pkg, self.ANSWERS)
|
||||
self.assertEqual(r.returncode, 1)
|
||||
self.assertEqual(ev[-1], {'event': 'error', 'message': 'the package is incomplete or damaged (its manifest is not valid)'})
|
||||
self.assertEqual(self.calls(), []) # not even adb devices
|
||||
|
||||
def test_build_is_refused(self):
|
||||
pkg = self.unpack('openwrt-k6.18')
|
||||
for shell in self.each_shell():
|
||||
self.device(pull=False)
|
||||
r = self.run_script(shell, str(pkg / 'computer/install.sh'), '--build', MU300_NONINTERACTIVE='1', MU300_PROGRESS='1')
|
||||
self.assertIn('--build builds the systems itself', events(r.stdout)[-1]['message'])
|
||||
|
||||
def test_the_launchers_find_it_too(self):
|
||||
# start.sh sets MU300_PACKAGE to its own folder (and puts platform-tools/ on the PATH): the same package
|
||||
pkg = self.unpack('openwrt-k6.18')
|
||||
(pkg / 'computer/.mu300-package').unlink() # only the launcher says where it is now
|
||||
for shell in self.each_shell():
|
||||
self.device(pull=False)
|
||||
f = self.tmp / 'answers.txt'
|
||||
f.write_text(''.join(f'{k}={v}\n' for k, v in self.ANSWERS.items()))
|
||||
f.chmod(0o600)
|
||||
r = self.run_script(shell, str(pkg / 'start.sh'), '--answers', str(f), MU300_PROGRESS='1')
|
||||
facts = {e['key']: e['value'] for e in events(r.stdout) if e['event'] == 'info'}
|
||||
self.assertEqual(facts.get('package'), str(pkg), r.stdout + r.stderr)
|
||||
|
||||
|
||||
class Window(unittest.TestCase):
|
||||
"""The graphical installer's side: the package it was started from, the choices it makes and the answers."""
|
||||
|
||||
def setUp(self):
|
||||
self.tmp = Path(tempfile.mkdtemp(prefix='mu300-package-gui-'))
|
||||
self.addCleanup(shutil.rmtree, self.tmp, ignore_errors=True)
|
||||
|
||||
def test_found_by_the_mark_or_named(self):
|
||||
top = self.tmp / 'pkg' / 'computer'
|
||||
top.mkdir(parents=True)
|
||||
self.assertIsNone(package.load(str(top), {}))
|
||||
make_package(self.tmp / 'pkg')
|
||||
(top / '.mu300-package').write_text('x\n')
|
||||
pkg = package.load(str(top), {})
|
||||
self.assertEqual((pkg['dir'], pkg['tag'], pkg['system'], pkg['os'], pkg['kernel']),
|
||||
(str(self.tmp / 'pkg'), 'v2026.10.27', 'openwrt', 'openwrt', '6.18'))
|
||||
self.assertEqual(pkg['bytes'], len(KB) + len(ROOTFS))
|
||||
other = make_package(self.tmp / 'other', text=manifest(SYSTEM='ubuntu-24.04', OS='ubuntu', UBUNTU='24.04',
|
||||
ROOTFS_ASSET='mu300-ubuntu-rootfs.tar.gz'))
|
||||
self.assertEqual(package.load(str(top), {'MU300_PACKAGE': str(other)})['system'], 'ubuntu-24.04')
|
||||
make_package(self.tmp / 'bad', text=manifest(TAG='x'))
|
||||
self.assertEqual(package.load(str(top), {'MU300_PACKAGE': str(self.tmp / 'bad')}).get('error'), 'manifest')
|
||||
|
||||
def test_the_same_rules_as_the_installers(self):
|
||||
self.assertIsNotNone(package.parse(manifest()))
|
||||
for kw in (dict(TAG='v1..2'), dict(SYSTEM='ubuntu'), dict(KERNEL='5.4'), dict(SHA256_ROOTFS='0' * 63),
|
||||
dict(SYSTEM='ubuntu-26.04', OS='ubuntu', UBUNTU='26.04', ROOTFS_ASSET='mu300-ubuntu-26.04-rootfs.tar.gz',
|
||||
KERNEL='5.4', KERNEL_ASSET='mu300-kernel.tar.gz')):
|
||||
self.assertIsNone(package.parse(manifest(**kw)), kw)
|
||||
|
||||
def test_choices_and_answers(self):
|
||||
make_package(self.tmp / 'pkg')
|
||||
pkg = package.load(str(self.tmp), {'MU300_PACKAGE': str(self.tmp / 'pkg')})
|
||||
c = model.Choices()
|
||||
c.apply_package(pkg)
|
||||
self.assertEqual((c.systems(), c.kernel, c.release, c.panel), (['openwrt'], '6.18', 'v2026.10.27', False))
|
||||
c.password = c.password2 = 'secret123'
|
||||
facts = model.Facts({'region.size': str(30 << 30), 'region.existing': 'no', 'device.kind': 'f50', 'root': 'yes'})
|
||||
a = model.answers(c, facts, 'en', '')
|
||||
for key in ('MU300_RELEASE', 'MU300_RELEASE_URL', 'MU300_ANS_BETA', 'MU300_ANS_SYSTEMS', 'MU300_OPENWRT',
|
||||
'MU300_ANS_BOOT_OS', 'MU300_ANS_UBUNTU', 'MU300_ANS_KERNEL', 'MU300_ANS_PANEL'):
|
||||
self.assertNotIn(key, a)
|
||||
for key in ('MU300_ANS_DEFAULT_LINUX', 'MU300_ANS_HOTSPOT', 'MU300_ANS_GPU', 'MU300_ANS_VPN', 'MU300_ANS_PASSWORD'):
|
||||
self.assertIn(key, a)
|
||||
self.assertEqual(model.download_plan(c, {'mu300-kernel.tar.gz': 1000}), ([], 0))
|
||||
self.assertGreater(model.work_need(c, {}), 400 << 20)
|
||||
self.assertIn(('Release', 'v2026.10.27'), model.summary(c, facts, ''))
|
||||
self.assertEqual(model.problems(c, facts), [])
|
||||
# a V50 and a 5.4 package: said where it is chosen, as the installer says it
|
||||
c2 = model.Choices()
|
||||
make_package(self.tmp / 'p54', text=manifest(KERNEL='5.4', KERNEL_ASSET='mu300-kernel.tar.gz'))
|
||||
c2.apply_package(package.load(str(self.tmp), {'MU300_PACKAGE': str(self.tmp / 'p54')}))
|
||||
c2.password = c2.password2 = 'secret123'
|
||||
c2.device = 'v50'
|
||||
self.assertIn('take the zip for kernel 6.18 or 7.2', ' '.join(m for _f, m in model.problems(c2, facts)))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -58,6 +58,32 @@ class JavaScript(unittest.TestCase):
|
||||
self.assertEqual(r.returncode, 0, f'{f}: {r.stderr}')
|
||||
|
||||
|
||||
def test_a_built_zip_with_its_computer_side_is_read_as_before(self):
|
||||
# the zips of tools/make-magisk-zips.sh, computer/ and the launchers in them: zip.js finds the manifest and the
|
||||
# installer of every one (the fake release of test_magisk_zip)
|
||||
from test_magisk_zip import fake_release
|
||||
tmp = Path(tempfile.mkdtemp(prefix='mu300-web-zips-'))
|
||||
try:
|
||||
fake_release(tmp / 'v2026.10.06')
|
||||
r = subprocess.run(['sh', str(TOP / 'tools/make-magisk-zips.sh'), str(tmp / 'v2026.10.06'), str(tmp / 'out')],
|
||||
capture_output=True, text=True)
|
||||
self.assertEqual(r.returncode, 0, r.stderr)
|
||||
script = ('import { inspectMagiskZip } from ' + json.dumps((WI / 'zip.js').as_uri()) + ';\n'
|
||||
'import { readFileSync } from "node:fs";\n'
|
||||
'for (const f of process.argv.slice(2)) console.log(JSON.stringify(await inspectMagiskZip(new Blob([readFileSync(f)]))));\n')
|
||||
(tmp / 'inspect.mjs').write_text(script)
|
||||
zips = sorted((tmp / 'out').glob('*.zip'))
|
||||
self.assertEqual(len(zips), 11)
|
||||
r = subprocess.run([NODE, str(tmp / 'inspect.mjs')] + [str(z) for z in zips], capture_output=True, text=True, timeout=120)
|
||||
self.assertEqual(r.returncode, 0, r.stderr)
|
||||
seen = [json.loads(l) for l in r.stdout.splitlines()]
|
||||
self.assertEqual(len(seen), 11)
|
||||
for z, info in zip(zips, seen):
|
||||
self.assertEqual(f"mu300-magisk-{info['tag']}-{info['system']}-k{info['kernel']}.zip", z.name)
|
||||
self.assertTrue(info['web'], z.name)
|
||||
finally:
|
||||
shutil.rmtree(tmp, ignore_errors=True)
|
||||
|
||||
class Strings(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.s = strings()
|
||||
|
||||
@@ -110,6 +110,16 @@ test("a picked Magisk zip: its manifest and whether its installer knows the web
|
||||
await assert.rejects(z.read("nope"), (e) => e.code === "no-entry");
|
||||
});
|
||||
|
||||
test("a zip that is also an installer for a computer (computer/, START-HERE.md, the launchers) is read the same", async () => {
|
||||
const extra = [["START-HERE.md", "# MU300 Linux"], ["start.sh", "#!/bin/sh\n"], ["start.cmd", "@echo off\r\n"], ["start-gui.sh", "x"],
|
||||
["start-gui.cmd", "x"], ["uninstall-linux.sh", "x"], ["uninstall-linux.cmd", "x"], ["computer/.mu300-package", "x"]];
|
||||
for (let i = 0; i < 200; i++) extra.push([`computer/tools/file-${i}.sh`, "#!/bin/sh\n# " + "x".repeat(i)]);
|
||||
const zip = makeZip([["mu300/manifest", MANIFEST()], ["mu300/install.sh", "#!/system/bin/sh\n# MU300_ANSWERS MU300-STEP\n"],
|
||||
["mu300/android-install.sh", "x"], ["switch.sh", "x"], ["module.prop", "id=mu300_linux_switch\n"], ...extra,
|
||||
["payload/mu300-ubuntu-rootfs.tar.gz", crypto.randomBytes(100000), 0]]);
|
||||
assert.deepEqual(await inspectMagiskZip(zip), { tag: "v2026.11.01", system: "ubuntu-24.04", os: "ubuntu", ubuntu: "24.04", kernel: "6.18", web: true });
|
||||
});
|
||||
|
||||
test("what is not one of our zips is refused with a reason", async () => {
|
||||
const code = (c) => (e) => e instanceof ZipError && e.code === c;
|
||||
await assert.rejects(inspectMagiskZip(new Blob(["hello"])), code("not-a-zip"));
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ from pathlib import Path
|
||||
|
||||
TOP = Path(__file__).resolve().parent.parent
|
||||
SOURCES = ['install.sh', 'install.ps1', 'tools/linux-mode.sh', 'tools/self-update.sh', 'tools/storage.sh',
|
||||
'tools/releases.sh', 'tools/answers.sh', 'tools/answers.ps1', 'tools/gui-launch.sh', 'tools/gui-launch.ps1',
|
||||
'tools/releases.sh', 'tools/package.sh', 'tools/answers.sh', 'tools/answers.ps1', 'tools/gui-launch.sh', 'tools/gui-launch.ps1',
|
||||
'android/magisk/installer/mu300-install.sh']
|
||||
# single- or double-quoted first argument; the PowerShell side writes '' for a quote inside '...'
|
||||
PATTERNS = [re.compile(r"""\b[tT] '((?:[^']|'')*)'"""), re.compile(r'''\b[tT] "([^"$`]*)"''')]
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
# Update): for that it carries the release's SHA256SUMS and, when the release is signed, SHA256SUMS.sig - the
|
||||
# signature covers the SHA256SUMS, and the SHA256SUMS the two assets of the payload, so a zip can be checked against
|
||||
# the project's release key wherever it came from (docs/FINDINGS.md 86). The installer does not read either.
|
||||
# Unpacked on a computer, a zip is an installer for that computer too (docs/FINDINGS.md 111): computer/ holds this
|
||||
# project's installers (android/magisk/computer/files.txt), with START-HERE.md and the launchers at the top, and they
|
||||
# install the zip's own payload (tools/package.sh). None of that is a file the Magisk side reads: customize.sh unpacks
|
||||
# only module.prop, mu300/, the switch module and system/, so a zip installs in Magisk exactly as it did without them.
|
||||
set -eu
|
||||
USAGE='usage: tools/make-magisk-zips.sh RELEASE_DIR OUT_DIR [TAG]'
|
||||
TOP=$(cd "$(dirname "$0")/.." && pwd)
|
||||
@@ -41,6 +45,24 @@ COMMON='META-INF/com/google/android/update-binary META-INF/com/google/android/up
|
||||
action.sh switch.sh bootchain.sh system/bin/mu300-linux mu300/install.sh mu300/android-boot-image.sh mu300/mu300-update
|
||||
mu300/android-install.sh mu300/android-bootchain.sh mu300/android-mount-mu300root.sh mu300/storage.sh mu300/i18n.sh mu300/i18n/tr.tsv
|
||||
mu300/i18n/zh.tsv mu300/subset-files.txt mu300/gpu-files.txt mu300/busybox mu300/manifest mu300/SHA256SUMS'
|
||||
# ... and the computer's side: the launchers, the guide, and computer/ - the files of files.txt (a directory: every
|
||||
# file in it, never a cache of Python's or a hidden file), and the mark that says "the payload is next to me"
|
||||
C=$TOP/android/magisk/computer
|
||||
LAUNCHERS='START-HERE.md start.sh start.cmd start-gui.sh start-gui.cmd uninstall-linux.sh uninstall-linux.cmd'
|
||||
COMPUTER=$(sed -e 's/#.*//' -e 's/[[:space:]]*$//' "$C/files.txt" | while IFS= read -r f; do
|
||||
[ -n "$f" ] || continue
|
||||
if [ -d "$TOP/$f" ]; then
|
||||
(cd "$TOP" && find "$f" -type f ! -name '.*' ! -name '*.pyc' ! -path '*/__pycache__/*')
|
||||
elif [ -f "$TOP/$f" ]; then
|
||||
echo "$f"
|
||||
else
|
||||
echo "android/magisk/computer/files.txt names $f, which is not there" >&2; echo '<missing>'
|
||||
fi
|
||||
done | LC_ALL=C sort -u)
|
||||
case $COMPUTER in *'<missing>'*) exit 1 ;; esac
|
||||
COMMON="$COMMON $LAUNCHERS computer/.mu300-package $(printf '%s\n' $COMPUTER | sed 's|^|computer/|')"
|
||||
# a .cmd for cmd.exe has CRLF line ends, whatever the checkout did
|
||||
crlf() { tr -d '\r' < "$1" | awk '{ printf "%s\r\n", $0 }' > "$2"; }
|
||||
# (the signature of a signed release)
|
||||
[ ! -s "$R/SHA256SUMS.sig" ] || COMMON="$COMMON mu300/SHA256SUMS.sig"
|
||||
stage() { # stage DIR SYSTEM KERNEL ROOTFS_ASSET KERNEL_ASSET OS UBUNTU
|
||||
@@ -65,6 +87,19 @@ stage() { # stage DIR SYSTEM KERNEL ROOTFS_ASSET KERNEL_ASSET OS UBUNTU
|
||||
cp "$R/$4" "$R/$5" "$S/payload/"
|
||||
printf 'TAG=%s\nSYSTEM=%s\nOS=%s\nUBUNTU=%s\nKERNEL=%s\nKERNEL_ASSET=%s\nROOTFS_ASSET=%s\nSHA256_KERNEL=%s\nSHA256_ROOTFS=%s\n' \
|
||||
"$TAG" "$2" "$6" "$7" "$3" "$5" "$4" "$(sha "$R/$5")" "$(sha "$R/$4")" > "$S/mu300/manifest"
|
||||
# the computer's side (tools/package.sh): the project's installers of this checkout (in CI the tag's), the guide
|
||||
# with this zip's system, kernel and release in it, the launchers, and the mark
|
||||
for f in $COMPUTER; do
|
||||
mkdir -p "$S/computer/$(dirname "$f")"
|
||||
case $f in *.cmd) crlf "$TOP/$f" "$S/computer/$f" ;; *) cp "$TOP/$f" "$S/computer/$f" ;; esac
|
||||
done
|
||||
printf '%s\n' 'This directory is the computer side of a Magisk zip of MU300 Linux: the payload is next to it (START-HERE.md).' \
|
||||
> "$S/computer/.mu300-package"
|
||||
sed -e "s/@TAG@/$TAG/g" -e "s/@SYSTEM@/$2/g" -e "s/@KERNEL@/$3/g" "$C/START-HERE.md" > "$S/START-HERE.md"
|
||||
for f in start.sh start-gui.sh uninstall-linux.sh; do cp "$C/$f" "$S/$f"; done
|
||||
for f in start.cmd start-gui.cmd uninstall-linux.cmd; do crlf "$C/$f" "$S/$f"; done
|
||||
chmod 755 "$S/start.sh" "$S/start-gui.sh" "$S/uninstall-linux.sh" # (only these: the Magisk files keep their modes)
|
||||
find "$S/computer" -name '*.sh' -exec chmod 755 {} +
|
||||
}
|
||||
audit() { # audit ZIP ROOTFS_ASSET KERNEL_ASSET: exactly the names it should hold, the payload stored
|
||||
printf '%s\n' $COMMON "payload/$2" "payload/$3" | LC_ALL=C sort > "$W/want"
|
||||
|
||||
@@ -242,6 +242,7 @@ first with \`./install.sh --check\`.
|
||||
| mu300-extra-panel.tar.gz | the web panel for Ubuntu: Cockpit (Ubuntu's web console: terminal, logs, services, networking, storage) and the MU300 page (signal, mobile data, data usage, SMS, VPN, power and CPU, Wi-Fi, updates), on the LAN only: \`sudo mu300-extra install panel\` on the device (Cockpit from Ubuntu's archive), or the installer's question |
|
||||
| mu300-extra-panel-offline.tar.gz | the same with Cockpit's packages for Ubuntu 24.04 and 26.04, for a device that is not online: \`sudo mu300-extra install panel --from mu300-extra-panel-offline.tar.gz\` |
|
||||
| mu300-update | the on-device updater of this release (\`mu300-update apply\` switches to it before it changes anything) |
|
||||
| mu300-magisk-*.zip | attached a few minutes later by the Magisk installers workflow, one per system and kernel. Two ways to use one: install it in **Magisk** on the device (no computer), or **unpack it on a computer** and run \`start.cmd\` / \`sh start.sh\` (\`start-gui\` for the window): the project's installer, with that system and kernel, offline (\`START-HERE.md\` in the zip; adb from Google's platform-tools is not included) |
|
||||
| (the VPN) | not part of this release: the VPN toolkit (\`mu300-vpn\`, module v2: the core with hev-socks5-tunnel, and the engines as extras: \`vpn-xray\`, \`vpn-singbox\`, \`vpn-mihomo\`, \`vpn-dae\`) is the module of https://github.com/dikeckaan/mu300-linux-vpn - \`mu300-extra install vpn\` on the device, or the installer's question, takes its latest release with the engines its profiles need; on OpenWrt with the panel the VPN menu drives it |
|
||||
|
||||
The images contain **no proprietary files**: the installer pulls the Wi-Fi/Bluetooth firmware and the Android
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
# A release's Magisk zip, unpacked on a computer, is an installer for that computer too (START-HERE.md in the zip,
|
||||
# tools/make-magisk-zips.sh): its computer/ directory is this project's installers, with a file .mu300-package in it,
|
||||
# and the system and the kernel of the zip lie next to it - payload/<the two assets>, mu300/manifest naming them and
|
||||
# mu300/SHA256SUMS, the release's own checksums. In that case install.sh installs exactly that system and that kernel,
|
||||
# from those files, and downloads nothing. Sourced by install.sh (t, die and progress are its own; needs $TOP).
|
||||
# MU300_PACKAGE=DIR (or install.sh --package DIR) the unpacked zip at DIR
|
||||
# computer/.mu300-package the unpacked zip is the directory above this copy
|
||||
# The manifest is read the way the zip's own installer reads it (android/magisk/installer/mu300-install.sh,
|
||||
# manifest_load): only its keys, never sourced, and every value exactly one a release has - the values become file
|
||||
# names. Both payload files must have the checksum the manifest names and the one SHA256SUMS names.
|
||||
|
||||
# package_dir: the directory of the unpacked zip this run installs from, or nothing (a copy of the project)
|
||||
package_dir() {
|
||||
if [ -n "${MU300_PACKAGE:-}" ]; then echo "$MU300_PACKAGE"; return 0; fi
|
||||
[ -f "$TOP/.mu300-package" ] && echo "$TOP/.."
|
||||
return 0
|
||||
}
|
||||
|
||||
# package_load DIR: PKG (the directory, absolute) and PKG_TAG, PKG_SYSTEM, PKG_OS, PKG_UBUNTU, PKG_KERNEL,
|
||||
# PKG_KERNEL_ASSET, PKG_ROOTFS_ASSET, PKG_SHA256_KERNEL, PKG_SHA256_ROOTFS from its mu300/manifest; dies when it is
|
||||
# not the manifest of a release's zip
|
||||
package_load() {
|
||||
PKG=$(cd "$1" 2>/dev/null && pwd) || die "$(t 'no unpacked Magisk zip at {1}' "$1")"
|
||||
[ -f "$PKG/mu300/manifest" ] && [ -f "$PKG/mu300/SHA256SUMS" ] ||
|
||||
die "$(t '{1} is not an unpacked Magisk zip of a release (it has no mu300/manifest and mu300/SHA256SUMS)' "$PKG")"
|
||||
PKG_TAG= PKG_SYSTEM= PKG_OS= PKG_UBUNTU= PKG_KERNEL= PKG_KERNEL_ASSET= PKG_ROOTFS_ASSET= PKG_SHA256_KERNEL= PKG_SHA256_ROOTFS=
|
||||
while IFS='=' read -r _pk _pv || [ -n "$_pk" ]; do
|
||||
_pv=$(printf '%s' "$_pv" | tr -d '\r')
|
||||
case $_pk in
|
||||
TAG) PKG_TAG=$_pv ;; SYSTEM) PKG_SYSTEM=$_pv ;; OS) PKG_OS=$_pv ;; UBUNTU) PKG_UBUNTU=$_pv ;;
|
||||
KERNEL) PKG_KERNEL=$_pv ;; KERNEL_ASSET) PKG_KERNEL_ASSET=$_pv ;; ROOTFS_ASSET) PKG_ROOTFS_ASSET=$_pv ;;
|
||||
SHA256_KERNEL) PKG_SHA256_KERNEL=$_pv ;; SHA256_ROOTFS) PKG_SHA256_ROOTFS=$_pv ;;
|
||||
esac
|
||||
done < "$PKG/mu300/manifest"
|
||||
_pok=1
|
||||
case $PKG_TAG in v[0-9]*) ;; *) _pok= ;; esac
|
||||
case $PKG_TAG in *[!0-9A-Za-z._-]*|*..*) _pok= ;; esac
|
||||
case $PKG_SYSTEM:$PKG_OS:$PKG_UBUNTU:$PKG_ROOTFS_ASSET in
|
||||
openwrt:openwrt::mu300-openwrt-rootfs.tar.gz) ;;
|
||||
openwrt-luci:openwrt-luci::mu300-openwrt-luci-rootfs.tar.gz) ;;
|
||||
ubuntu-24.04:ubuntu:24.04:mu300-ubuntu-rootfs.tar.gz) ;;
|
||||
ubuntu-26.04:ubuntu:26.04:mu300-ubuntu-26.04-rootfs.tar.gz) ;;
|
||||
*) _pok= ;;
|
||||
esac
|
||||
case $PKG_KERNEL:$PKG_KERNEL_ASSET in
|
||||
5.4:mu300-kernel.tar.gz|6.18:mu300-kernel-6.18.tar.gz|7.2:mu300-kernel-7.2.tar.gz) ;;
|
||||
*) _pok= ;;
|
||||
esac
|
||||
# (Ubuntu 26.04's programs need system calls 5.4 does not have: no release has that zip)
|
||||
[ "$PKG_UBUNTU:$PKG_KERNEL" != 26.04:5.4 ] || _pok=
|
||||
for _ph in "$PKG_SHA256_KERNEL" "$PKG_SHA256_ROOTFS"; do
|
||||
case $_ph in *[!0-9a-f]*) _pok= ;; esac
|
||||
[ ${#_ph} = 64 ] || _pok=
|
||||
done
|
||||
[ -n "$_pok" ] || die "$(t 'the package is incomplete or damaged (its manifest is not valid)')"
|
||||
}
|
||||
|
||||
# package_label: the system for people, as the zip's name has it (ubuntu-24.04, openwrt-luci)
|
||||
package_label() { echo "$PKG_SYSTEM"; }
|
||||
|
||||
# package_verify: both payload files against the manifest and against SHA256SUMS, with a verify event each; dies on
|
||||
# the first that is missing or differs
|
||||
package_verify() {
|
||||
for _pf in "$PKG_KERNEL_ASSET:$PKG_SHA256_KERNEL" "$PKG_ROOTFS_ASSET:$PKG_SHA256_ROOTFS"; do
|
||||
_pn=${_pf%%:*}; _pm=${_pf#*:}
|
||||
_ps=$(awk -v f="$_pn" '$2 == f || $2 == "*" f {print $1; exit}' "$PKG/mu300/SHA256SUMS" | tr -d '\r')
|
||||
[ -f "$PKG/payload/$_pn" ] || die "$(t '{1} is missing from the package (payload/)' "$_pn")"
|
||||
echo " $_pn"
|
||||
_pa=$( (shasum -a 256 "$PKG/payload/$_pn" 2>/dev/null || sha256sum "$PKG/payload/$_pn" 2>/dev/null) | cut -d' ' -f1)
|
||||
if [ -z "$_ps" ] || [ "$_pa" != "$_pm" ] || [ "$_pa" != "$_ps" ]; then
|
||||
progress verify file "$_pn" result mismatch
|
||||
die "$(t 'checksum mismatch for {1}' "$_pn")"
|
||||
fi
|
||||
progress verify file "$_pn" result ok
|
||||
done
|
||||
}
|
||||
@@ -325,6 +325,10 @@ How it is built and how to test it: [docs/web-installer.md](https://github.com/d
|
||||
|
||||
## Installing from Android with a Magisk zip (no computer)
|
||||
|
||||
A release's Magisk zip can be used in two ways: installed as it is in Magisk, on the device (this section), or
|
||||
unpacked on a computer, where it is the computer's installer with the zip's system and kernel in it
|
||||
([below](#a-magisk-zip-on-a-computer)).
|
||||
|
||||
If the device runs a rooted Android with **Magisk 26 or newer**, Linux can be installed from the device itself. Each
|
||||
release has one zip per system and kernel, 11 in all, e.g. `mu300-magisk-<tag>-ubuntu-24.04-k5.4.zip` or
|
||||
`mu300-magisk-<tag>-openwrt-luci-k7.2.zip` (OpenWrt with the control panel); the same zip works on the F50 and the
|
||||
@@ -342,6 +346,25 @@ Magisk cannot ask questions, so choices go in a settings file, `mu300-install.co
|
||||
offered from a zip. The keys, where the file may live and the rules for erasing are in the
|
||||
[README](https://github.com/dikeckaan/mu300-linux#choosing-something-else-mu300-installconf).
|
||||
|
||||
## A Magisk zip on a computer
|
||||
|
||||
The same zip is also an installer for a computer, with no download: unpack the **whole** zip into a folder and start
|
||||
`start.cmd` (Windows) or `sh start.sh` (macOS, Linux) - `start-gui.cmd` / `sh start-gui.sh` open the graphical
|
||||
installer's window straight away. It is the project's `install.sh` / `install.ps1` (in the zip's `computer/`
|
||||
folder), and it installs exactly the system and the kernel of that zip from the zip's own `payload/`, after checking
|
||||
both files against the zip's `mu300/manifest` and the release's `mu300/SHA256SUMS`; it asks no question about the
|
||||
system, the kernel or the release, and does not update itself. Everything else is as in [Step 2](#step-2-install):
|
||||
the device's own files are read, the summary is shown, and nothing is written before `INSTALL`. `START-HERE.md` in the
|
||||
zip says it in English, Turkish and Chinese, and `uninstall-linux.cmd` / `sh uninstall-linux.sh` start the
|
||||
uninstaller.
|
||||
|
||||
The zip does not contain adb: Google's platform-tools may not be passed on (section 3.4 of the Android SDK licence).
|
||||
Download them from https://developer.android.com/tools/releases/platform-tools and unpack them into the zip's folder
|
||||
(`platform-tools/adb` next to `START-HERE.md`), or have adb on the PATH. The computer also needs Python 3.8+ and lz4
|
||||
(Windows: the installer installs both when missing, which needs the internet once). The VPN module, when you ask for
|
||||
it, is still a download; the web panel for Ubuntu is not in a zip (add it later with `sudo mu300-extra install
|
||||
panel`).
|
||||
|
||||
## Downloads are slow?
|
||||
|
||||
GitHub's release CDN throttles single connections in some regions. The installer already downloads in 8 parallel
|
||||
|
||||
Reference in new issue
Block a user