mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-14 04:42:03 +08:00
3.2.1 更新源服务器改为aptss
This commit is contained in:
@@ -30,7 +30,7 @@ int main(int argc, char *argv[])
|
||||
DAboutDialog dialog;
|
||||
a.setAboutDialog(&dialog);
|
||||
dialog.setLicense(QObject::tr("We publish this program under GPL V3"));
|
||||
dialog.setVersion(DApplication::buildVersion("Version 3.2"));
|
||||
dialog.setVersion(DApplication::buildVersion("Version 3.2.1"));
|
||||
dialog.setProductIcon(QIcon::fromTheme("spark-store")); // 设置Logo
|
||||
dialog.setProductName(QLabel::tr("Spark Store"));
|
||||
dialog.setDescription(
|
||||
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
|
||||
a.setOrganizationName("spark-union");
|
||||
a.setOrganizationDomain("https://www.deepinos.org/");
|
||||
a.setApplicationName("Spark Store"); //不需要翻译,否则 ~/.local/share/ 下文件夹名称也被翻译为中文
|
||||
a.setApplicationVersion(DApplication::buildVersion("3.2"));
|
||||
a.setApplicationVersion(DApplication::buildVersion("3.2.1"));
|
||||
a.setApplicationAcknowledgementPage("https://gitee.com/deepin-community-store/spark-store");
|
||||
a.setApplicationDescription(
|
||||
QObject::tr(
|
||||
|
||||
@@ -1090,46 +1090,8 @@ void Widget::on_pushButton_updateApt_clicked()
|
||||
ui->pushButton_updateApt->setEnabled(false);
|
||||
ui->label_aptserver->setText(tr("Updating, please wait..."));
|
||||
|
||||
std::fstream sourcesList, policy, update;
|
||||
QDir tmpdir("/tmp");
|
||||
auto tmpPath = QString::fromUtf8(TMP_PATH).toStdString();
|
||||
bool unknownError = true;
|
||||
|
||||
tmpdir.mkpath("spark-store");
|
||||
sourcesList.open(tmpPath + "/sparkstore.list", std::ios::out);
|
||||
// 商店已经下架会替换系统库的包,优先级 policy 弃用
|
||||
// policy.open(tmpPath + "/sparkstore", std::ios::out);
|
||||
|
||||
if(sourcesList /*&& policy*/)
|
||||
{
|
||||
auto serverAddr = ui->comboBox_server->currentText();
|
||||
|
||||
sourcesList << "deb [by-hash=force] ";
|
||||
sourcesList << serverAddr.toUtf8().toStdString();
|
||||
sourcesList << " /";
|
||||
sourcesList.close();
|
||||
|
||||
/*
|
||||
* policy << "Package: *\n" << "Pin: origin *" <<
|
||||
* serverAddr.mid(serverAddr.indexOf('.')).toUtf8().toStdString() << "\n" <<
|
||||
* "Pin-Priority: 90"; // 降低星火源的优先级,防止从星火安装已存在的系统包,破坏依赖
|
||||
* policy.close();
|
||||
*/
|
||||
|
||||
update.open(tmpPath + "/update.sh", std::ios::out);
|
||||
if(update)
|
||||
{
|
||||
unknownError = false;
|
||||
update << "#!/bin/sh\n" <<
|
||||
"mv " + tmpPath + "/sparkstore.list /etc/apt/sources.list.d/sparkstore.list && " <<
|
||||
// "mv " + tmpPath + "/sparkstore /etc/apt/preferences.d/sparkstore && " <<
|
||||
"apt update";
|
||||
update.close();
|
||||
|
||||
system(("chmod +x " + tmpPath + "/update.sh").c_str());
|
||||
|
||||
QProcess runupdate;
|
||||
runupdate.start("pkexec", QStringList() << QString::fromStdString(tmpPath + "/update.sh"));
|
||||
runupdate.start("pkexec" , QStringList() << "aptss" << "ssupdate");
|
||||
runupdate.waitForFinished();
|
||||
QString error = runupdate.readAllStandardError();
|
||||
|
||||
@@ -1145,22 +1107,21 @@ void Widget::on_pushButton_updateApt_clicked()
|
||||
|
||||
if(!haveError)
|
||||
{
|
||||
ui->label_aptserver->setText("deb [by-hash=force] " + ui->comboBox_server->currentText().toUtf8() + " /");
|
||||
ui->label_aptserver->setText(tr("Update finished"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->label_aptserver->setText(tr("Apt has reported an error. Please use apt update in terminal to locate the problem."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(unknownError)
|
||||
{
|
||||
ui->label_aptserver->setText(tr("Unknown error!"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ui->pushButton_updateApt->setEnabled(true);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void Widget::on_pushButton_uninstall_clicked()
|
||||
|
||||
Reference in New Issue
Block a user