syncx: 现在安装到ACE的软件包不会再报错了

This commit is contained in:
shenmo 2025-06-11 15:29:43 +08:00
parent 118a6403bf
commit 29c1bc4194
4 changed files with 42 additions and 37 deletions

@ -150,24 +150,25 @@ void AppIntoPage::openUrl(const QUrl &url)
{
isInstalled = true;
QProcess isUpdate;
isUpdate.start("dpkg-query", QStringList() << "--showformat='${Version}'"
<< "--show" << info["Pkgname"].toString());
isUpdate.waitForFinished(180 * 1000); // 默认超时 3 分钟
QString localVersion = isUpdate.readAllStandardOutput();
localVersion.replace("'", "");
// QProcess isUpdate;
// isUpdate.start("dpkg-query", QStringList() << "--showformat='${Version}'"
// << "--show" << info["Pkgname"].toString());
// isUpdate.waitForFinished(180 * 1000); // 默认超时 3 分钟
// QString localVersion = isUpdate.readAllStandardOutput();
// localVersion.replace("'", "");
isUpdate.start("dpkg", QStringList() << "--compare-versions" << localVersion << "ge" << info["Version"].toString());
isUpdate.waitForFinished(180 * 1000); // 默认超时 3 分钟
if (isUpdate.exitCode() == 0 && isUpdate.exitStatus() == QProcess::NormalExit)
{
isUpdated = true;
}
else
{
isUpdated = false;
}
isUpdate.close();
// isUpdate.start("dpkg", QStringList() << "--compare-versions" << localVersion << "ge" << info["Version"].toString());
// isUpdate.waitForFinished(180 * 1000); // 默认超时 3 分钟
// if (isUpdate.exitCode() == 0 && isUpdate.exitStatus() == QProcess::NormalExit)
// {
// isUpdated = true;
// }
// else
// {
// isUpdated = false;
// }
// isUpdate.close();
isUpdated = true; //去掉直接点击升级的功能
}
else
{
@ -585,11 +586,11 @@ void AppIntoPage::on_pushButton_3_clicked()
uninstall.waitForFinished(-1);
uninstall.close();
QProcess check;
check.start("dpkg", QStringList() << "-s" << info["Pkgname"].toString().toLower());
check.waitForFinished(-1);
// QProcess check;
// check.start("dpkg", QStringList() << "-s" << info["Pkgname"].toString().toLower());
// check.waitForFinished(-1);
if (check.exitCode() != 0 || check.exitStatus() != QProcess::NormalExit)
if (uninstall.exitCode() != 0 || uninstall.exitStatus() != QProcess::NormalExit)
{
ui->downloadButton->setText(tr("Download and Install"));
ui->pushButton_3->hide();
@ -600,7 +601,7 @@ void AppIntoPage::on_pushButton_3_clicked()
ui->downloadButton->setEnabled(true);
ui->pushButton_3->setEnabled(true);
check.close();
// check.close();
});
}

@ -217,10 +217,10 @@ void DownloadItem::slotAsyncInstall(int t)
}
QProcess isInstall;
isInstall.start("dpkg", QStringList() << "-s" << pkgName);
isInstall.waitForFinished(180 * 1000); // 默认超时 3 分钟
int error = QString::fromStdString(isInstall.readAllStandardError().toStdString()).length();
if (error == 0 && !haveError)
// isInstall.start("dpkg", QStringList() << "-s" << pkgName);
// isInstall.waitForFinished(180 * 1000); // 默认超时 3 分钟
// int error = QString::fromStdString(isInstall.readAllStandardError().toStdString()).length();
if ( !haveError)
{
ui->pushButton_install->hide();
Utils::sendNotification("spark-store", tr("Spark Store"), ui->label->text() + " " + tr("Installation complete."));
@ -252,5 +252,5 @@ void DownloadItem::slotAsyncInstall(int t)
ui->widget_spinner->hide();
DownloadItem::isInstall = false;
emit finished(error == 0 && !haveError && !notRoot);
emit finished(!haveError && !notRoot);
}

@ -1,14 +1,17 @@
#!/bin/bash
readonly ACE_ENVIRONMENTS=(
"bookworm-run:amber-ce-bookworm"
"trixie-run:amber-ce-trixie"
"deepin23-run:amber-ce-deepin23"
"sid-run:amber-ce-sid"
)
dpkg -s "$1" > /dev/null
RET="$?"
if [[ "$RET" != "0" ]] &&[[ "$IS_ACE_ENV" == "" ]];then ## 如果未在ACE环境中
# 定义按顺序尝试的ACE环境命令:推荐安装包)
declare -a ace_commands_order=(
"bookworm-run:amber-ce-bookworm"
"trixie-run:amber-ce-trixie"
"deepin23-run:amber-ce-deepin23"
)
for ace_entry in "${ace_commands_order[@]}"; do
if [[ "$RET" != "0" ]] &&[[ "$IS_ACE_ENV" == "" ]];then ## 如果未在ACE环境中
for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do
ace_cmd=${ace_entry%%:*}
if command -v "$ace_cmd" >/dev/null 2>&1; then
echo "----------------------------------------"

@ -1,10 +1,11 @@
#!/bin/bash
# ===== ACE环境配置 =====
declare -a ace_commands_order=(
readonly ACE_ENVIRONMENTS=(
"bookworm-run:amber-ce-bookworm"
"trixie-run:amber-ce-trixie"
"deepin23-run:amber-ce-deepin23"
"sid-run:amber-ce-sid"
)
# ===== 日志和函数 =====
@ -72,7 +73,7 @@ function launch_app() {
# ===== ACE环境执行器 =====
function ace_runner() {
local command_type=$1 package_name=$2
for ace_entry in "${ace_commands_order[@]}"; do
for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do
local ace_cmd=${ace_entry%%:*}
command -v "$ace_cmd" >/dev/null || continue