不再使用dpkg-query检测是否安装

This commit is contained in:
2026-03-10 18:36:35 +08:00
parent 3231a3ced7
commit a98b3ec5b1

View File

@@ -445,20 +445,20 @@ ipcMain.handle("check-installed", async (_event, pkgname: string) => {
if (isInstalled) return true; if (isInstalled) return true;
} }
// 如果脚本不存在或检测不到,使用 dpkg-query 作为后备 // // 如果脚本不存在或检测不到,使用 dpkg-query 作为后备
logger.info(`尝试使用 dpkg-query 检测: ${pkgname}`); // logger.info(`尝试使用 dpkg-query 检测: ${pkgname}`);
const { code } = await runCommandCapture("dpkg-query", [ // const { code } = await runCommandCapture("dpkg-query", [
"-W", // "-W",
"-f='${Status}'", // "-f='${Status}'",
pkgname, // pkgname,
]); // ]);
if (code === 0) { // if (code === 0) {
isInstalled = true; // isInstalled = true;
logger.info(`应用已安装 (dpkg-query 检测): ${pkgname}`); // logger.info(`应用已安装 (dpkg-query 检测): ${pkgname}`);
} else { // } else {
logger.info(`应用未安装: ${pkgname}`); // logger.info(`应用未安装: ${pkgname}`);
} // }
return isInstalled; return isInstalled;
}); });