From 111029fde3307cfd0582c76834bc33705505b4b1 Mon Sep 17 00:00:00 2001 From: Nitload <105042599+Nitload-NSI@users.noreply.github.com> Date: Tue, 6 Oct 2026 10:01:39 +0800 Subject: [PATCH] Package the Termux client for Termux runtime --- docs/platforms/android-client.md | 4 ++-- packaging/package.ps1 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/platforms/android-client.md b/docs/platforms/android-client.md index c2f8322..c417365 100644 --- a/docs/platforms/android-client.md +++ b/docs/platforms/android-client.md @@ -4,9 +4,9 @@ Android 首期支持 ARM64 设备上的 Termux 终端,CLI 使用 `linux-bionic-arm64` RID。另有独立的 .NET Android 启动器项目 `src/android/CharacAndroid.csproj`,包 ID 为 `com.nitload.charac`;Server 仍只部署在 Windows 或 Linux。 -执行 `./build.ps1 --target Publish --runtime linux-bionic-arm64 --locked-restore`,或在 Linux 上使用 `bash ./build.sh`。随后运行 `./packaging/package.ps1 -Target ClientTermuxDeb`,生成 `artifacts/packages/charac_0.1.0-1_aarch64.deb`。该包面向标准包名 `com.termux` 的 apt 版 aarch64 Termux,将 Client 安装到 `$PREFIX/opt/charac`,将 `charac` 入口装到 `$PREFIX/bin`,并依赖 Termux 的 `dotnet-runtime-10.0`。在 Termux 中复制 DEB 后运行 `apt install ./charac_0.1.0-1_aarch64.deb`;当前尚未发布到 Termux 仓库,因此 `pkg install charac` 还不能从公共仓库下载它。APK 的环境检查会识别包提供的固定入口。 +执行 `./build.ps1 --target Publish --runtime linux-bionic-arm64 --locked-restore`,或在 Linux 上使用 `bash ./build.sh`。随后运行 `./packaging/package.ps1 -Target ClientTermuxDeb`,生成 `artifacts/packages/<版本>/charac-termux_<版本>-2_aarch64.deb`。该包面向标准包名 `com.termux` 的 apt 版 aarch64 Termux,将 framework-dependent Client 安装到 `$PREFIX/opt/charac`,将 `charac` 入口装到 `$PREFIX/bin`,依赖 Termux 提供的 `dotnet-runtime-10.0`。它不承诺裸 Debian/Ubuntu 环境兼容。在 Termux 中复制 DEB 后运行 `apt install ./charac-termux_<版本>-2_aarch64.deb`;当前尚未发布到 Termux 仓库,因此 `pkg install charac-termux` 还不能从公共仓库下载它。APK 的环境检查会识别包提供的固定入口。 -如果暂时不使用 DEB,也可以复制 `artifacts/publish/linux-bionic-arm64/client/` 到 Termux 私有目录,例如 `$HOME/.local/opt/charac`。这是 framework-dependent 发布,需要自行安装 .NET 10 或更高兼容运行时。为 APK 提供固定入口 `$PREFIX/bin/charac`,其内容用 Termux 的 `sh` 调用 `dotnet $HOME/.local/opt/charac/charac.dll` 并原样传递参数;入口必须可执行。若应用宿主无法定位运行时,可在 Termux 中运行 `dotnet $HOME/.local/opt/charac/charac.dll --help` 检查。 +如果暂时不使用 DEB,也可以复制 `artifacts/publish/linux-bionic-arm64/client/` 到 Termux 私有目录,例如 `$HOME/.local/opt/charac`;该目录是 framework-dependent 发布,需要先安装 Termux 的 `dotnet-runtime-10.0`。为 APK 提供固定入口 `$PREFIX/bin/charac`,其内容用 Termux 的 `sh` 调用 `dotnet $HOME/.local/opt/charac/charac.dll` 并原样传递参数;入口必须可执行。 手动复制方案在 Termux 中完成后,创建入口: diff --git a/packaging/package.ps1 b/packaging/package.ps1 index 9f9f031..5bd4d2d 100644 --- a/packaging/package.ps1 +++ b/packaging/package.ps1 @@ -63,7 +63,7 @@ if ($Target -eq 'ClientTermuxDeb') { if (-not (Test-Path -LiteralPath $NfpmPath -PathType Leaf)) { throw 'nFPM 2.47.0 is required; pass -NfpmPath.' } $prefix = '/data/data/com.termux/files/usr' $lines = [System.Collections.Generic.List[string]]::new() - $lines.Add('name: charac') + $lines.Add('name: charac-termux') $lines.Add("version: $version") $lines.Add('release: 2') $lines.Add('arch: aarch64') @@ -86,7 +86,7 @@ if ($Target -eq 'ClientTermuxDeb') { Add-PackageFile $lines (Join-Path $repository 'src/client/Assets/Fonts/IBM-Plex-LICENSE.txt') "$prefix/share/doc/charac/IBM-Plex-LICENSE.txt" $config = Join-Path $scratch 'charac-termux.yaml' [IO.File]::WriteAllLines($config, [string[]]$lines) - $output = Join-Path $packages "charac_${version}-2_aarch64.deb" + $output = Join-Path $packages "charac-termux_${version}-2_aarch64.deb" & $NfpmPath package --config $config --packager deb --target $output if ($LASTEXITCODE -ne 0) { throw "nFPM failed with exit code $LASTEXITCODE." } Write-Output $output