fix(update-center): 将apm命令从ssaudit改为ssinstall并优化打印URI命令

更新apm安装命令,使用ssinstall替代ssaudit以正确执行安装操作。同时优化获取包URI的命令,使用更可靠的bash调用方式。
This commit is contained in:
2026-04-10 15:34:33 +08:00
parent 0b17ada45a
commit 4a2cbe1f2a
4 changed files with 22 additions and 11 deletions

View File

@@ -48,6 +48,14 @@ const DPKG_QUERY_INSTALLED_COMMAND = {
], ],
}; };
const getApmPrintUrisCommand = (pkgname: string) => ({
command: "bash",
args: [
"-lc",
`amber-pm-debug /usr/bin/apt -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf download ${pkgname} --print-uris`,
],
});
const runCommandCapture: UpdateCenterCommandRunner = async ( const runCommandCapture: UpdateCenterCommandRunner = async (
command, command,
args, args,
@@ -93,11 +101,11 @@ const loadApmItemMetadata = async (
| { item: UpdateCenterItem; warning?: undefined } | { item: UpdateCenterItem; warning?: undefined }
| { item: null; warning: string } | { item: null; warning: string }
> => { > => {
const metadataResult = await runCommand("apm", [ const printUrisCommand = getApmPrintUrisCommand(item.pkgname);
"info", const metadataResult = await runCommand(
item.pkgname, printUrisCommand.command,
"--print-uris", printUrisCommand.args,
]); );
const commandError = getCommandError( const commandError = getCommandError(
`apm metadata query for ${item.pkgname}`, `apm metadata query for ${item.pkgname}`,
metadataResult, metadataResult,

View File

@@ -155,14 +155,14 @@ export const installUpdateItem = async ({
} }
if (item.source === "apm" && filePath) { if (item.source === "apm" && filePath) {
const auditCommand = buildPrivilegedCommand( const installCommand = buildPrivilegedCommand(
SHELL_CALLER_PATH, SHELL_CALLER_PATH,
["apm", "ssaudit", filePath], ["apm", "ssinstall", filePath],
superUserCmd, superUserCmd,
); );
await runCommand( await runCommand(
auditCommand.execCommand, installCommand.execCommand,
auditCommand.execParams, installCommand.execParams,
onLog, onLog,
signal, signal,
); );

View File

@@ -14,6 +14,9 @@ const APTSS_LIST_UPGRADABLE_KEY =
const DPKG_QUERY_INSTALLED_KEY = const DPKG_QUERY_INSTALLED_KEY =
"dpkg-query -W -f=${Package}\t${db:Status-Want} ${db:Status-Status} ${db:Status-Eflag}\n"; "dpkg-query -W -f=${Package}\t${db:Status-Want} ${db:Status-Status} ${db:Status-Eflag}\n";
const APM_PRINT_URIS_KEY =
"bash -lc amber-pm-debug /usr/bin/apt -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf download spark-weather --print-uris";
describe("update-center load items", () => { describe("update-center load items", () => {
it("enriches apm and migration items with download metadata needed by the runner", async () => { it("enriches apm and migration items with download metadata needed by the runner", async () => {
const commandResults = new Map<string, CommandResult>([ const commandResults = new Map<string, CommandResult>([
@@ -50,7 +53,7 @@ describe("update-center load items", () => {
}, },
], ],
[ [
"apm info spark-weather --print-uris", APM_PRINT_URIS_KEY,
{ {
code: 0, code: 0,
stdout: stdout:

View File

@@ -294,7 +294,7 @@ describe("update-center task runner", () => {
args: [ args: [
"/opt/spark-store/extras/shell-caller.sh", "/opt/spark-store/extras/shell-caller.sh",
"apm", "apm",
"ssaudit", "ssinstall",
"/tmp/spark-player.deb", "/tmp/spark-player.deb",
], ],
}, },