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

This commit is contained in:
shenmo 2025-06-11 15:10:09 +08:00
parent fb6446292c
commit 05a5b89464
4 changed files with 37 additions and 34 deletions

View File

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

View File

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

View File

@ -1,13 +1,14 @@
#!/bin/bash #!/bin/bash
dpkg -s "$1" > /dev/null
RET="$?"
if [[ "$RET" != "0" ]] &&[[ "$IS_ACE_ENV" == "" ]];then ## 如果未在ACE环境中
readonly ACE_ENVIRONMENTS=( readonly ACE_ENVIRONMENTS=(
"bookworm-run:amber-ce-bookworm" "bookworm-run:amber-ce-bookworm"
"trixie-run:amber-ce-trixie" "trixie-run:amber-ce-trixie"
"deepin23-run:amber-ce-deepin23" "deepin23-run:amber-ce-deepin23"
"sid-run:amber-ce-sid" "sid-run:amber-ce-sid"
) )
dpkg -s "$1" > /dev/null
RET="$?"
if [[ "$RET" != "0" ]] &&[[ "$IS_ACE_ENV" == "" ]];then ## 如果未在ACE环境中
for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do

View File

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