fix(deploy): apt 安装 Assimp 不再写死 libassimp6

Debian 11 / Ubuntu 22.04 的库包是 libassimp5,Debian 12+ 才是 libassimp6;
写死库名会让 apt 报 'no installation candidate',自动安装直接失败。
改为只装 assimp-utils(它按发行版依赖对应的库版本)。
This commit is contained in:
opendance
2026-09-16 02:56:50 +08:00
parent da03777995
commit afed67e175
5 changed files with 9 additions and 7 deletions
+1 -1
View File
@@ -272,7 +272,7 @@ bash /opt/opendance/deploy/ctl.sh status | restart | logs
| 健康检查返回 503 | 服务起来了但连不上数据库:核对 `deploy/.env` 的 `DB_HOST/DB_PORT/DB_USER/DB_PASS/DB_NAME`,以及数据库账号是否允许从本机 IP 连接(`GRANT ... TO 'user'@'%'` 或具体主机) | | 健康检查返回 503 | 服务起来了但连不上数据库:核对 `deploy/.env` 的 `DB_HOST/DB_PORT/DB_USER/DB_PASS/DB_NAME`,以及数据库账号是否允许从本机 IP 连接(`GRANT ... TO 'user'@'%'` 或具体主机) |
| 服务本机 curl 通、外部访问不了 | `bash deploy/check-access.sh` 一次定位:打印 `HOST`/`PORT`、实际监听地址、对外 IP 自测、80/443 有无反代、防火墙放行情况,并给出修复命令 | | 服务本机 curl 通、外部访问不了 | `bash deploy/check-access.sh` 一次定位:打印 `HOST`/`PORT`、实际监听地址、对外 IP 自测、80/443 有无反代、防火墙放行情况,并给出修复命令 |
| 管理页面打开是 404 | 说明访问的是软件 API 端口(默认 3000);管理页面在管理端端口(默认 3001) | | 管理页面打开是 404 | 说明访问的是软件 API 端口(默认 3000);管理页面在管理端端口(默认 3001) |
| 上传 `.zip` / `.pmx` / `.fbx` 报转换失败(ENOENT / Assimp 不可用) | PMX/FBX 转换依赖外部 Assimp:`apt-get install -y assimp-utils libassimp6`(RHEL 系 `dnf install -y assimp`,`install.sh` 现在会尝试自动安装)。装好后**不需要重启服务**;若不在服务 PATH 中,在 `deploy/.env` 设 `ASSIMP_BIN` 为绝对路径。只上传 `.glb` / `.vrm` 则不需要它 | | 上传 `.zip` / `.pmx` / `.fbx` 报转换失败(ENOENT / Assimp 不可用) | PMX/FBX 转换依赖外部 Assimp:`apt-get install -y assimp-utils`(RHEL 系 `dnf install -y assimp`,`install.sh` 现在会尝试自动安装)。装好后**不需要重启服务**;若不在服务 PATH 中,在 `deploy/.env` 设 `ASSIMP_BIN` 为绝对路径。只上传 `.glb` / `.vrm` 则不需要它 |
| 安装时报 `command not found` / 退出码 127,且提示指向 `deploy/.env` 某一行 | 该行的值含空格或 shell 元字符却没加引号,被 shell 当成命令执行了。按预检提示给这个值加引号(如 `MODEL_CONVERT_PMX="Hatsune Miku.pmx"`)后重跑;`deploy/env-lib.sh` 会提前拦住并给出行号 | | 安装时报 `command not found` / 退出码 127,且提示指向 `deploy/.env` 某一行 | 该行的值含空格或 shell 元字符却没加引号,被 shell 当成命令执行了。按预检提示给这个值加引号(如 `MODEL_CONVERT_PMX="Hatsune Miku.pmx"`)后重跑;`deploy/env-lib.sh` 会提前拦住并给出行号 |
| 模型审核界面显示"未分析 / 无预览图" | 该模型是升级前入库的:调 `POST /api/models/<id>/reanalyze`,或批量跑 `node scripts/reanalyze-models.mjs --url http://127.0.0.1:3000` | | 模型审核界面显示"未分析 / 无预览图" | 该模型是升级前入库的:调 `POST /api/models/<id>/reanalyze`,或批量跑 `node scripts/reanalyze-models.mjs --url http://127.0.0.1:3000` |
+1 -1
View File
@@ -235,7 +235,7 @@ deploy/.env 初始化引导(deploy/init-env.sh)
- 管理页面打开是 404 - 管理页面打开是 404
说明访问的是软件 API 端口(默认 3000); 管理页面在管理端端口(默认 3001)。 说明访问的是软件 API 端口(默认 3000); 管理页面在管理端端口(默认 3001)。
- 上传 .zip / .pmx / .fbx 报转换失败(ENOENT / Assimp 不可用) - 上传 .zip / .pmx / .fbx 报转换失败(ENOENT / Assimp 不可用)
PMX/FBX 转换依赖外部 Assimp: apt-get install -y assimp-utils libassimp6 PMX/FBX 转换依赖外部 Assimp: apt-get install -y assimp-utils
(RHEL 系 dnf install -y assimp; install.sh 现在会尝试自动安装)。 (RHEL 系 dnf install -y assimp; install.sh 现在会尝试自动安装)。
装好后不需要重启服务; 若不在服务 PATH 中, 在 deploy/.env 里把 ASSIMP_BIN 装好后不需要重启服务; 若不在服务 PATH 中, 在 deploy/.env 里把 ASSIMP_BIN
设为绝对路径。只上传 .glb / .vrm 则不需要它。 设为绝对路径。只上传 .glb / .vrm 则不需要它。
+4 -2
View File
@@ -13,9 +13,11 @@
# ============================================================ # ============================================================
# 当前发行版对应的安装命令(用于提示) # 当前发行版对应的安装命令(用于提示)
# 注意:只装 assimp-utils(它会按发行版自动带上对应版本的 libassimp5/6),
# 不写死库名 —— Debian 11 / Ubuntu 22.04 是 libassimp5,Debian 12+ 才是 libassimp6。
opendance_assimp_install_cmd() { opendance_assimp_install_cmd() {
if command -v apt-get >/dev/null 2>&1; then if command -v apt-get >/dev/null 2>&1; then
printf 'apt-get update && apt-get install -y assimp-utils libassimp6' printf 'apt-get update && apt-get install -y assimp-utils'
elif command -v dnf >/dev/null 2>&1; then elif command -v dnf >/dev/null 2>&1; then
printf 'dnf install -y assimp' printf 'dnf install -y assimp'
elif command -v yum >/dev/null 2>&1; then elif command -v yum >/dev/null 2>&1; then
@@ -35,7 +37,7 @@ opendance_assimp_install_cmd() {
opendance_assimp_install() { opendance_assimp_install() {
if command -v apt-get >/dev/null 2>&1; then if command -v apt-get >/dev/null 2>&1; then
DEBIAN_FRONTEND=noninteractive apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get update -qq &&
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq assimp-utils libassimp6 DEBIAN_FRONTEND=noninteractive apt-get install -y -qq assimp-utils
elif command -v dnf >/dev/null 2>&1; then dnf install -y -q assimp elif command -v dnf >/dev/null 2>&1; then dnf install -y -q assimp
elif command -v yum >/dev/null 2>&1; then yum install -y -q assimp elif command -v yum >/dev/null 2>&1; then yum install -y -q assimp
elif command -v zypper >/dev/null 2>&1; then zypper --non-interactive install assimp elif command -v zypper >/dev/null 2>&1; then zypper --non-interactive install assimp
+1 -1
View File
@@ -65,7 +65,7 @@ export function resolveAssimpBinary(bin: string): AssimpLocation {
/** 各发行版的安装命令(部署脚本与错误信息共用同一份文案) */ /** 各发行版的安装命令(部署脚本与错误信息共用同一份文案) */
export const ASSIMP_INSTALL_COMMANDS: ReadonlyArray<{ distro: string; command: string }> = [ export const ASSIMP_INSTALL_COMMANDS: ReadonlyArray<{ distro: string; command: string }> = [
{ distro: 'Debian / Ubuntu', command: 'apt-get update && apt-get install -y assimp-utils libassimp6' }, { distro: 'Debian / Ubuntu', command: 'apt-get update && apt-get install -y assimp-utils' },
{ distro: 'RHEL / CentOS / Rocky / Fedora', command: 'dnf install -y assimp' }, { distro: 'RHEL / CentOS / Rocky / Fedora', command: 'dnf install -y assimp' },
{ distro: 'Alpine', command: 'apk add --no-cache assimp' }, { distro: 'Alpine', command: 'apk add --no-cache assimp' },
{ distro: 'Arch', command: 'pacman -S --noconfirm assimp' }, { distro: 'Arch', command: 'pacman -S --noconfirm assimp' },
+2 -2
View File
@@ -178,7 +178,7 @@ describe('deploy/assimp-lib.sh:部署脚本共用的安装逻辑', () => {
writeFileSync(join(aptDir, 'apt-get'), '#!/bin/bash\nexit 0\n'); writeFileSync(join(aptDir, 'apt-get'), '#!/bin/bash\nexit 0\n');
chmodSync(join(aptDir, 'apt-get'), 0o755); chmodSync(join(aptDir, 'apt-get'), 0o755);
const result = runLib('opendance_assimp_install_cmd', `${aptDir}:/usr/bin:/bin`); const result = runLib('opendance_assimp_install_cmd', `${aptDir}:/usr/bin:/bin`);
expect(result.stdout).toContain('apt-get install -y assimp-utils libassimp6'); expect(result.stdout).toContain('apt-get install -y assimp-utils');
}); });
it('opendance_assimp_install 调用包管理器安装 assimp-utils(离线失败也不抛)', () => { it('opendance_assimp_install 调用包管理器安装 assimp-utils(离线失败也不抛)', () => {
@@ -190,7 +190,7 @@ describe('deploy/assimp-lib.sh:部署脚本共用的安装逻辑', () => {
const result = runLib('opendance_assimp_install', `${aptDir}:/usr/bin:/bin`); const result = runLib('opendance_assimp_install', `${aptDir}:/usr/bin:/bin`);
expect(result.status).toBe(0); expect(result.status).toBe(0);
const calls = existsSync(log) ? readFileSync(log, 'utf8') : ''; const calls = existsSync(log) ? readFileSync(log, 'utf8') : '';
expect(calls).toContain('apt-get install -y -qq assimp-utils libassimp6'); expect(calls).toContain('apt-get install -y -qq assimp-utils');
}); });
it('非常规目录需要写 ASSIMP_BIN,标准目录不需要', () => { it('非常规目录需要写 ASSIMP_BIN,标准目录不需要', () => {