diff --git a/.gitignore b/.gitignore index 21d239c..b65abfd 100644 --- a/.gitignore +++ b/.gitignore @@ -53,4 +53,4 @@ debian/*.substvars debian/spark-store .vscode/* -src/spark-store +obj-* diff --git a/README.zh.md b/README.zh.md index 0b4a84c..0875ae8 100644 --- a/README.zh.md +++ b/README.zh.md @@ -1,6 +1,6 @@ # 星火应用商店 [![star](https://gitee.com/spark-store-project/spark-store/badge/star.svg?theme=gvp)](https://gitee.com/spark-store-project/spark-store/stargazers) [![fork](https://gitee.com/spark-store-project/spark-store/badge/fork.svg?theme=gvp)](https://gitee.com/spark-store-project/spark-store/members) - +![star](https://gitcode.com/spark-store-project/spark-store/star/badge.svg) ## 简介 diff --git a/debian/changelog b/debian/changelog index ca3a18d..84b1509 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -spark-store (4.7.0) UNRELEASED; urgency=medium +spark-store (4.8.0) UNRELEASED; urgency=medium - * aptss 第二、三阶段加速 - * 修复部分应用无法启动的问题 - * 支持使用 ACE deepin23 trixie + * ssinstall重写,支持安装到ACE和自动安装到ACE,支持只允许安装到本地 + * 商店支持展示ACE标识,支持识别 native amber-ce-bookworm amber-ce-trixie amber-ce-sid amber-ce-deepin23 + * 投稿器支持新版spec -- shenmo Tue, 24 Sep 2024 11:27:08 +0800 diff --git a/pkg/usr/share/ssinstall-local/transhell/ssinstall-local_en_US.transhell b/pkg/usr/share/ssinstall-local/transhell/ssinstall-local_en_US.transhell new file mode 100644 index 0000000..7d3fbf1 --- /dev/null +++ b/pkg/usr/share/ssinstall-local/transhell/ssinstall-local_en_US.transhell @@ -0,0 +1,6 @@ +#!/bin/bash +TRANSHELL_CONTENT_HASH_CHECK_FAILED="Failed in checking package hash! \nPossibly reason can be the package is broken, laggy in sync of Spark Store repository, or, there is a malware attempt to attack. \nIf you don't know what happend, please try install again after execute the command below\n sudo aptss update\n\nIf the problem still happen, please click APP Feedback button in the APP information page to feedback to us.\n\n If you are in the Audition Group,Please use ssaudit instead of ssinstall to audit APPs,for ssinstall is used for password-free install now.\nIf you want to install an app that is removed from Spark Store repository,you can also use ssaudit." +TRANSHELL_CONTENT_PLEASE_RUN_AS_ROOT="Please run ssinstall as root" +TRANSHELL_CONTENT_FILE_NOT_EXIST="File not exist" +TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB="No delete after install option given, will not delete the deb" +TRANSHELL_CONTENT_DEB_IS_DELETED="--delete-after-install option is given and the installation is succeeded, delete the deb file." diff --git a/pkg/usr/share/ssinstall-local/transhell/ssinstall-local_zh_CN.transhell b/pkg/usr/share/ssinstall-local/transhell/ssinstall-local_zh_CN.transhell new file mode 100644 index 0000000..680af76 --- /dev/null +++ b/pkg/usr/share/ssinstall-local/transhell/ssinstall-local_zh_CN.transhell @@ -0,0 +1,6 @@ +#!/bin/bash +TRANSHELL_CONTENT_HASH_CHECK_FAILED="软件包校验失败!这不应该发生!\n可能是因为软件包已损坏,星火仓库未同步,或者最坏的情况:恶意软件尝试利用自动安装来入侵系统!\n如果你不清楚发生了什么,请执行 sudo aptss update 后再尝试安装。\n如果问题仍然存在,请在应用信息界面点击 应用反馈 来提交反馈给我们!\n\n 如果你是审核人员,请使用 ssaudit来替代ssinstall进行审核工作,因为现在ssinstall已经被用于免密安装。\n如果你正在尝试安装已经下架的星火应用,也可用ssaudit来替代ssinstall" +TRANSHELL_CONTENT_PLEASE_RUN_AS_ROOT="请使用root启动ssinstall" +TRANSHELL_CONTENT_FILE_NOT_EXIST="文件不存在" +TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB="未指定安装后删除或安装出错,不删除deb包" +TRANSHELL_CONTENT_DEB_IS_DELETED="使用了--delete-after-install选项且安装未出错,删除deb包" diff --git a/src/application.cpp b/src/application.cpp index 46c56a9..2505143 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -35,14 +35,13 @@ Application::Application(int &argc, char **argv) setApplicationName("spark-store"); // 影响 ~/.config/spark-union ~/.local/share/spark-union 下文件夹名称 setApplicationDisplayName(QObject::tr("Spark Store")); // 设置窗口显示标题 (Wayland 下会显示 Qt 原生标题栏) setProductName(QObject::tr("Spark Store")); - setProductIcon(QIcon::fromTheme("spark-store")); + setProductIcon(QIcon(":/icon/sparky.png")); setApplicationHomePage("https://gitee.com/spark-store-project"); setApplicationDescription( QObject::tr( "An appstore powered by community
" - "https://www.spark-app.store
" - "Spark developers")); - setApplicationLicense(" Spark Opensource License "); + "Sparky is our mascot, designed by Tyson Tan
")); + setApplicationLicense(" GPL V3 "); // 检查 ~/.config/spark-union/spark-store 文件夹是否存在 checkAppConfigLocation(); diff --git a/src/assets/assets.qrc b/src/assets/assets.qrc index 348edce..c46a72f 100644 --- a/src/assets/assets.qrc +++ b/src/assets/assets.qrc @@ -44,6 +44,7 @@ icon/light/text.svg icon/light/update.svg icon/logo.svg + icon/sparky.png json/features.json tags/a2d_full.svg tags/a2d.png @@ -72,6 +73,21 @@ tags/uos_full.svg tags/uos.png tags/uos.svg + tags/amber-ce-bookworm_full.svg + tags/amber-ce-bookworm.png + tags/amber-ce-bookworm.svg + tags/amber-ce-sid_full.svg + tags/amber-ce-sid.png + tags/amber-ce-sid.svg + tags/amber-ce-trixie_full.svg + tags/amber-ce-trixie.png + tags/amber-ce-trixie.svg + tags/native_full.svg + tags/native.png + tags/native.svg translations/qtwebengine_zh.qm + tags/amber-ce-deepin_full.svg + tags/amber-ce-deepin.svg + tags/amber-ce-deepin.png diff --git a/src/assets/icon/sparky.png b/src/assets/icon/sparky.png new file mode 100644 index 0000000..cf154b0 Binary files /dev/null and b/src/assets/icon/sparky.png differ diff --git a/src/assets/tags/a2d.png b/src/assets/tags/a2d.png index e0bf6d0..548e7ee 100644 Binary files a/src/assets/tags/a2d.png and b/src/assets/tags/a2d.png differ diff --git a/src/assets/tags/amber-ce-bookworm.png b/src/assets/tags/amber-ce-bookworm.png new file mode 100644 index 0000000..9047cd5 Binary files /dev/null and b/src/assets/tags/amber-ce-bookworm.png differ diff --git a/src/assets/tags/amber-ce-bookworm.svg b/src/assets/tags/amber-ce-bookworm.svg new file mode 100644 index 0000000..60638cf --- /dev/null +++ b/src/assets/tags/amber-ce-bookworm.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/amber-ce-bookworm_full.svg b/src/assets/tags/amber-ce-bookworm_full.svg new file mode 100644 index 0000000..4ed208d --- /dev/null +++ b/src/assets/tags/amber-ce-bookworm_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/amber-ce-deepin.png b/src/assets/tags/amber-ce-deepin.png new file mode 100644 index 0000000..9b215a7 Binary files /dev/null and b/src/assets/tags/amber-ce-deepin.png differ diff --git a/src/assets/tags/amber-ce-deepin.svg b/src/assets/tags/amber-ce-deepin.svg new file mode 100644 index 0000000..90cb44b --- /dev/null +++ b/src/assets/tags/amber-ce-deepin.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/amber-ce-deepin_full.svg b/src/assets/tags/amber-ce-deepin_full.svg new file mode 100644 index 0000000..a0faa1b --- /dev/null +++ b/src/assets/tags/amber-ce-deepin_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/amber-ce-sid.png b/src/assets/tags/amber-ce-sid.png new file mode 100644 index 0000000..79bf6fa Binary files /dev/null and b/src/assets/tags/amber-ce-sid.png differ diff --git a/src/assets/tags/amber-ce-sid.svg b/src/assets/tags/amber-ce-sid.svg new file mode 100644 index 0000000..6b28b6b --- /dev/null +++ b/src/assets/tags/amber-ce-sid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/amber-ce-sid_full.svg b/src/assets/tags/amber-ce-sid_full.svg new file mode 100644 index 0000000..bfa1651 --- /dev/null +++ b/src/assets/tags/amber-ce-sid_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/amber-ce-trixie.png b/src/assets/tags/amber-ce-trixie.png new file mode 100644 index 0000000..d19de91 Binary files /dev/null and b/src/assets/tags/amber-ce-trixie.png differ diff --git a/src/assets/tags/amber-ce-trixie.svg b/src/assets/tags/amber-ce-trixie.svg new file mode 100644 index 0000000..d675bcf --- /dev/null +++ b/src/assets/tags/amber-ce-trixie.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/amber-ce-trixie_full.svg b/src/assets/tags/amber-ce-trixie_full.svg new file mode 100644 index 0000000..7669a3a --- /dev/null +++ b/src/assets/tags/amber-ce-trixie_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/community.png b/src/assets/tags/community.png index 6250da5..7105a11 100644 Binary files a/src/assets/tags/community.png and b/src/assets/tags/community.png differ diff --git a/src/assets/tags/debian.png b/src/assets/tags/debian.png index 955942d..944a253 100644 Binary files a/src/assets/tags/debian.png and b/src/assets/tags/debian.png differ diff --git a/src/assets/tags/deepin.png b/src/assets/tags/deepin.png index e192bf9..bcff425 100644 Binary files a/src/assets/tags/deepin.png and b/src/assets/tags/deepin.png differ diff --git a/src/assets/tags/dtk.png b/src/assets/tags/dtk.png index dc83133..76f73d6 100644 Binary files a/src/assets/tags/dtk.png and b/src/assets/tags/dtk.png differ diff --git a/src/assets/tags/dwine2.png b/src/assets/tags/dwine2.png index fddaf72..0de4631 100644 Binary files a/src/assets/tags/dwine2.png and b/src/assets/tags/dwine2.png differ diff --git a/src/assets/tags/dwine5.png b/src/assets/tags/dwine5.png index d1fc71b..1e06ee4 100644 Binary files a/src/assets/tags/dwine5.png and b/src/assets/tags/dwine5.png differ diff --git a/src/assets/tags/native.png b/src/assets/tags/native.png new file mode 100644 index 0000000..8d61785 Binary files /dev/null and b/src/assets/tags/native.png differ diff --git a/src/assets/tags/native.svg b/src/assets/tags/native.svg new file mode 100644 index 0000000..96bfb03 --- /dev/null +++ b/src/assets/tags/native.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/native_full.svg b/src/assets/tags/native_full.svg new file mode 100644 index 0000000..6c633d2 --- /dev/null +++ b/src/assets/tags/native_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/ubuntu.png b/src/assets/tags/ubuntu.png index ac173fe..f5c2907 100644 Binary files a/src/assets/tags/ubuntu.png and b/src/assets/tags/ubuntu.png differ diff --git a/src/assets/tags/uos.png b/src/assets/tags/uos.png index be8add4..2c1f3bb 100644 Binary files a/src/assets/tags/uos.png and b/src/assets/tags/uos.png differ diff --git a/src/backend/DataCollectorAndUploader.cpp b/src/backend/DataCollectorAndUploader.cpp index 354b57b..695a1ce 100644 --- a/src/backend/DataCollectorAndUploader.cpp +++ b/src/backend/DataCollectorAndUploader.cpp @@ -8,6 +8,8 @@ #include #include #include +#include +#include DataCollectorAndUploader::DataCollectorAndUploader(QObject *parent) : QObject(parent) { @@ -23,25 +25,26 @@ void DataCollectorAndUploader::collectData() QString distributor_id; QString release; QString architecture; - + QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat); QString version = config.value("build/version").toString(); QString uuid = config.value("info/uuid").toString(); - - // Execute lsb_release --all and capture the output - QProcess lsbProcess; - lsbProcess.start("lsb_release", QStringList() << "--all"); - lsbProcess.waitForFinished(); - QString lsbOutput = lsbProcess.readAllStandardOutput(); - - QStringList lines = lsbOutput.split('\n'); - for (const QString &line : lines) { - if (line.contains("Distributor ID:")) { - distributor_id = line.split(":").last().trimmed(); - } else if (line.contains("Release:")) { - release = line.split(":").last().trimmed(); + // Read /etc/os-release file + QFile osReleaseFile("/etc/os-release"); + if (osReleaseFile.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream in(&osReleaseFile); + while (!in.atEnd()) { + QString line = in.readLine(); + if (line.startsWith("ID=")) { + distributor_id = line.mid(3).remove('"').trimmed(); + } else if (line.startsWith("VERSION_ID=")) { + release = line.mid(11).remove('"').trimmed(); + } } + osReleaseFile.close(); + } else { + qWarning() << "Could not open /etc/os-release file"; } // Execute uname -m to get the architecture @@ -58,8 +61,6 @@ void DataCollectorAndUploader::collectData() json.insert("Store_Version", version); json.insert("UUID", uuid); - - // Convert to byte array QJsonDocument doc(json); QByteArray jsonData = doc.toJson(); diff --git a/src/main.cpp b/src/main.cpp index ec50d24..9573282 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -142,18 +142,18 @@ int main(int argc, char *argv[]) // 龙芯机器配置,使得 DApplication 能正确加载 QtWebEngine qputenv("DTK_FORCE_RASTER_WIDGETS", "FALSE"); + // 设置 QtWebEngine 环境变量 + QStringList chromium_flags; // 浏览器开启 GPU 支持 - // qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-features=UseModernMediaControls"); - // qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-web-security"); + // chromium_flags.append("--disable-features=UseModernMediaControls"); + // chromium_flags.append("--disable-web-security"); // 全平台软件渲染Webkit - qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-gpu"); -#ifdef __sw_64__ - qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--no-sandbox"); + chromium_flags.append("--disable-gpu"); +#if defined __sw_64__ || __loongarch__ + chromium_flags.append("--no-sandbox"); #endif + qputenv("QTWEBENGINE_CHROMIUM_FLAGS", chromium_flags.join(" ").toUtf8()); -#ifdef __loongarch__ - qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--no-sandbox"); -#endif /** * NOTE: https://zhuanlan.zhihu.com/p/550285855 * 避免 wayland 环境下从 QtWebEngine 后退回到 QWidget 时黑屏闪烁 @@ -163,8 +163,6 @@ int main(int argc, char *argv[]) DApplication::setAttribute(Qt::AA_UseSoftwareOpenGL); } - - #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) // 开启 Hidpi 支持 qDebug() << "Enable HiDPI Support."; diff --git a/src/pages/appintopage.cpp b/src/pages/appintopage.cpp index 4e22bd8..c67b0d1 100644 --- a/src/pages/appintopage.cpp +++ b/src/pages/appintopage.cpp @@ -151,24 +151,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 { @@ -234,6 +235,12 @@ void AppIntoPage::clear() ui->tag_debian->hide(); ui->tag_ubuntu->hide(); ui->tag_community->hide(); + ui->tag_native->hide(); + ui->tag_amber_ce_bookworm->hide(); + ui->tag_amber_ce_trixie->hide(); + ui->tag_amber_ce_sid->hide(); + ui->tag_amber_ce_deepin23->hide(); + ui->icon->clear(); ui->title->clear(); ui->version->clear(); @@ -404,53 +411,87 @@ void AppIntoPage::setAppinfoTags(const QStringList &tagList) bool deepinSupport = false; bool uosSupport = false; bool debianSupport = false; + bool hasAmberTag = false; + + // First pass: Check if any Amber tags exist foreach (const QString &tag, tagList) { - if (tag == "community") + if (tag.startsWith("amber-ce-")) { - ui->tag_community->show(); - } - else if (tag == "debian") - { - ui->tag_debian->show(); - debianSupport = true; - } - else if (tag == "ubuntu") - { - ui->tag_ubuntu->show(); - ubuntuSupport = true; - } - else if (tag == "deepin") - { - ui->tag_deepin->show(); - deepinSupport = true; - } - else if (tag == "uos") - { - ui->tag_uos->show(); - uosSupport = true; - - } - else if (tag == "dtk5") - { - ui->tag_dtk5->show(); - } - else if (tag == "dwine2") - { - ui->tag_dwine2->show(); - } - else if (tag == "dwine5") - { - ui->tag_dwine5->show(); - } - else if (tag == "a2d") - { - ui->tag_a2d->show(); + hasAmberTag = true; + break; // No need to continue checking } } - notifyUserUnsupportedTags(ubuntuSupport, deepinSupport, uosSupport ,debianSupport); + + + // Second pass: Apply tags based on whether we have Amber tags + foreach (const QString &tag, tagList) + { + if (tag.isEmpty()) + continue; + + if (tag == "native") + ui->tag_native->show(); + + else if (tag == "community") + ui->tag_community->show(); + + else if (tag == "dtk5") + ui->tag_dtk5->show(); + + else if (tag == "dwine2") + ui->tag_dwine2->show(); + + else if (tag == "dwine5") + ui->tag_dwine5->show(); + + else if (tag == "a2d") + ui->tag_a2d->show(); + + else if (tag == "amber-ce-bookworm") + ui->tag_amber_ce_bookworm->show(); + + else if (tag == "amber-ce-trixie") + ui->tag_amber_ce_trixie->show(); + + else if (tag == "amber-ce-deepin23") + ui->tag_amber_ce_deepin23->show(); + + else if (tag == "amber-ce-sid") + ui->tag_amber_ce_sid->show(); + + // Only process distro tags if there are no Amber tags + else if (!hasAmberTag) + { + if (tag == "debian") + { + ui->tag_debian->show(); + debianSupport = true; + } + else if (tag == "ubuntu") + { + ui->tag_ubuntu->show(); + ubuntuSupport = true; + } + else if (tag == "deepin") + { + ui->tag_deepin->show(); + deepinSupport = true; + } + else if (tag == "uos") + { + ui->tag_uos->show(); + uosSupport = true; + } + } + } + + if (!hasAmberTag) + notifyUserUnsupportedTags(ubuntuSupport, deepinSupport, uosSupport, debianSupport); } + + void AppIntoPage::notifyUserUnsupportedTags(bool ubuntuSupport, bool deepinSupport, bool uosSupport, bool debianSupport) { if (!SettingsPage::needUncompatibleNotification) { @@ -536,7 +577,27 @@ void AppIntoPage::on_downloadButton_clicked() emit clickedDownloadBtn(); - DownloadItem *item = dw->addItem(info["Name"].toString(), info["Filename"].toString(), info["Pkgname"].toString(), iconpixmap, downloadUrl); + // 处理 tags,设置 installExtraArg + QString installExtraArg; +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + QStringList taglist = info["Tags"].toString().split(";", Qt::SkipEmptyParts); +#else + QStringList taglist = info["Tags"].toString().split(";", QString::SkipEmptyParts); +#endif + if (taglist.contains("native")) { + installExtraArg = "--native"; + } else if (taglist.contains("amber-ce-bookworm")) { + installExtraArg = "--amber-ce-bookworm"; + } else if (taglist.contains("amber-ce-trixie")) { + installExtraArg = "--amber-ce-trixie"; + } else if (taglist.contains("amber-ce-sid")) { + installExtraArg = "--amber-ce-sid"; + } else if (taglist.contains("amber-ce-deepin23")) { + installExtraArg = "--amber-ce-deepin23"; + } + + DownloadItem *item = dw->addItem(info["Name"].toString(), info["Filename"].toString(), info["Pkgname"].toString(), + iconpixmap, downloadUrl, installExtraArg); if (item == nullptr) { return; @@ -566,11 +627,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(); @@ -581,7 +642,7 @@ void AppIntoPage::on_pushButton_3_clicked() ui->downloadButton->setEnabled(true); ui->pushButton_3->setEnabled(true); - check.close(); + // check.close(); }); } @@ -597,4 +658,4 @@ void AppIntoPage::on_updateButton_clicked() { QString feedbackURL = "https://bbs.spark-app.store/"; QProcess::startDetached("xdg-open", QStringList{feedbackURL}); -} \ No newline at end of file +} diff --git a/src/pages/appintopage.ui b/src/pages/appintopage.ui index 7492a61..3c8845a 100644 --- a/src/pages/appintopage.ui +++ b/src/pages/appintopage.ui @@ -385,14 +385,20 @@ - 184 - 20 + 13 + 37 - + + + + 40 + 40 + + 40 @@ -411,7 +417,13 @@ - + + + + 40 + 40 + + 40 @@ -430,7 +442,13 @@ - + + + + 40 + 40 + + 40 @@ -449,7 +467,13 @@ - + + + + 40 + 40 + + 40 @@ -467,6 +491,131 @@ + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>This app can only be installed natively</p></body></html> + + + <html><head/><body><p>This app can only be installed natively</p></body></html> + + + :/tags/native.png + + + + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>This app will be installed to debian12 ACE</p></body></html> + + + <html><head/><body><p>This app will be installed to debian12 ACE</p></body></html> + + + :/tags/amber-ce-bookworm.png + + + + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>This app will be installed to debian13 ACE</p></body></html> + + + <html><head/><body><p>This app will be installed to debian13 ACE</p></body></html> + + + :/tags/amber-ce-trixie.png + + + + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>This app will be installed to debian SID ACE</p></body></html> + + + <html><head/><body><p>This app will be installed to debian SID ACE</p></body></html> + + + :/tags/amber-ce-sid.png + + + + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>This app will be installed to deepin23 ACE</p></body></html> + + + <html><head/><body><p>This app will be installed to deepin23 ACE</p></body></html> + + + :/tags/amber-ce-deepin.png + + + @@ -474,8 +623,8 @@ - 184 - 20 + 18 + 37 @@ -498,7 +647,13 @@ - + + + + 40 + 40 + + 40 @@ -517,7 +672,13 @@ - + + + + 40 + 40 + + 40 @@ -536,7 +697,13 @@ - + + + + 40 + 40 + + 40 @@ -555,7 +722,13 @@ - + + + + 40 + 40 + + 40 @@ -574,7 +747,13 @@ - + + + + 40 + 40 + + 40 @@ -718,7 +897,7 @@ 0 0 - 524 + 482 601 @@ -1452,6 +1631,13 @@ QListWidget::item::selected + + + CustomLabel + QLabel +
widgets/common/customlabel.h
+
+
diff --git a/src/spark-store.pro b/src/spark-store.pro index e6ffa3e..db84c7c 100644 --- a/src/spark-store.pro +++ b/src/spark-store.pro @@ -47,6 +47,7 @@ SOURCES += \ utils/utils.cpp \ utils/widgetanimation.cpp \ widgets/base/basewidgetopacity.cpp \ + widgets/common/customlabel.cpp \ widgets/common/downloaditem.cpp \ widgets/common/progressbutton.cpp \ widgets/common/smoothlistwidget.cpp \ @@ -73,6 +74,7 @@ HEADERS += \ utils/utils.h \ utils/widgetanimation.h \ widgets/base/basewidgetopacity.h \ + widgets/common/customlabel.h \ widgets/common/downloaditem.h \ widgets/common/progressbutton.h \ widgets/common/smoothlistwidget.h \ diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp index a3aa560..7d27054 100644 --- a/src/utils/utils.cpp +++ b/src/utils/utils.cpp @@ -198,7 +198,7 @@ void Utils::setQPAPlatform() // } else { - qputenv("QT_QPA_PLATFORM", "dxcb"); + qputenv("QT_QPA_PLATFORM", "dxcb;xcb"); } } diff --git a/src/widgets/common/customlabel.cpp b/src/widgets/common/customlabel.cpp new file mode 100644 index 0000000..9af89d4 --- /dev/null +++ b/src/widgets/common/customlabel.cpp @@ -0,0 +1,25 @@ +#include "customlabel.h" + +#include + +CustomLabel::CustomLabel(QWidget *parent, + Qt::WindowFlags f) + : QLabel(parent, f) +{ +} + +QPixmap CustomLabel::pixmap() const +{ + return QLabel::pixmap(Qt::ReturnByValue); +} + +void CustomLabel::setPixmap(const QPixmap &pixmap) +{ + QPixmap _pixmap = pixmap; + _pixmap.setDevicePixelRatio(qApp->devicePixelRatio()); + _pixmap = _pixmap.scaled(size() * _pixmap.devicePixelRatio(), + Qt::KeepAspectRatio, + Qt::SmoothTransformation); + + QLabel::setPixmap(_pixmap); +} diff --git a/src/widgets/common/customlabel.h b/src/widgets/common/customlabel.h new file mode 100644 index 0000000..f1d55b4 --- /dev/null +++ b/src/widgets/common/customlabel.h @@ -0,0 +1,19 @@ +#ifndef CUSTOMLABEL_H +#define CUSTOMLABEL_H + +#include + +class CustomLabel : public QLabel +{ + Q_OBJECT + Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap) + +public: + explicit CustomLabel(QWidget *parent = nullptr, + Qt::WindowFlags f = Qt::WindowFlags()); + + virtual QPixmap pixmap() const; + virtual void setPixmap(const QPixmap &pixmap); +}; + +#endif // CUSTOMLABEL_H diff --git a/src/widgets/common/downloaditem.cpp b/src/widgets/common/downloaditem.cpp index 574780b..45cdc54 100644 --- a/src/widgets/common/downloaditem.cpp +++ b/src/widgets/common/downloaditem.cpp @@ -175,8 +175,16 @@ void DownloadItem::slotAsyncInstall(int t) switch (t) { case 0: - installer.start("pkexec", QStringList() << "/usr/local/bin/ssinstall" - << "/tmp/spark-store/" + ui->label_filename->text().toUtf8() << "--delete-after-install"); + { + QStringList args; + args << "/usr/local/bin/ssinstall" + << "/tmp/spark-store/" + ui->label_filename->text().toUtf8(); + if (!installExtraArg.isEmpty()) { + args << installExtraArg; + } + args << "--delete-after-install"; + installer.start("pkexec", args); + } break; case 1: installer.start("deepin-deb-installer", QStringList() << "/tmp/spark-store/" + ui->label_filename->text().toUtf8()); @@ -208,11 +216,11 @@ 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) + // QProcess isInstall; + // 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.")); @@ -244,8 +252,5 @@ void DownloadItem::slotAsyncInstall(int t) ui->widget_spinner->hide(); DownloadItem::isInstall = false; - installer.deleteLater(); - isInstall.deleteLater(); - - emit finished(error == 0 && !haveError && !notRoot); + emit finished(!haveError && !notRoot); } diff --git a/src/widgets/common/downloaditem.h b/src/widgets/common/downloaditem.h index 13c2d2b..afd479c 100644 --- a/src/widgets/common/downloaditem.h +++ b/src/widgets/common/downloaditem.h @@ -43,6 +43,9 @@ public: void install(int); + // 新增:安装时额外参数 + QString installExtraArg; + private: Ui::DownloadItem *ui; diff --git a/src/widgets/downloadlistwidget.cpp b/src/widgets/downloadlistwidget.cpp index f253fb6..413477a 100644 --- a/src/widgets/downloadlistwidget.cpp +++ b/src/widgets/downloadlistwidget.cpp @@ -85,7 +85,9 @@ void DownloadListWidget::clearItem() ui->listWidget->clear(); } -DownloadItem* DownloadListWidget::addItem(QString name, QString fileName, QString pkgName, const QPixmap icon, QString downloadurl) +DownloadItem* DownloadListWidget::addItem(QString name, QString fileName, QString pkgName, + const QPixmap icon, QString downloadurl, + const QString &installExtraArg) { if (fileName.isEmpty()) { @@ -104,6 +106,7 @@ DownloadItem* DownloadListWidget::addItem(QString name, QString fileName, QStrin di->setName(name); di->setFileName(fileName); di->pkgName = pkgName; + di->installExtraArg = installExtraArg; di->seticon(icon); QListWidgetItem *pItem = new QListWidgetItem(); pItem->setSizeHint(QSize(240, 56)); // ui 中单个 downloaditem 高度固定 56px(上下 margin 8px,图片固定 48x48) diff --git a/src/widgets/downloadlistwidget.h b/src/widgets/downloadlistwidget.h index 6faebc0..263c160 100644 --- a/src/widgets/downloadlistwidget.h +++ b/src/widgets/downloadlistwidget.h @@ -19,7 +19,9 @@ class DownloadListWidget : public DBlurEffectWidget Q_OBJECT public: - DownloadItem *addItem(QString name, QString fileName, QString pkgName, const QPixmap icon, QString downloadurl); + DownloadItem *addItem(QString name, QString fileName, QString pkgName, + const QPixmap icon, QString downloadurl, + const QString &installExtraArg); int nowDownload = 0; int allDownload = 0; int toDownload = 0; diff --git a/tool/ssaudit b/tool/ssaudit index 7e5122d..5cf07ad 100755 --- a/tool/ssaudit +++ b/tool/ssaudit @@ -1,81 +1,170 @@ #!/bin/bash +# 初始化常量和全局变量 +readonly SPARK_DOWNLOAD_SERVER_URL="https://d.spark-app.store/" +readonly SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL="d.spark-app.store" +# ACE环境配置 - 修改此数组即可添加或删除支持的环境——记得修改 store-helper 里的 uninstaller check-is-installed 和 ss-launcher +readonly ACE_ENVIRONMENTS=( + "bookworm-run:amber-ce-bookworm" + "trixie-run:amber-ce-trixie" + "deepin23-run:amber-ce-deepin23" + "sid-run:amber-ce-sid" +) +readonly ACE_ENVIRONMENTS_FOR_AUTOINSTALL=( + "bookworm-run:amber-ce-bookworm" + "trixie-run:amber-ce-trixie" +) +function get_current_user() { + # 优先通过 who 命令获取用户 + local user + user=$(who | awk '{print $1}' | head -n 1 2>/dev/null) -source /opt/durapps/spark-store/bin/bashimport/transhell.amber -load_transhell_debug -export DEBIAN_FRONTEND=noninteractive + # 如果 who 无输出,则通过 loginctl 获取 + if [[ -z "$user" ]]; then + user=$(loginctl list-sessions --no-legend 2>/dev/null | awk '{print $3}' | head -n 1) + fi -trap 'unlock_file $DEBPATH' EXIT -case $(arch) in - x86_64) - STORE_URL="store" - ;; - aarch64) - STORE_URL="aarch64-store" - ;; - loongarch64) - STORE_URL="loong64-store" - STORE_LIST_URL="-loong64" - ;; -esac - -echo "Spark Store Audit script. 星火商店审核脚本" - -function pkexec_as_current_user() { - local user=$(who | awk '{print $1}' | head -n 1) - local uid=$(id -u "$user") - sudo -u "$user" DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/"$uid"/bus pkexec "$@" + # 返回最终结果(可能为空) + echo "${user}" } -function create_desktop_file() { - local user=$(who | awk '{print $1}' | head -n 1) - if [ -e $(sudo -u "$user" xdg-user-dir)/.config/spark-union/spark-store/ssshell-config-do-not-create-desktop ];then - echo "It is configured that do not create desktop file. Give up" - else - exec_create_desktop_file - fi -} -function exec_create_desktop_file() { - local user=$(who | awk '{print $1}' | head -n 1) - for desktop_file_path in $(dpkg -L "$package_name" |grep /usr/share/applications/ | awk '/\.desktop$/ {print}'); do - if [ "$(cat $desktop_file_path | grep NoDisplay=true)" = "" ];then - echo $desktop_file_path is checked and will be installed to desktop - sudo -u "$user" cp "$desktop_file_path" "$(sudo -u "$user" xdg-user-dir DESKTOP)/" - fi - done - for desktop_file_path in $(dpkg -L "$package_name" |grep /opt/apps/$package_name/entries/applications | awk '/\.desktop$/ {print}'); do - if [ "$(cat $desktop_file_path | grep NoDisplay=true)" = "" ];then - echo $desktop_file_path is checked and will be installed to desktop - chmod +x $desktop_file_path - sudo -u "$user" cp "$desktop_file_path" "$(sudo -u "$user" xdg-user-dir DESKTOP)/" - fi - done - - -} - function zenity() { - local user=$(who | awk '{print $1}' | head -n 1) + local user=$(get_current_user) local uid=$(id -u "$user") sudo -u "$user" DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/"$uid"/bus zenity "$@" } -function hash_check() { - if [ ! -e "/var/lib/aptss/lists/d.spark-app.store_${STORE_URL}_Packages" ] && \ - [ ! -e "/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" ] && \ - [ ! -e "/var/lib/aptss/lists/mirrors.sdu.edu.cn_spark-store_${STORE_URL}_Packages" ]; then - echo "接收星火仓库软件信息中..." - aptss ssupdate - fi - if [ -e "/var/lib/aptss/lists/d.spark-app.store_${STORE_URL}_Packages" ]; then - PACKAGES_DATA_PATH="/var/lib/aptss/lists/d.spark-app.store_${STORE_URL}_Packages" - echo "星火仓库的Packages位置为 $PACKAGES_DATA_PATH,是星火域名仓库配置" +# 全局变量初始化(位于 parse_args 前) +ACE_PARAMS=() + +# 生成ACE环境参数帮助信息 +function generate_ace_help() { + local help_text="" + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + local ace_param="--${ace_entry#*:}" + help_text+=" $ace_param 使用${ace_entry%%:*} ACE容器安装\n" + done + echo -e "$help_text" +} +source /opt/durapps/spark-store/bin/bashimport/transhell.amber +# 脚本工作变量 +DELETE_AFTER_INSTALL="0" +DEBPATH="" +FORCE_ACE_ENV="" +FORCE_NATIVE="0" +NO_CREATE_DESKTOP="0" +FORCE_CREATE_DESKTOP="0" + +# 加载翻译和调试 +load_transhell_debug +export DEBIAN_FRONTEND=noninteractive +# 根据架构设置仓库URL +case $(arch) in + x86_64) STORE_URL="store" ;; + aarch64) STORE_URL="aarch64-store" ;; + loongarch64) STORE_URL="loong64-store" ;; +esac +# 帮助函数 +function show_help() { + echo "Spark Store Anstall script. 星火商店审核脚本" + echo "用法: $0 [选项] " + echo "选项:" + echo " -h, --help 显示帮助信息" + echo " --delete-after-install 安装成功后删除软件包" + echo " --no-create-desktop-entry 不创建桌面快捷方式" + echo " --force-create-desktop-entry 强制创建桌面快捷方式" + echo "$(generate_ace_help)" + echo " --native 只在主机安装,不使用ACE容器" +} +# 参数解析 +function parse_args() { + while [ $# -gt 0 ]; do + case "$1" in + -h|--help) + show_help + exit 0 + ;; + --delete-after-install) + DELETE_AFTER_INSTALL="1" + shift + ;; + --native) + FORCE_NATIVE="1" + shift + ;; + --no-create-desktop-entry) + NO_CREATE_DESKTOP="1" + shift + ;; + --force-create-desktop-entry) + FORCE_CREATE_DESKTOP="1" + shift + ;; + *) + # 检查是否为ACE环境参数 + local is_ace_param=0 + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + local ace_param="--${ace_entry#*:}" + if [ "$1" = "$ace_param" ]; then + # 将ACE环境命令名加入数组 + ACE_PARAMS+=("${ace_entry%%:*}") + is_ace_param=1 + shift + break + fi + done + + # 如果不是ACE环境参数,则视为DEB路径 + if [ "$is_ace_param" -eq 0 ]; then + DEBPATH="$1" + shift + fi + ;; + esac + done +} + + +# 验证当前用户 +function validate_user() { + if [ "$(id -u)" != "0" ]; then + echo "${TRANSHELL_CONTENT_PLEASE_RUN_AS_ROOT}" + echo "OMG-IT-GOES-WRONG" + exit 1 + fi +} + +# 验证文件存在或尝试下载 +function validate_or_download_file() { + if [ ! -f "$1" ]; then + echo "${TRANSHELL_CONTENT_FILE_NOT_EXIST},Trying to redownload" + aptss update + FILEPATH=$(dirname "$1") + FILENAME=$(basename "$1") + PACKAGE_NAME=$(echo "$FILENAME" | sed -r 's/^([^_]+)_.*$/\1/') + VERSION=$(echo "$FILENAME" | sed -r 's/^[^_]+_([^_]+)_.*$/\1/') + pushd "${FILEPATH}" >/dev/null || exit 1 + aptss download "${PACKAGE_NAME}" + popd >/dev/null || exit 1 + + if [ ! -f "$1" ]; then + echo "OMG-IT-GOES-WRONG" + exit 1 + fi + fi +} + +# 哈希校验 +function hash_check() { + local PACKAGES_DATA_PATH="" + + # 检查可能的仓库位置 + if [ -e "/var/lib/aptss/lists/${SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL}_${STORE_URL}_Packages" ]; then + PACKAGES_DATA_PATH="/var/lib/aptss/lists/${SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL}_${STORE_URL}_Packages" elif [ -e "/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" ]; then PACKAGES_DATA_PATH="/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" - echo "星火仓库的Packages位置为 $PACKAGES_DATA_PATH,是d域名单目录仓库配置" else PACKAGES_DATA_PATH="/var/lib/aptss/lists/mirrors.sdu.edu.cn_spark-store-repository_${STORE_URL}_Packages" - echo "星火仓库的Packages位置为 $PACKAGES_DATA_PATH,是SDU镜像仓库配置" fi echo "正在运行包验证..." @@ -83,31 +172,19 @@ function hash_check() { DEB_SHA512SUM=$(sha512sum "$1" | cut -d ' ' -f 1) unset IS_SHA512SUM_CHECKED - IS_SHA512SUM_CHECKED=$(cat "$PACKAGES_DATA_PATH" | grep "$DEB_SHA512SUM") + IS_SHA512SUM_CHECKED=$(grep -F "$DEB_SHA512SUM" "$PACKAGES_DATA_PATH") } -function lock_file(){ -chattr +i "$1" -} - -function unlock_file(){ -chattr -i "$1" -} - -function ensure_aptss_exist(){ - - if command -v aptss &>/dev/null; then - aptss update - else +# 确保aptss存在 +function ensure_aptss_exist() { + if ! command -v aptss &>/dev/null; then local deb_file="/tmp/spark-store-console-in-container_latest_all.deb" - # Download package if ! wget -O "$deb_file" "https://amber-ce-resource.spark-app.store/store/depends/spark-store-console-in-container_latest_all.deb"; then echo "下载 .deb 安装包失败" >&2 return 1 fi - # Install package if ! apt install -y "$deb_file"; then echo "安装 .deb 包失败" >&2 rm -f "$deb_file" @@ -115,7 +192,6 @@ function ensure_aptss_exist(){ fi rm -f "$deb_file" - # Verify installation if ! command -v aptss &>/dev/null; then echo "成功安装但未找到 aptss 命令" >&2 return 1 @@ -123,150 +199,322 @@ function ensure_aptss_exist(){ fi } export -f ensure_aptss_exist -#################################### -if [ $# -eq 0 ]; then - echo "没有接收到参数,退出" - echo "用法:$0 deb路径" - echo "OMG-IT-GOES-WRONG" - exit -fi - - - -if [ "$(id -u)" != "0" ]; then - echo "${TRANSHELL_CONTENT_PLEASE_RUN_AS_ROOT}" - echo "OMG-IT-GOES-WRONG" - exit 1 -fi - -if [ ! -f "$1" ]; then - echo "${TRANSHELL_CONTENT_FILE_NOT_EXIST},Trying to redownload" - FILEPATH=$(dirname "$1") - FILENAME=$(basename "$1") - PACKAGE_NAME=$(echo "$FILENAME" | sed -r 's/^([^_]+)_.*$/\1/') - VERSION=$(echo "$FILENAME" | sed -r 's/^[^_]+_([^_]+)_.*$/\1/') - pushd ${FILEPATH} - aptss download ${PACKAGE_NAME} - popd - if [ ! -f "$1" ]; then - echo "OMG-IT-GOES-WRONG" - exit 1 - else - DEBPATH=$(realpath "$1") +# 确保ACE环境存在 +function ensure_ace_env() { + local ace_env_pkg="${1}" + + if ! dpkg -l "$ace_env_pkg" &>/dev/null; then + echo "ACE环境$ace_env_pkg未安装,正在尝试安装..." + zenity --info --text="首次使用$ace_env_pkg环境,重启或注销桌面后才能在启动器中展示,不影响应用启动。安装将在后台继续。" --title="ACE环境安装" & + if ! aptss install -y "$ace_env_pkg"; then + echo "安装$ace_env_pkg失败" + return 1 + fi fi + return 0 +} +export user=$(who | awk '{print $1}' | head -n 1) +# 在桌面创建快捷方式 +function create_desktop_file() { + # 如果明确要求不要创建或明确要创建,则跳过配置文件检查 + if [ "$NO_CREATE_DESKTOP" -eq 1 ]; then + echo "根据参数要求,跳过创建桌面快捷方式" + return + fi + + if [ "$FORCE_CREATE_DESKTOP" -eq 0 ]; then + if [ -e "$(sudo -u "$user" xdg-user-dir)/.config/spark-union/spark-store/ssshell-config-do-not-create-desktop" ]; then + echo "根据配置要求,跳过创建桌面快捷方式" + return + fi + fi + + exec_create_desktop_file +} +export CURRENT_USER_DIR_DESKTOP=$(sudo -u "$user" xdg-user-dir DESKTOP) +function exec_create_desktop_file() { + local desktop_files=() + + # 收集所有桌面文件 + desktop_files+=($(dpkg -L "$package_name" | grep '/usr/share/applications/.*\.desktop$')) + desktop_files+=($(dpkg -L "$package_name" | grep '/opt/apps/'"$package_name"'/entries/applications/.*\.desktop$')) + + for desktop_file_path in "${desktop_files[@]}"; do + if [ "$FORCE_CREATE_DESKTOP" -eq 1 ] || [ -z "$(grep 'NoDisplay=true' "$desktop_file_path")" ]; then + echo "$desktop_file_path is checked and will be installed to desktop" + chmod +x "$desktop_file_path" + sudo -u "$user" cp "$desktop_file_path" "${CURRENT_USER_DIR_DESKTOP}" + fi + done +} +export -f exec_create_desktop_file + +# 在ACE环境中创建桌面快捷方式 +function create_desktop_in_ace() { + local ace_cmd="$1" + local package_name="$2" + + # 如果明确要求不要创建,则直接返回 + if [ "$NO_CREATE_DESKTOP" -eq 1 ]; then + echo "根据参数要求,跳过在ACE中创建桌面快捷方式" + return 0 + fi + + # 如果是强制创建,或者没有配置禁止创建 + if [ "$FORCE_CREATE_DESKTOP" -eq 1 ] || ! $ace_cmd "[ -e ~/.config/spark-union/spark-store/ssshell-config-do-not-create-desktop ]"; then + echo "在ACE环境中创建桌面快捷方式..." + export -f exec_create_desktop_file + export package_name + export FORCE_CREATE_DESKTOP + $ace_cmd "exec_create_desktop_file" else - DEBPATH=$(realpath "$1") -fi + echo "根据ACE环境中的配置,跳过创建桌面快捷方式" + fi +} -lock_file "$DEBPATH" +# 在指定ACE环境中安装 +function install_in_ace_env() { + local ace_cmd="$1" + local deb_path="$2" + local ace_env_pkg="${3#*:}" + + if [ "$IS_ACE_ENV" != "" ] || command -v termux-chroot; then + echo "无法在ACE/termux/小小电脑中安装ACE包" + return 1 + fi + if ! ensure_ace_env "$ace_env_pkg"; then + return 1 + fi + + echo "----------------------------------------" + echo "正在尝试使用 $ace_cmd 环境安装..." + echo "----------------------------------------" + $ace_cmd "ensure_aptss_exist" -IS_SHA512SUM_CHECKED=skipped + # 首先尝试dry-run测试 + if ! $ace_cmd "aptss install --dry-run '$deb_path'"; then + echo "初始dry-run测试失败,尝试更新后重试..." + $ace_cmd "aptss update" + if ! $ace_cmd "aptss install --dry-run '$deb_path'"; then + echo "dry-run测试仍然失败,放弃安装" + echo "OMG_IT_GOES_WRONG" + return 1 + fi + fi + + # dry-run成功后执行实际安装 + $ace_cmd "aptss install store.spark-app.app-runtime-base --no-install-recommends -yfq" + if $ace_cmd "dpkg -i '$deb_path' || aptss install '$deb_path' -yfq"; then + return 0 + else + return 1 + fi +} -if [ ! -z "$IS_SHA512SUM_CHECKED" ]; then - echo "校验跳过,开始安装" - echo "----------------------------------------------------------------------------------" -package_name=$(dpkg-deb -f "$DEBPATH" Package) -echo "Package name is $package_name" -try_run_output=$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh test-install-app "$DEBPATH") -try_run_ret="$?" -# 安装失败后进行 aptss 刷新,随后尝试在主机安装 -if [ "$try_run_ret" -ne 0 ]; then - aptss update - try_run_output=$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh test-install-app "$DEBPATH") - try_run_ret="$?" -fi +# 在主机安装 +function install_in_host() { + local deb_path="$1" + + # 首先尝试dry-run测试 + if ! aptss install --dry-run "$deb_path"; then + echo "初始dry-run测试失败,尝试更新后重试..." + aptss update + if ! aptss install --dry-run "$deb_path"; then + echo "dry-run测试仍然失败,放弃安装" + return 1 + fi + fi + + # dry-run成功后执行实际安装 + if dpkg -i "$deb_path" || aptss install "$deb_path" -yfq; then + return 0 + else + return 1 + fi +} -if [ "$try_run_ret" -ne 0 ]; then ## 若安装检测仍然失败 - if [[ "$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" - ) - - success=false - recommendation_msg="" - # 收集所有推荐信息 - for ace_entry in "${ace_commands_order[@]}"; do - recommendation_msg+="您可安装 ${ace_entry%%:*} 兼容环境后重试: ${ace_entry#*:}\n" - done - - # 按顺序尝试每个ACE环境 - for ace_entry in "${ace_commands_order[@]}"; do - ace_cmd=${ace_entry%%:*} - if command -v "$ace_cmd" >/dev/null 2>&1; then - echo "----------------------------------------" - echo "正在尝试使用 $ace_cmd 环境安装..." - echo "----------------------------------------" - - # 在ACE环境中执行安装检测 - $ace_cmd ensure_aptss_exist - try_run_output=$($ace_cmd aptss install --dry-run "$DEBPATH" 2>&1) - try_run_ret="$?" - - # 如果首次检测失败则更新后重试 - if [ "$try_run_ret" -ne 0 ]; then - $ace_cmd aptss update - try_run_output=$($ace_cmd aptss install --dry-run "$DEBPATH" 2>&1) - try_run_ret="$?" - fi - - # 最终检测结果处理 - if [ "$try_run_ret" -eq 0 ]; then - echo "----------------------------------------" - echo "在 $ace_cmd 环境中预检成功,开始安装..." - echo "----------------------------------------" - $ace_cmd 'dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf' - success=true - break # 跳出循环 - else - echo "----------------------------------------" - echo "在 $ace_cmd 环境中安装预检失败,错误信息:" - echo -e "${try_run_output}" - echo "----------------------------------------" +# 自动尝试在各种环境中安装 +function auto_try_install() { + local deb_path="$1" + + # 首先尝试在主机安装 + if install_in_host "$deb_path"; then + create_desktop_file + return 0 + fi + + # 如果主机安装失败,并非在ACE内运行且不在强制本地模式,尝试ACE环境 + if [ "$FORCE_NATIVE" -eq 0 ] && [ "$IS_ACE_ENV" = "" ] && ! command -v termux-chroot; then + for ace_entry in "${ACE_ENVIRONMENTS_FOR_AUTOINSTALL[@]}"; do + local ace_cmd=${ace_entry%%:*} + local ace_env_pkg=${ace_entry#*:} + + # 确保ACE环境存在 + if ensure_ace_env "$ace_env_pkg"; then + if install_in_ace_env "$ace_cmd" "$deb_path" "$ace_env_pkg"; then + # 在ACE环境中创建桌面快捷方式 + create_desktop_in_ace "$ace_cmd" "$package_name" + return 0 fi fi done - - if ! $success; then - echo "OMG-IT-GOES-WRONG" - echo -e "${try_run_output}" - echo -e "所有ACE环境尝试失败,推荐安装以下任一兼容环境:\n${recommendation_msg}" - exit "$try_run_ret" + fi + + return 1 +} +# 清理安装后的文件 +function post_install_cleanup() { + local success=$1 + local deb_path="$2" + local package_name="$3" + + if [ "$success" -eq 0 ] && [ "$DELETE_AFTER_INSTALL" -eq "1" ]; then + # 检查是否安装在主机 + if [ "$FORCE_NATIVE" -eq 1 ] || [ -n "$FORCE_ACE_ENV" ]; then + if [ "$FORCE_NATIVE" -eq 1 ]; then + if dpkg -s "$package_name" >/dev/null 2>&1; then + echo "软件包已在主机安装:$package_name" + create_desktop_file + unlock_file "$deb_path" + rm "$deb_path" + echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" + else + echo "软件包未在主机安装:$package_name" + echo "安装异常!抛出错误" + echo "OMG-IT-GOES-WRONG" + exit 1 + fi + else + # ACE环境中安装的情况,不检查主机dpkg数据库 + echo "软件包已在ACE环境安装:$package_name" + unlock_file "$deb_path" + rm "$deb_path" + echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" + fi + else + # 自动模式下,如果ACE安装成功也会走到这里 + echo "软件包已安装:$package_name" + unlock_file "$deb_path" + rm "$deb_path" + echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" + fi + else + echo "${TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB}" + if [ "$FORCE_NATIVE" -eq 1 ] && ! dpkg -s "$package_name" >/dev/null 2>&1; then + echo "软件包未在主机安装:$package_name" + echo "安装异常!抛出错误" + echo "OMG-IT-GOES-WRONG" + exit 1 + elif [ -n "$FORCE_ACE_ENV" ] && ! command -v "$FORCE_ACE_ENV" >/dev/null 2>&1; then + echo "指定的ACE环境不可用" + echo "OMG-IT-GOES-WRONG" + exit 1 fi - else # 已经在ACE环境中仍失败直接退出 - echo "OMG-IT-GOES-WRONG" - echo -e "${try_run_output}" - exit "$try_run_ret" fi -else ## 如果主机安装检测成功 - dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf -fi +} -### 退出阶段保持不变 ### -if [ "$?" = "0" ] && [ "$2" = "--delete-after-install" ]; then - if dpkg -s "$package_name" >/dev/null 2>&1; then - echo "软件包已安装:$package_name" - create_desktop_file - unlock_file $DEBPATH - rm "$DEBPATH" - echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" - else - echo "软件包未安装:$package_name" - echo "安装异常!抛出错误" - echo "OMG-IT-GOES-WRONG" +# 文件锁定/解锁函数 +function lock_file() { + chattr +i "$1" +} + +function unlock_file() { + if [ -e "$1" ];then + chattr -i "$1" fi -else - echo "${TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB}" - if dpkg -s "$package_name" >/dev/null 2>&1; then - echo "软件包已安装:$package_name" - create_desktop_file - else - echo "软件包未安装:$package_name" - echo "安装异常!抛出错误" +} + +# 主安装流程 +function main_install() { + parse_args "$@" + + if [ -z "$DEBPATH" ]; then + echo "没有接收到参数,退出" + show_help echo "OMG-IT-GOES-WRONG" + exit 1 fi -fi -fi + + # 设置退出时的文件解锁 + trap 'unlock_file $DEBPATH' EXIT + validate_user + validate_or_download_file "$DEBPATH" + + DEBPATH=$(realpath "$DEBPATH") + lock_file "$DEBPATH" + + + + package_name=$(dpkg-deb -f "$DEBPATH" Package) + local install_success=1 + if [ "$FORCE_NATIVE" -eq 1 ] || [ "$IS_ACE_ENV" = "1" ]; then + # 优先使用主机安装,忽略所有ACE参数 + echo "忽略ACE,使用主机安装 $package_name" + install_in_host "$DEBPATH" + install_success=$? + # 安装成功后在主机创建桌面快捷方式 + if [ "$install_success" -eq 0 ]; then + create_desktop_file + fi + + elif [ ${#ACE_PARAMS[@]} -gt 0 ] && [ "$IS_ACE_ENV" != "" ]; then + # 用户指定了一个或多个ACE环境,且未要求原生安装 + echo "使用ACE环境安装,已指定环境: ${ACE_PARAMS[*]}" + + # 查找第一个已安装的ACE环境 + chosen_env="" + for env_cmd in "${ACE_PARAMS[@]}"; do + if command -v "$env_cmd" >/dev/null 2>&1; then + chosen_env="$env_cmd" + break + fi + done + # 如果没有安装任何环境,则使用第一个指定的环境 + if [ -z "$chosen_env" ]; then + chosen_env="${ACE_PARAMS[0]}" + echo "未发现已安装的ACE环境,准备安装 $chosen_env..." + # 查找对应的ACE环境软件包名 + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + if [ "${ace_entry%%:*}" = "$chosen_env" ]; then + ace_pkg="${ace_entry#*:}" + break + fi + done + # 安装ACE环境(示例使用aptss工具,可根据实际情况调整) + aptss install "$ace_pkg" -y + fi + + # 再次确认ACE环境命令是否可用 + if command -v "$chosen_env" >/dev/null 2>&1; then + # 查找软件包名(仅首次查找即可) + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + if [ "${ace_entry%%:*}" = "$chosen_env" ]; then + ace_pkg="${ace_entry#*:}" + break + fi + done + echo "在 ACE 环境 $chosen_env 中安装 $package_name" + install_in_ace_env "$chosen_env" "$DEBPATH" "$ace_pkg" + install_success=$? + if [ "$install_success" -eq 0 ]; then + create_desktop_in_ace "$chosen_env" "$package_name" + fi + else + echo "指定的ACE环境 $chosen_env 不可用" + echo "OMG-IT-GOES-WRONG" + exit 1 + fi + + else + # 未指定ACE环境和--native,使用自动安装逻辑(先主机再ACE) + echo "自动选择安装方式" + auto_try_install "$DEBPATH" + install_success=$? + fi + + post_install_cleanup "$install_success" "$DEBPATH" "$package_name" +} + +# 执行主函数 +main_install "$@" diff --git a/tool/ssinstall b/tool/ssinstall index c1c5547..5437e31 100755 --- a/tool/ssinstall +++ b/tool/ssinstall @@ -1,83 +1,170 @@ #!/bin/bash -SPARK_DOWNLOAD_SERVER_URL="https://d.spark-app.store/" -SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL="d.spark-app.store" -source /opt/durapps/spark-store/bin/bashimport/transhell.amber +# 初始化常量和全局变量 +readonly SPARK_DOWNLOAD_SERVER_URL="https://d.spark-app.store/" +readonly SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL="d.spark-app.store" +# ACE环境配置 - 修改此数组即可添加或删除支持的环境——记得修改 store-helper 里的 uninstaller check-is-installed 和 ss-launcher +readonly ACE_ENVIRONMENTS=( + "bookworm-run:amber-ce-bookworm" + "trixie-run:amber-ce-trixie" + "deepin23-run:amber-ce-deepin23" + "sid-run:amber-ce-sid" +) +readonly ACE_ENVIRONMENTS_FOR_AUTOINSTALL=( + "bookworm-run:amber-ce-bookworm" + "trixie-run:amber-ce-trixie" +) +function get_current_user() { + # 优先通过 who 命令获取用户 + local user + user=$(who | awk '{print $1}' | head -n 1 2>/dev/null) -load_transhell_debug -export DEBIAN_FRONTEND=noninteractive + # 如果 who 无输出,则通过 loginctl 获取 + if [[ -z "$user" ]]; then + user=$(loginctl list-sessions --no-legend 2>/dev/null | awk '{print $3}' | head -n 1) + fi -trap 'unlock_file $DEBPATH' EXIT -case $(arch) in - x86_64) - STORE_URL="store" - ;; - aarch64) - STORE_URL="aarch64-store" - ;; - loongarch64) - STORE_URL="loong64-store" - STORE_LIST_URL="-loong64" - ;; -esac - -echo "Spark Store Install script. 星火商店安装脚本" - -function pkexec_as_current_user() { - local user=$(who | awk '{print $1}' | head -n 1) - local uid=$(id -u "$user") - sudo -u "$user" DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/"$uid"/bus pkexec "$@" + # 返回最终结果(可能为空) + echo "${user}" } -function create_desktop_file() { - local user=$(who | awk '{print $1}' | head -n 1) - if [ -e $(sudo -u "$user" xdg-user-dir)/.config/spark-union/spark-store/ssshell-config-do-not-create-desktop ];then - echo "It is configured that do not create desktop file. Give up" - else - exec_create_desktop_file - fi -} -function exec_create_desktop_file() { - local user=$(who | awk '{print $1}' | head -n 1) - for desktop_file_path in $(dpkg -L "$package_name" |grep /usr/share/applications/ | awk '/\.desktop$/ {print}'); do - if [ "$(cat $desktop_file_path | grep NoDisplay=true)" = "" ];then - echo $desktop_file_path is checked and will be installed to desktop - sudo -u "$user" cp "$desktop_file_path" "$(sudo -u "$user" xdg-user-dir DESKTOP)/" - fi - done - for desktop_file_path in $(dpkg -L "$package_name" |grep /opt/apps/$package_name/entries/applications | awk '/\.desktop$/ {print}'); do - if [ "$(cat $desktop_file_path | grep NoDisplay=true)" = "" ];then - echo $desktop_file_path is checked and will be installed to desktop - chmod +x $desktop_file_path - sudo -u "$user" cp "$desktop_file_path" "$(sudo -u "$user" xdg-user-dir DESKTOP)/" - fi - done - - -} - function zenity() { - local user=$(who | awk '{print $1}' | head -n 1) + local user=$(get_current_user) local uid=$(id -u "$user") sudo -u "$user" DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/"$uid"/bus zenity "$@" } -function hash_check() { - if [ ! -e "/var/lib/aptss/lists/${SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL}_${STORE_URL}_Packages" ] && \ - [ ! -e "/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" ] && \ - [ ! -e "/var/lib/aptss/lists/mirrors.sdu.edu.cn_spark-store_${STORE_URL}_Packages" ]; then - echo "接收星火仓库软件信息中..." - aptss ssupdate - fi +# 全局变量初始化(位于 parse_args 前) +ACE_PARAMS=() + +# 生成ACE环境参数帮助信息 +function generate_ace_help() { + local help_text="" + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + local ace_param="--${ace_entry#*:}" + help_text+=" $ace_param 使用${ace_entry%%:*} ACE容器安装\n" + done + echo -e "$help_text" +} +source /opt/durapps/spark-store/bin/bashimport/transhell.amber +# 脚本工作变量 +DELETE_AFTER_INSTALL="0" +DEBPATH="" +FORCE_ACE_ENV="" +FORCE_NATIVE="0" +NO_CREATE_DESKTOP="0" +FORCE_CREATE_DESKTOP="0" + +# 加载翻译和调试 +load_transhell_debug +export DEBIAN_FRONTEND=noninteractive +# 根据架构设置仓库URL +case $(arch) in + x86_64) STORE_URL="store" ;; + aarch64) STORE_URL="aarch64-store" ;; + loongarch64) STORE_URL="loong64-store" ;; +esac +# 帮助函数 +function show_help() { + echo "Spark Store Install script. 星火商店安装脚本" + echo "用法: $0 [选项] " + echo "选项:" + echo " -h, --help 显示帮助信息" + echo " --delete-after-install 安装成功后删除软件包" + echo " --no-create-desktop-entry 不创建桌面快捷方式" + echo " --force-create-desktop-entry 强制创建桌面快捷方式" + echo "$(generate_ace_help)" + echo " --native 只在主机安装,不使用ACE容器" +} +# 参数解析 +function parse_args() { + while [ $# -gt 0 ]; do + case "$1" in + -h|--help) + show_help + exit 0 + ;; + --delete-after-install) + DELETE_AFTER_INSTALL="1" + shift + ;; + --native) + FORCE_NATIVE="1" + shift + ;; + --no-create-desktop-entry) + NO_CREATE_DESKTOP="1" + shift + ;; + --force-create-desktop-entry) + FORCE_CREATE_DESKTOP="1" + shift + ;; + *) + # 检查是否为ACE环境参数 + local is_ace_param=0 + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + local ace_param="--${ace_entry#*:}" + if [ "$1" = "$ace_param" ]; then + # 将ACE环境命令名加入数组 + ACE_PARAMS+=("${ace_entry%%:*}") + is_ace_param=1 + shift + break + fi + done + + # 如果不是ACE环境参数,则视为DEB路径 + if [ "$is_ace_param" -eq 0 ]; then + DEBPATH="$1" + shift + fi + ;; + esac + done +} + + +# 验证当前用户 +function validate_user() { + if [ "$(id -u)" != "0" ]; then + echo "${TRANSHELL_CONTENT_PLEASE_RUN_AS_ROOT}" + echo "OMG-IT-GOES-WRONG" + exit 1 + fi +} + +# 验证文件存在或尝试下载 +function validate_or_download_file() { + if [ ! -f "$1" ]; then + echo "${TRANSHELL_CONTENT_FILE_NOT_EXIST},Trying to redownload" + aptss update + FILEPATH=$(dirname "$1") + FILENAME=$(basename "$1") + PACKAGE_NAME=$(echo "$FILENAME" | sed -r 's/^([^_]+)_.*$/\1/') + VERSION=$(echo "$FILENAME" | sed -r 's/^[^_]+_([^_]+)_.*$/\1/') + pushd "${FILEPATH}" >/dev/null || exit 1 + aptss download "${PACKAGE_NAME}" + popd >/dev/null || exit 1 + + if [ ! -f "$1" ]; then + echo "OMG-IT-GOES-WRONG" + exit 1 + fi + fi +} + +# 哈希校验 +function hash_check() { + local PACKAGES_DATA_PATH="" + + # 检查可能的仓库位置 if [ -e "/var/lib/aptss/lists/${SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL}_${STORE_URL}_Packages" ]; then PACKAGES_DATA_PATH="/var/lib/aptss/lists/${SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL}_${STORE_URL}_Packages" - echo "星火仓库的Packages位置为 $PACKAGES_DATA_PATH,是星火域名仓库配置" elif [ -e "/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" ]; then PACKAGES_DATA_PATH="/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" - echo "星火仓库的Packages位置为 $PACKAGES_DATA_PATH,是d域名单目录仓库配置" else PACKAGES_DATA_PATH="/var/lib/aptss/lists/mirrors.sdu.edu.cn_spark-store-repository_${STORE_URL}_Packages" - echo "星火仓库的Packages位置为 $PACKAGES_DATA_PATH,是SDU镜像仓库配置" fi echo "正在运行包验证..." @@ -85,31 +172,19 @@ function hash_check() { DEB_SHA512SUM=$(sha512sum "$1" | cut -d ' ' -f 1) unset IS_SHA512SUM_CHECKED - IS_SHA512SUM_CHECKED=$(cat "$PACKAGES_DATA_PATH" | grep "$DEB_SHA512SUM") + IS_SHA512SUM_CHECKED=$(grep -F "$DEB_SHA512SUM" "$PACKAGES_DATA_PATH") } -function lock_file(){ -chattr +i "$1" -} - -function unlock_file(){ -chattr -i "$1" -} - -function ensure_aptss_exist(){ - - if command -v aptss &>/dev/null; then - aptss update - else +# 确保aptss存在 +function ensure_aptss_exist() { + if ! command -v aptss &>/dev/null; then local deb_file="/tmp/spark-store-console-in-container_latest_all.deb" - # Download package if ! wget -O "$deb_file" "https://amber-ce-resource.spark-app.store/store/depends/spark-store-console-in-container_latest_all.deb"; then echo "下载 .deb 安装包失败" >&2 return 1 fi - # Install package if ! apt install -y "$deb_file"; then echo "安装 .deb 包失败" >&2 rm -f "$deb_file" @@ -117,7 +192,6 @@ function ensure_aptss_exist(){ fi rm -f "$deb_file" - # Verify installation if ! command -v aptss &>/dev/null; then echo "成功安装但未找到 aptss 命令" >&2 return 1 @@ -125,162 +199,334 @@ function ensure_aptss_exist(){ fi } export -f ensure_aptss_exist -#################################### -if [ $# -eq 0 ]; then - echo "没有接收到参数,退出" - echo "用法:$0 deb路径" - echo "OMG-IT-GOES-WRONG" - exit -fi - - - -if [ "$(id -u)" != "0" ]; then - echo "${TRANSHELL_CONTENT_PLEASE_RUN_AS_ROOT}" - echo "OMG-IT-GOES-WRONG" - exit 1 -fi - -if [ ! -f "$1" ]; then - echo "${TRANSHELL_CONTENT_FILE_NOT_EXIST},Trying to redownload" - FILEPATH=$(dirname "$1") - FILENAME=$(basename "$1") - PACKAGE_NAME=$(echo "$FILENAME" | sed -r 's/^([^_]+)_.*$/\1/') - VERSION=$(echo "$FILENAME" | sed -r 's/^[^_]+_([^_]+)_.*$/\1/') - pushd ${FILEPATH} - aptss download ${PACKAGE_NAME} - popd - if [ ! -f "$1" ]; then - echo "OMG-IT-GOES-WRONG" - exit 1 - else - DEBPATH=$(realpath "$1") +# 确保ACE环境存在 +function ensure_ace_env() { + local ace_env_pkg="${1}" + + if ! dpkg -l "$ace_env_pkg" &>/dev/null; then + echo "ACE环境$ace_env_pkg未安装,正在尝试安装..." + zenity --info --text="首次使用$ace_env_pkg环境,重启或注销桌面后才能在启动器中展示,不影响应用启动。安装将在后台继续。" --title="ACE环境安装" & + if ! aptss install -y "$ace_env_pkg"; then + echo "安装$ace_env_pkg失败" + return 1 + fi fi + return 0 +} +export user=$(who | awk '{print $1}' | head -n 1) +# 在桌面创建快捷方式 +function create_desktop_file() { + # 如果明确要求不要创建或明确要创建,则跳过配置文件检查 + if [ "$NO_CREATE_DESKTOP" -eq 1 ]; then + echo "根据参数要求,跳过创建桌面快捷方式" + return + fi + + if [ "$FORCE_CREATE_DESKTOP" -eq 0 ]; then + if [ -e "$(sudo -u "$user" xdg-user-dir)/.config/spark-union/spark-store/ssshell-config-do-not-create-desktop" ]; then + echo "根据配置要求,跳过创建桌面快捷方式" + return + fi + fi + + exec_create_desktop_file +} +export CURRENT_USER_DIR_DESKTOP=$(sudo -u "$user" xdg-user-dir DESKTOP) +function exec_create_desktop_file() { + local desktop_files=() + + # 收集所有桌面文件 + desktop_files+=($(dpkg -L "$package_name" | grep '/usr/share/applications/.*\.desktop$')) + desktop_files+=($(dpkg -L "$package_name" | grep '/opt/apps/'"$package_name"'/entries/applications/.*\.desktop$')) + + for desktop_file_path in "${desktop_files[@]}"; do + if [ "$FORCE_CREATE_DESKTOP" -eq 1 ] || [ -z "$(grep 'NoDisplay=true' "$desktop_file_path")" ]; then + echo "$desktop_file_path is checked and will be installed to desktop" + chmod +x "$desktop_file_path" + sudo -u "$user" cp "$desktop_file_path" "${CURRENT_USER_DIR_DESKTOP}" + fi + done +} +export -f exec_create_desktop_file + +# 在ACE环境中创建桌面快捷方式 +function create_desktop_in_ace() { + local ace_cmd="$1" + local package_name="$2" + + # 如果明确要求不要创建,则直接返回 + if [ "$NO_CREATE_DESKTOP" -eq 1 ]; then + echo "根据参数要求,跳过在ACE中创建桌面快捷方式" + return 0 + fi + + # 如果是强制创建,或者没有配置禁止创建 + if [ "$FORCE_CREATE_DESKTOP" -eq 1 ] || ! $ace_cmd "[ -e ~/.config/spark-union/spark-store/ssshell-config-do-not-create-desktop ]"; then + echo "在ACE环境中创建桌面快捷方式..." + export -f exec_create_desktop_file + export package_name + export FORCE_CREATE_DESKTOP + $ace_cmd "exec_create_desktop_file" else - DEBPATH=$(realpath "$1") -fi + echo "根据ACE环境中的配置,跳过创建桌面快捷方式" + fi +} -lock_file "$DEBPATH" +# 在指定ACE环境中安装 +function install_in_ace_env() { + local ace_cmd="$1" + local deb_path="$2" + local ace_env_pkg="${3#*:}" + + if [ "$IS_ACE_ENV" != "" ] || command -v termux-chroot; then + echo "无法在ACE/termux/小小电脑中安装ACE包" + return 1 + fi + if ! ensure_ace_env "$ace_env_pkg"; then + return 1 + fi + + echo "----------------------------------------" + echo "正在尝试使用 $ace_cmd 环境安装..." + echo "----------------------------------------" + $ace_cmd "ensure_aptss_exist" -hash_check "$DEBPATH" + # 首先尝试dry-run测试 + if ! $ace_cmd "aptss install --dry-run '$deb_path'"; then + echo "初始dry-run测试失败,尝试更新后重试..." + $ace_cmd "aptss update" + if ! $ace_cmd "aptss install --dry-run '$deb_path'"; then + echo "dry-run测试仍然失败,放弃安装" + echo "OMG_IT_GOES_WRONG" + return 1 + fi + fi + + # dry-run成功后执行实际安装 + $ace_cmd "aptss install store.spark-app.app-runtime-base --no-install-recommends -yfq" + if $ace_cmd "dpkg -i '$deb_path' || aptss install '$deb_path' -yfq"; then + return 0 + else + return 1 + fi +} -if [ -z "$IS_SHA512SUM_CHECKED" ]; then - echo "尝试更新仓库信息重新校验" - aptss ssupdate - hash_check "$DEBPATH" - if [ -z "$IS_SHA512SUM_CHECKED" ]; then - echo -e "$TRANSHELL_CONTENT_HASH_CHECK_FAILED" - zenity --info --icon-name=spark-store --height 270 --width 500 --text "$TRANSHELL_CONTENT_HASH_CHECK_FAILED" - echo "OMG-IT-GOES-WRONG" - exit 1 - fi -fi +# 在主机安装 +function install_in_host() { + local deb_path="$1" + + # 首先尝试dry-run测试 + if ! aptss install --dry-run "$deb_path"; then + echo "初始dry-run测试失败,尝试更新后重试..." + aptss update + if ! aptss install --dry-run "$deb_path"; then + echo "dry-run测试仍然失败,放弃安装" + return 1 + fi + fi + + # dry-run成功后执行实际安装 + if dpkg -i "$deb_path" || aptss install "$deb_path" -yfq; then + return 0 + else + return 1 + fi +} -if [ ! -z "$IS_SHA512SUM_CHECKED" ]; then - echo "校验成功,开始安装" - echo "----------------------------------------------------------------------------------" -package_name=$(dpkg-deb -f "$DEBPATH" Package) -echo "Package name is $package_name" -try_run_output=$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh test-install-app "$DEBPATH") -try_run_ret="$?" -# 安装失败后进行 aptss 刷新,随后尝试在主机安装 -if [ "$try_run_ret" -ne 0 ]; then - aptss update - try_run_output=$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh test-install-app "$DEBPATH") - try_run_ret="$?" -fi - -if [ "$try_run_ret" -ne 0 ]; then ## 若安装检测仍然失败 - if [[ "$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" - ) - - success=false - recommendation_msg="" - # 收集所有推荐信息 - for ace_entry in "${ace_commands_order[@]}"; do - recommendation_msg+="您可安装 ${ace_entry%%:*} 兼容环境后重试: ${ace_entry#*:}\n" - done - - # 按顺序尝试每个ACE环境 - for ace_entry in "${ace_commands_order[@]}"; do - ace_cmd=${ace_entry%%:*} - if command -v "$ace_cmd" >/dev/null 2>&1; then - echo "----------------------------------------" - echo "正在尝试使用 $ace_cmd 环境安装..." - echo "----------------------------------------" - - # 在ACE环境中执行安装检测 - $ace_cmd ensure_aptss_exist - try_run_output=$($ace_cmd aptss install --dry-run "$DEBPATH" 2>&1) - try_run_ret="$?" - - # 如果首次检测失败则更新后重试 - if [ "$try_run_ret" -ne 0 ]; then - $ace_cmd aptss update - try_run_output=$($ace_cmd aptss install --dry-run "$DEBPATH" 2>&1) - try_run_ret="$?" - fi - - # 最终检测结果处理 - if [ "$try_run_ret" -eq 0 ]; then - echo "----------------------------------------" - echo "在 $ace_cmd 环境中预检成功,开始安装..." - echo "----------------------------------------" - $ace_cmd 'dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf' - success=true - break # 跳出循环 - else - echo "----------------------------------------" - echo "在 $ace_cmd 环境中安装预检失败,错误信息:" - echo -e "${try_run_output}" - echo "----------------------------------------" +# 自动尝试在各种环境中安装 +function auto_try_install() { + local deb_path="$1" + + # 首先尝试在主机安装 + if install_in_host "$deb_path"; then + create_desktop_file + return 0 + fi + + # 如果主机安装失败,并非在ACE内运行且不在强制本地模式,尝试ACE环境 + if [ "$FORCE_NATIVE" -eq 0 ] && [ "$IS_ACE_ENV" = "" ] && ! command -v termux-chroot; then + for ace_entry in "${ACE_ENVIRONMENTS_FOR_AUTOINSTALL[@]}"; do + local ace_cmd=${ace_entry%%:*} + local ace_env_pkg=${ace_entry#*:} + + # 确保ACE环境存在 + if ensure_ace_env "$ace_env_pkg"; then + if install_in_ace_env "$ace_cmd" "$deb_path" "$ace_env_pkg"; then + # 在ACE环境中创建桌面快捷方式 + create_desktop_in_ace "$ace_cmd" "$package_name" + return 0 fi fi done - - if ! $success; then - echo "OMG-IT-GOES-WRONG" - echo -e "${try_run_output}" - echo -e "所有ACE环境尝试失败,推荐安装以下任一兼容环境:\n${recommendation_msg}" - exit "$try_run_ret" + fi + + return 1 +} +# 清理安装后的文件 +function post_install_cleanup() { + local success=$1 + local deb_path="$2" + local package_name="$3" + + if [ "$success" -eq 0 ] && [ "$DELETE_AFTER_INSTALL" -eq "1" ]; then + # 检查是否安装在主机 + if [ "$FORCE_NATIVE" -eq 1 ] || [ -n "$FORCE_ACE_ENV" ]; then + if [ "$FORCE_NATIVE" -eq 1 ]; then + if dpkg -s "$package_name" >/dev/null 2>&1; then + echo "软件包已在主机安装:$package_name" + create_desktop_file + unlock_file "$deb_path" + rm "$deb_path" + echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" + else + echo "软件包未在主机安装:$package_name" + echo "安装异常!抛出错误" + echo "OMG-IT-GOES-WRONG" + exit 1 + fi + else + # ACE环境中安装的情况,不检查主机dpkg数据库 + echo "软件包已在ACE环境安装:$package_name" + unlock_file "$deb_path" + rm "$deb_path" + echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" + fi + else + # 自动模式下,如果ACE安装成功也会走到这里 + echo "软件包已安装:$package_name" + unlock_file "$deb_path" + rm "$deb_path" + echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" + fi + else + echo "${TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB}" + if [ "$FORCE_NATIVE" -eq 1 ] && ! dpkg -s "$package_name" >/dev/null 2>&1; then + echo "软件包未在主机安装:$package_name" + echo "安装异常!抛出错误" + echo "OMG-IT-GOES-WRONG" + exit 1 + elif [ -n "$FORCE_ACE_ENV" ] && ! command -v "$FORCE_ACE_ENV" >/dev/null 2>&1; then + echo "指定的ACE环境不可用" + echo "OMG-IT-GOES-WRONG" + exit 1 fi - else # 已经在ACE环境中仍失败直接退出 - echo "OMG-IT-GOES-WRONG" - echo -e "${try_run_output}" - exit "$try_run_ret" fi -else ## 如果主机安装检测成功 - dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf -fi +} -### 退出阶段保持不变 ### -if [ "$?" = "0" ] && [ "$2" = "--delete-after-install" ]; then - if dpkg -s "$package_name" >/dev/null 2>&1; then - echo "软件包已安装:$package_name" - create_desktop_file - unlock_file $DEBPATH - rm "$DEBPATH" - echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" - else - echo "软件包未安装:$package_name" - echo "安装异常!抛出错误" - echo "OMG-IT-GOES-WRONG" +# 文件锁定/解锁函数 +function lock_file() { + chattr +i "$1" +} + +function unlock_file() { + if [ -e "$1" ];then + chattr -i "$1" fi -else - echo "${TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB}" - if dpkg -s "$package_name" >/dev/null 2>&1; then - echo "软件包已安装:$package_name" - create_desktop_file - else - echo "软件包未安装:$package_name" - echo "安装异常!抛出错误" +} + +# 主安装流程 +function main_install() { + parse_args "$@" + + if [ -z "$DEBPATH" ]; then + echo "没有接收到参数,退出" + show_help echo "OMG-IT-GOES-WRONG" + exit 1 fi -fi -fi + + # 设置退出时的文件解锁 + trap 'unlock_file $DEBPATH' EXIT + validate_user + validate_or_download_file "$DEBPATH" + + DEBPATH=$(realpath "$DEBPATH") + lock_file "$DEBPATH" + + hash_check "$DEBPATH" + + if [ -z "$IS_SHA512SUM_CHECKED" ]; then + echo "尝试更新仓库信息重新校验" + aptss ssupdate + hash_check "$DEBPATH" + if [ -z "$IS_SHA512SUM_CHECKED" ]; then + echo -e "$TRANSHELL_CONTENT_HASH_CHECK_FAILED" + zenity --info --icon-name=spark-store --height 270 --width 500 --text "$TRANSHELL_CONTENT_HASH_CHECK_FAILED" + echo "OMG-IT-GOES-WRONG" + exit 1 + fi + fi + + package_name=$(dpkg-deb -f "$DEBPATH" Package) + local install_success=1 + if [ "$FORCE_NATIVE" -eq 1 ] || [ "$IS_ACE_ENV" = "1" ]; then + # 优先使用主机安装,忽略所有ACE参数 + echo "忽略ACE,使用主机安装 $package_name" + install_in_host "$DEBPATH" + install_success=$? + # 安装成功后在主机创建桌面快捷方式 + if [ "$install_success" -eq 0 ]; then + create_desktop_file + fi + + elif [ ${#ACE_PARAMS[@]} -gt 0 ] && [ "$IS_ACE_ENV" != "" ]; then + # 用户指定了一个或多个ACE环境,且未要求原生安装 + echo "使用ACE环境安装,已指定环境: ${ACE_PARAMS[*]}" + + # 查找第一个已安装的ACE环境 + chosen_env="" + for env_cmd in "${ACE_PARAMS[@]}"; do + if command -v "$env_cmd" >/dev/null 2>&1; then + chosen_env="$env_cmd" + break + fi + done + # 如果没有安装任何环境,则使用第一个指定的环境 + if [ -z "$chosen_env" ]; then + chosen_env="${ACE_PARAMS[0]}" + echo "未发现已安装的ACE环境,准备安装 $chosen_env..." + # 查找对应的ACE环境软件包名 + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + if [ "${ace_entry%%:*}" = "$chosen_env" ]; then + ace_pkg="${ace_entry#*:}" + break + fi + done + # 安装ACE环境(示例使用aptss工具,可根据实际情况调整) + aptss install "$ace_pkg" -y + fi + + # 再次确认ACE环境命令是否可用 + if command -v "$chosen_env" >/dev/null 2>&1; then + # 查找软件包名(仅首次查找即可) + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + if [ "${ace_entry%%:*}" = "$chosen_env" ]; then + ace_pkg="${ace_entry#*:}" + break + fi + done + echo "在 ACE 环境 $chosen_env 中安装 $package_name" + install_in_ace_env "$chosen_env" "$DEBPATH" "$ace_pkg" + install_success=$? + if [ "$install_success" -eq 0 ]; then + create_desktop_in_ace "$chosen_env" "$package_name" + fi + else + echo "指定的ACE环境 $chosen_env 不可用" + echo "OMG-IT-GOES-WRONG" + exit 1 + fi + + else + # 未指定ACE环境和--native,使用自动安装逻辑(先主机再ACE) + echo "自动选择安装方式" + auto_try_install "$DEBPATH" + install_success=$? + fi + + post_install_cleanup "$install_success" "$DEBPATH" "$package_name" +} + +# 执行主函数 +main_install "$@" diff --git a/tool/store-helper/check-is-installed b/tool/store-helper/check-is-installed index ef4d447..3251815 100755 --- a/tool/store-helper/check-is-installed +++ b/tool/store-helper/check-is-installed @@ -1,10 +1,45 @@ #!/bin/bash -dpkg -l | grep "^ii $1 " > /dev/null +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" ]] && command -v bookworm-run > /dev/null;then - echo "Try ACE Bookworm" - bookworm-run dpkg -l | grep "^ii $1 " > /dev/null - RET="$?" - exit "$RET" -fi +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 "----------------------------------------" + echo "正在检查 $ace_cmd 环境的安装..." + echo "----------------------------------------" + + # 在ACE环境中执行安装检测 + $ace_cmd dpkg -l | grep "^ii $1 " > /dev/null + try_run_ret="$?" + + + # 最终检测结果处理 + if [ "$try_run_ret" -eq 0 ]; then + echo "----------------------------------------" + echo "在 $ace_cmd 环境中找到了安装" + echo "----------------------------------------" + exit $try_run_ret + else + echo "----------------------------------------" + echo "在 $ace_cmd 环境中未能找到安装,继续查找" + echo "----------------------------------------" + fi + fi + done + echo "----------------------------------------" + echo "所有已安装的 ACE 环境中未能找到安装,退出" + echo "----------------------------------------" + exit "$RET" + fi +## 如果在ACE环境中或者未出错 exit "$RET" diff --git a/tool/store-helper/ss-launcher b/tool/store-helper/ss-launcher index a635ff8..0460eae 100755 --- a/tool/store-helper/ss-launcher +++ b/tool/store-helper/ss-launcher @@ -1,142 +1,164 @@ #!/bin/bash -# ===== Log ===== -# log.info xxx -# log.warn xxx -# log.info xxx -# log.debug xxx -# 带颜色的echo -function log.color_output() { - local color=$1 - shift 1 - echo >&2 -e "\033[${color}m$@\033[0m" - return 0 +# ===== ACE环境配置 ===== +readonly ACE_ENVIRONMENTS=( + "bookworm-run:amber-ce-bookworm" + "trixie-run:amber-ce-trixie" + "deepin23-run:amber-ce-deepin23" + "sid-run:amber-ce-sid" +) + +# ===== 日志和函数 ===== +[ -f /opt/durapps/spark-store/bin/bashimport/log.amber ] && \ + source /opt/durapps/spark-store/bin/bashimport/log.amber || { + log.info() { echo "INFO: $*"; } + log.warn() { echo "WARN: $*"; } + log.error() { echo "ERROR: $*"; } + log.debug() { echo "DEBUG: $*"; } } -# Log is named without prefix "utils." for convenience -# Usage: log.log ...content -function log.log() { - if [[ $# < 2 ]]; then - return -1 - fi - - local level=$1 - shift 1 - - case $level in - error) log.color_output "0;31" "[ERROR] $@" ;; - warn) log.color_output "1;33" "[WARN] $@" ;; - info) log.color_output "1;37" "[INFO] $@" ;; - debug) log.color_output "1;30" "[DEBUG] $@" ;; - esac - - return 0 -} - -function log.error() { log.log "error" "$@"; } -function log.warn() { log.log "warn" $@; } -function log.info() { log.log "info" $@; } -function log.debug() { log.log "debug" $@; } - - -function scan_desktop_file_log(){ -unset desktop_file_path -package_name=$1 - for desktop_file_path in $(dpkg -L "$1" |grep /usr/share/applications/ | awk '/\.desktop$/ {print}'); do - if [ "$(cat $desktop_file_path | grep NoDisplay=true)" = "" ];then - log.info "$desktop_file_path is found." - fi - done - for desktop_file_path in $(dpkg -L "$1" |grep /opt/apps/$package_name/entries/applications/ | awk '/\.desktop$/ {print}'); do - if [ "$(cat $desktop_file_path | grep NoDisplay=true)" = "" ];then - log.info "$desktop_file_path is found." - fi - done - - -} - -function scan_desktop_file(){ +# ===== 功能函数 ===== +function scan_desktop_file_log() { unset desktop_file_path - local result="" - for desktop_file_path in $(dpkg -L "$1" | grep /usr/share/applications/ | awk '/\.desktop$/ {print}'); do - if [ "$(grep NoDisplay=true $desktop_file_path)" = "" ]; then - result+="$desktop_file_path," - fi - done - for desktop_file_path in $(dpkg -L "$1" | grep /opt/apps/$package_name/entries/applications | awk '/\.desktop$/ {print}'); do - if [ "$(grep NoDisplay=true $desktop_file_path)" = "" ]; then - result+="$desktop_file_path," - fi - done - # 去掉最后一个逗号 - if [ -n "$result" ]; then - result=${result%,} - fi - echo "$result" + local package_name=$1 + # 标准desktop文件检测 + while IFS= read -r path; do + [ -z "$(grep 'NoDisplay=true' "$path")" ] && { + log.info "Found valid desktop file: $path" + export desktop_file_path="$path" + return 0 + } + done < <(dpkg -L "$package_name" 2>/dev/null | grep -E '/usr/share/applications/.*\.desktop$|/opt/apps/.*/entries/applications/.*\.desktop$') + + # 深度环境特殊处理 + while IFS= read -r path; do + [ -z "$(grep 'NoDisplay=true' "$path")" ] && { + log.info "Found deepin desktop file: $path" + export desktop_file_path="$path" + return 0 + } + done < <(find /opt/apps/$package_name -path '*/entries/applications/*.desktop' 2>/dev/null) + return 1 } -function launch_app(){ - - # 检查是否传入了路径参数 - if [ -z "$1" ]; then - log.error "请传入文件路径作为参数" - exit 1 - fi - - DESKTOP_FILE_PATH=$1 - - if [[ $DESKTOP_FILE_PATH == file://* ]]; then - # 如果是,移除 'file://' 部分并输出结果 - DESKTOP_FILE_PATH="${DESKTOP_FILE_PATH#file://}" - fi - - # 获取文件内容中第一个 Exec= 后的命令 - exec_command=$(grep -m 1 -oP "(?<=Exec=).*" "$DESKTOP_FILE_PATH") - - # 删除 exec_command 中最后的 % 及其后面的内容 - exec_command="${exec_command%\%*}" - - # 打印提取的命令 - log.info "Command is $exec_command" - - # 在默认终端执行命令 - bash -c "$exec_command" +function scan_desktop_file() { + local package_name=$1 result="" + # 标准结果收集 + while IFS= read -r path; do + [ -z "$(grep 'NoDisplay=true' "$path")" ] && result+="$path," + done < <(dpkg -L "$package_name" 2>/dev/null | grep -E '/usr/share/applications/.*\.desktop$|/opt/apps/.*/entries/applications/.*\.desktop$') + + # 深度环境补充扫描 + while IFS= read -r path; do + [ -z "$(grep 'NoDisplay=true' "$path")" ] && result+="$path," + done < <(find /opt/apps/$package_name -path '*/entries/applications/*.desktop' 2>/dev/null) + + echo "${result%,}" } -if [ "$#" -lt 2 ];then -log.info "Usage: $0 check/launch/list/start packagename/desktop-file" -exit -1 -fi +function launch_app() { + local DESKTOP_FILE_PATH="${1#file://}" + # 提取并净化Exec命令 + exec_command=$(grep -m1 '^Exec=' "$DESKTOP_FILE_PATH" | cut -d= -f2- | sed 's/%.//g') + [ -z "$exec_command" ] && return 1 + [ ! -z "$IS_ACE_ENV" ] && HOST_PREFIX="host-spawn" + exec_command="${HOST_PREFIX} $exec_command" + log.info "Launching: $exec_command" + ${SHELL:-bash} -c " $exec_command" & +} -if [ "$1" = "check" ];then +# 导出函数以便在ACE环境中使用 +export -f launch_app scan_desktop_file scan_desktop_file_log log.info log.warn log.debug log.error -scan_desktop_file_log "$2" - if [ "$desktop_file_path" = "" ];then - log.error "No desktop file found. exit -1" - exit -1 - else - exit 0 - fi +# ===== ACE环境执行器 ===== +function ace_runner() { + local action=$1 + local target=$2 + + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + local ace_cmd=${ace_entry%%:*} + local ace_env=${ace_entry#*:} + + if ! command -v "$ace_cmd" >/dev/null; then + log.debug "$ace_cmd not found, skipping..." + continue + fi + + log.info "Attempting in $ace_env environment..." + + case "$action" in + check) + if "$ace_cmd" scan_desktop_file_log "$target"; then + log.info "Found desktop file in $ace_env" + return 0 + fi + ;; + list) + local result + if result=$("$ace_cmd" scan_desktop_file "$target"); then + echo "$result" + return 0 + fi + ;; + launch|start) +"$ace_cmd" scan_desktop_file_log "$target" + if desktop_path=$("$ace_cmd" scan_desktop_file_log "$target"); then + log.info "Launching from $ace_env..." + "$ace_cmd" launch_app $("$ace_cmd" scan_desktop_file "$target") + return 0 + fi + ;; + esac + + log.debug "Attempt in $ace_env failed" + done + + return 1 +} -elif [ "$1" = "list" ];then -scan_desktop_file "$2" - if [ "$desktop_file_path" = "" ];then - exit -1 - else - exit 0 - fi -elif [ "$1" = "launch" ];then -scan_desktop_file_log "$2" - if [ "$desktop_file_path" = "" ];then - log.error "No desktop file found. exit -1" - exit -1 - fi +# ===== 主逻辑 ===== +[ $# -lt 2 ] && { + log.error "Usage: $0 {check|launch|list|start} package_name/desktop_file" + exit 1 +} +case $1 in +check) + # 当前环境检查 + if scan_desktop_file_log "$2"; then + exit 0 + else + # 非ACE环境下执行ACE环境扫描 + [ -z "$IS_ACE_ENV" ] && ace_runner check "$2" + exit $? + fi + ;; -launch_app "${desktop_file_path}" +list) + # 当前环境列表 + if result=$(scan_desktop_file "$2"); then + echo "$result" + exit 0 + else + # 非ACE环境下执行ACE环境扫描 + [ -z "$IS_ACE_ENV" ] && ace_runner list "$2" + exit $? + fi + ;; -elif [ "$1" = "start" ];then -launch_app "${desktop_file_path}" -fi +launch|start) + # 当前环境启动 + if scan_desktop_file_log "$2" && launch_app "$desktop_file_path"; then + exit 0 + else + # 非ACE环境下通过ACE环境启动 + [ -z "$IS_ACE_ENV" ] && ace_runner launch "$2" + exit $? + fi + ;; +*) + log.error "Invalid command: $1" + exit 2 + ;; +esac diff --git a/tool/store-helper/uninstaller b/tool/store-helper/uninstaller index 86cee57..ea10feb 100755 --- a/tool/store-helper/uninstaller +++ b/tool/store-helper/uninstaller @@ -1,14 +1,190 @@ #!/bin/bash -dpkg -l | grep "^ii $1 " > /dev/null -RET="$?" -if [[ "$RET" == "0" ]] ;then -apt autopurge $1 -y +# ===== ACE环境配置 ===== + +readonly ACE_ENVIRONMENTS=( + "bookworm-run:amber-ce-bookworm" + "trixie-run:amber-ce-trixie" + "deepin23-run:amber-ce-deepin23" + "sid-run:amber-ce-sid" +) +# 生成ACE环境参数帮助信息 +function generate_ace_help() { + local help_text="" + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + local ace_param="--${ace_entry#*:}" + help_text+=" $ace_param 使用${ace_entry%%:*} ACE容器卸载\n" + done + echo -e "$help_text" +} +# 帮助函数 +function show_help() { + echo "Spark Store Uninstall script. 星火商店卸载脚本" + echo "用法: $0 [选项] 包名" + echo "选项:" + echo " -h, --help 显示帮助信息" + echo " --delete-after-install 安装成功后删除软件包" + echo " --no-create-desktop-entry 不创建桌面快捷方式" + echo " --force-create-desktop-entry 强制创建桌面快捷方式" + echo "$(generate_ace_help)" + echo " --native 只在主机卸载,不使用ACE容器" +} + + +# 参数解析 +function parse_args() { + while [ $# -gt 0 ]; do + case "$1" in + -h|--help) + show_help + exit 0 + ;; + --delete-after-install) + DELETE_AFTER_INSTALL="1" + shift + ;; + --native) + FORCE_NATIVE="1" + shift + ;; + --no-create-desktop-entry) + NO_CREATE_DESKTOP="1" + shift + ;; + --force-create-desktop-entry) + FORCE_CREATE_DESKTOP="1" + shift + ;; + *) + # 检查是否为ACE环境参数 + local is_ace_param=0 + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + local ace_param="--${ace_entry#*:}" + if [ "$1" = "$ace_param" ]; then + # 将ACE环境命令名加入数组 + ACE_PARAMS+=("${ace_entry%%:*}") + is_ace_param=1 + shift + break + fi + done + + # 如果不是ACE环境参数,则视为包名 + if [ "$is_ace_param" -eq 0 ]; then + PACKAGE_NAME="$1" + shift + fi + ;; + esac + done +} + +# ===== 日志和函数 ===== +[ -f /opt/durapps/spark-store/bin/bashimport/log.amber ] && \ + source /opt/durapps/spark-store/bin/bashimport/log.amber || { + log.info() { echo "INFO: $*"; } + log.warn() { echo "WARN: $*"; } + log.error() { echo "ERROR: $*"; } + log.debug() { echo "DEBUG: $*"; } +} + +# 初始化变量 +FORCE_NATIVE=0 +ACE_PARAMS=() +PACKAGE_NAME="" +uninstall_success=0 + +# 解析参数 +parse_args "$@" + +if [ -z "$PACKAGE_NAME" ]; then + log.error "请指定要卸载的包名" + exit 1 +fi + +# 尝试在本地卸载 +try_native_uninstall() { + if [ "$FORCE_NATIVE" -eq 1 ] || [ ${#ACE_PARAMS[@]} -eq 0 ]; then + echo "----------------------------------------" + echo "正在检查本地环境中的安装..." + echo "----------------------------------------" + + dpkg -s "$PACKAGE_NAME" > /dev/null + RET="$?" + if [[ "$RET" == "0" ]]; then + echo "----------------------------------------" + echo "在本地环境中找到了安装" + echo "----------------------------------------" + apt autopurge "$PACKAGE_NAME" -y + uninstall_success=1 + return 0 + else + echo "----------------------------------------" + echo "在本地环境中未能找到安装" + echo "----------------------------------------" + fi + fi + return 1 +} + +# 尝试在ACE环境中卸载 +try_ace_uninstall() { + local ace_cmd="$1" + if command -v "$ace_cmd" >/dev/null 2>&1; then + echo "----------------------------------------" + echo "正在检查 $ace_cmd 环境的安装..." + echo "----------------------------------------" + + $ace_cmd dpkg -l | grep "^ii $PACKAGE_NAME " > /dev/null + try_run_ret="$?" + + if [ "$try_run_ret" -eq 0 ]; then + echo "----------------------------------------" + echo "在 $ace_cmd 环境中找到了安装" + echo "----------------------------------------" + $ace_cmd apt autopurge "$PACKAGE_NAME" -y + uninstall_success=1 + return 0 + else + echo "----------------------------------------" + echo "在 $ace_cmd 环境中未能找到安装" + echo "----------------------------------------" + fi + fi + return 1 +} + +# 主卸载逻辑 +if [ $FORCE_NATIVE -eq 1 ] && [ ${#ACE_PARAMS[@]} -eq 0 ]; then + # 只有 --native 参数时,只尝试本地卸载 + try_native_uninstall || exit $? +elif [ $FORCE_NATIVE -eq 0 ] && [ ${#ACE_PARAMS[@]} -gt 0 ]; then + # 只有 ACE 参数时,只尝试指定的 ACE 环境卸载 + for ace_param in "${ACE_PARAMS[@]}"; do + try_ace_uninstall "$ace_param" + done +elif [ $FORCE_NATIVE -eq 1 ] && [ ${#ACE_PARAMS[@]} -gt 0 ]; then + # 同时有 --native 和 ACE 参数时,先尝试本地卸载,再尝试 ACE 环境卸载 + try_native_uninstall + for ace_param in "${ACE_PARAMS[@]}"; do + try_ace_uninstall "$ace_param" + done else - -if command -v bookworm-run > /dev/null;then - echo "Try ACE Bookworm" - bookworm-run apt autopurge $1 -y - + # 无参数时,先尝试本地卸载,再尝试所有 ACE 环境卸载 + try_native_uninstall + + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + ace_cmd=${ace_entry%%:*} + if command -v "$ace_cmd" >/dev/null 2>&1; then + try_ace_uninstall "$ace_cmd" + fi + done fi + +if [ $uninstall_success -eq 0 ]; then + echo "----------------------------------------" + echo "在所有指定的环境中未能找到安装,退出" + echo "----------------------------------------" + exit 1 fi -exit "$RET" + +exit 0 diff --git a/tool/update-upgrade/ss-do-upgrade-worker.sh b/tool/update-upgrade/ss-do-upgrade-worker.sh index 75c0f89..4f2a8e6 100755 --- a/tool/update-upgrade/ss-do-upgrade-worker.sh +++ b/tool/update-upgrade/ss-do-upgrade-worker.sh @@ -37,6 +37,8 @@ if [ "$(id -u)" != "0" ] ; then fi aptss install "${@:2}" --only-upgrade 2>&1 | tee /tmp/spark-store-app-upgrade-log.txt + sed -i '1i--------------------------------------------------------------' /tmp/spark-store-app-upgrade-log.txt + sed -i '1i更新失败可能是由于系统版本过低,您可先【卸载】此应用后再在商店【安装】此应用来尝试修复此问题,商店会在安装时尝试自动解决问题。若仍无法解决,请按照指引进行反馈' /tmp/spark-store-app-upgrade-log.txt chmod 777 /tmp/spark-store-app-upgrade-log.txt IS_UPGRADE_ERROR=`cat /tmp/spark-store-app-upgrade-log.txt | grep "Package manager quit with exit code."` echo "$IS_UPGRADE_ERROR" > /tmp/spark-store-app-upgrade-status.txt diff --git a/tool/update-upgrade/ss-do-upgrade.sh b/tool/update-upgrade/ss-do-upgrade.sh index 474a777..dee6321 100755 --- a/tool/update-upgrade/ss-do-upgrade.sh +++ b/tool/update-upgrade/ss-do-upgrade.sh @@ -146,7 +146,7 @@ for PKG_UPGRADE in $PKG_UPGRADE_LIST; do update_transhell # 启动升级任务 - (yes | pkexec ${HERE}/ss-do-upgrade-worker.sh upgrade-app $PKG_UPGRADE -y 2>&1 > /dev/null ) & + (yes n | pkexec ${HERE}/ss-do-upgrade-worker.sh upgrade-app $PKG_UPGRADE -yfq 2>&1 > /dev/null ) & # 计算进度百分比 progress=$(( count * 100 / total - 1)) diff --git a/translations/spark-store_en.ts b/translations/spark-store_en.ts index 9932a13..e14fb49 100644 --- a/translations/spark-store_en.ts +++ b/translations/spark-store_en.ts @@ -24,68 +24,63 @@ - - + + + <html><head/><body><p>Capable to deepin 23</p></body></html> + + + + + <html><head/><body><p>This app is developed by community user,we give this tag to honor those who contribute to the Linux Ecology</p></body></html> - - + + <html><head/><body><p>Capable to UOS home 20</p></body></html> - - + + <html><head/><body><p>A deepin-wine2 app. Spark Store will automatically configure the wine kit for you.</p></body></html> - - <html><head/><body><p><img src=":/tags/dwine2-small.png"/></p></body></html> - - - - - + + <html><head/><body><p>This is a DTK5 app,which means it would have better effect on Deepin Desktop Environment</p></body></html> - - - <html><head/><body><p>Capable to deepin 20</p></body></html> - - - - - + + <html><head/><body><p>An Appimage to deb app.</p></body></html> - + Share Spk share link - + APP Feedback - + Introduction - + Description - + Screen capture @@ -94,94 +89,55 @@ - + Download and Install - - <html><head/><body><p><img src=":/tags/community.svg" height=30 width=30 /></p></body></html> - - - - - + + <html><head/><body><p>Capable to Ubuntu 22.04</p></body></html> - - <html><head/><body><p><img src=":/tags/ubuntu.png" width=30 height=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/uos-authorize.svg" height=30 width=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/logo_icon.svg" height=30 width=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/deepin.svg" height=30 width=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/a2d.png"height=30 width=30 /></p></body></html> - - - - - + + <html><head/><body><p>A Wine app.Spark Store will automatically configure the wine kit for you</p></body></html> - - <html><head/><body><p><img src=":/tags/dwine5.svg" height=30 width=30 /></p></body></html> - - - - + + <html><head/><body><p>Capable to Debian Stable</p></body></html> - - <html><head/><body><p><img src=":/tags/debian.svg" height="30" width="30"/></p></body></html> - - - - + Update - + Contributor - + Pkgname - + Author - + Size - + Website @@ -260,18 +216,18 @@ - + Spark Store - + Uninstall succeeded - + The URL has been copied to the clipboard @@ -359,9 +315,9 @@ - - + + Spark Store @@ -372,32 +328,32 @@ - + Installation complete. - - + + Finish - + Retry - - - - - Error happened in dpkg progress , please check the install info or try to reinstall. - - + Error happened in dpkg progress , please check the install info or try to reinstall. + + + + + + dpkg progress had been aborted, please check the install info or try to reinstall. diff --git a/translations/spark-store_es.ts b/translations/spark-store_es.ts index bc77882..d41cefe 100644 --- a/translations/spark-store_es.ts +++ b/translations/spark-store_es.ts @@ -24,68 +24,63 @@ Número de descargas - - + + + <html><head/><body><p>Capable to deepin 23</p></body></html> + <html><head/><body><p>Capaz de deepin 20</p></body></html> {23<?} + + + + <html><head/><body><p>This app is developed by community user,we give this tag to honor those who contribute to the Linux Ecology</p></body></html> <html><head/><body><p>Esta aplicación fue desarrollada por usuarios de la comunidad y la Etiquetamos en honor a aquellos que contribuyeron a la ecología de linux.</p></body></html> - - + + <html><head/><body><p>Capable to UOS home 20</p></body></html> <html><head/><body><p>Capaz de UOS home 20</p></body></html> - - + + <html><head/><body><p>A deepin-wine2 app. Spark Store will automatically configure the wine kit for you.</p></body></html> <html><head/><body><p>A deepin-wine2 app. La tienda Spark le configurará automáticamente un traje de vino.</p></body></html> - - <html><head/><body><p><img src=":/tags/dwine2-small.png"/></p></body></html> - <html><head/><body><p><img src=":/tags/dwine2-small.png"/></p></body></html> - - - - + + <html><head/><body><p>This is a DTK5 app,which means it would have better effect on Deepin Desktop Environment</p></body></html> <html><head/><body><p>Esta es una aplicación dtk5, lo que significa que funcionará mejor en un entorno de escritorio profundo.</p></body></html> - - - <html><head/><body><p>Capable to deepin 20</p></body></html> - <html><head/><body><p>Capaz de deepin 20</p></body></html> - - - - + + <html><head/><body><p>An Appimage to deb app.</p></body></html> <html><head/><body><p>Appimage de la aplicación deb.</p></body></html> - + Share Comunión - + APP Feedback Comentarios de la app - + Introduction Introducción - + Description Descripción - + Screen capture Captura de pantalla @@ -94,94 +89,55 @@ - + Download and Install Descargar e instalar - - <html><head/><body><p><img src=":/tags/community.svg" height=30 width=30 /></p></body></html> - - - - - + + <html><head/><body><p>Capable to Ubuntu 22.04</p></body></html> <html><head/><body><p>Capaz de Ubuntu 22.04</p></body></html> - - <html><head/><body><p><img src=":/tags/ubuntu.png" width=30 height=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/uos-authorize.svg" height=30 width=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/logo_icon.svg" height=30 width=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/deepin.svg" height=30 width=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/a2d.png"height=30 width=30 /></p></body></html> - - - - - + + <html><head/><body><p>A Wine app.Spark Store will automatically configure the wine kit for you</p></body></html> <html><head/><body><p>La aplicación wine. Spark Store configurará automáticamente el kit Wine para usted</p></body></html> - - <html><head/><body><p><img src=":/tags/dwine5.svg" height=30 width=30 /></p></body></html> - - - - + + <html><head/><body><p>Capable to Debian Stable</p></body></html> - - <html><head/><body><p><img src=":/tags/debian.svg" height="30" width="30"/></p></body></html> - - - - + Update Modernizar - + Contributor Contribuyentes - + Pkgname Nombre del embalaje - + Author Autor - + Size Tamaño - + Website Sitio web @@ -260,18 +216,18 @@ - + Spark Store SPARK Store - + Uninstall succeeded Desinstalación exitosa - + The URL has been copied to the clipboard La URL ha sido copiada al portapapeles @@ -359,9 +315,9 @@ Descarga completada. - - + + Spark Store SPARK Store @@ -372,32 +328,32 @@ Se está instalando - + Installation complete. La instalación está completa. - - + + Finish Completado - + Retry Reinterpretar - - - - - Error happened in dpkg progress , please check the install info or try to reinstall. - Se produjo un error durante el proceso dpkg, verifique la información de instalación o intente reinstalar. - + Error happened in dpkg progress , please check the install info or try to reinstall. + Se produjo un error durante el proceso dpkg, verifique la información de instalación o intente reinstalar. + + + + + dpkg progress had been aborted, please check the install info or try to reinstall. El proceso de DPKG ha sido interrumpido, compruebe la información de instalación o intente reinstalar. diff --git a/translations/spark-store_fr.ts b/translations/spark-store_fr.ts index 1e62451..5c08721 100644 --- a/translations/spark-store_fr.ts +++ b/translations/spark-store_fr.ts @@ -24,68 +24,63 @@ Nombre de téléchargements - - + + + <html><head/><body><p>Capable to deepin 23</p></body></html> + <html><head/><body><p>Capable de la deepin 20</p></body></html> {23<?} + + + + <html><head/><body><p>This app is developed by community user,we give this tag to honor those who contribute to the Linux Ecology</p></body></html> <html><head/><body><p>Cette application a été développée par des utilisateurs de la communauté et nous avons donné ce label à ceux qui ont contribué à l'écologie de Linux</p></body></html> - - + + <html><head/><body><p>Capable to UOS home 20</p></body></html> <html><head/><body><p>Capable de la home UOS 20</p></body></html> - - + + <html><head/><body><p>A deepin-wine2 app. Spark Store will automatically configure the wine kit for you.</p></body></html> <html><head/><body><p>Une application deepin-wine2. Le Spark Store configure automatiquement votre pack de vins.</p></body></html> - - <html><head/><body><p><img src=":/tags/dwine2-small.png"/></p></body></html> - <html><head/><body><p><img src=":/tags/dwine2-small.png"/></p></body></html> - - - - + + <html><head/><body><p>This is a DTK5 app,which means it would have better effect on Deepin Desktop Environment</p></body></html> <html><head/><body><p>C'est une application dtk5, ce qui signifie qu'elle fonctionnera mieux dans un environnement de bureau profond.</p></body></html> - - - <html><head/><body><p>Capable to deepin 20</p></body></html> - <html><head/><body><p>Capable de la deepin 20</p></body></html> - - - - + + <html><head/><body><p>An Appimage to deb app.</p></body></html> <html><head/><body><p>Appimage pour l'application DEB</p></body></html> - + Share Au total - + APP Feedback App feedback - + Introduction Présentation - + Description Description - + Screen capture Captures d'écran @@ -94,94 +89,55 @@ - + Download and Install Télécharger et installer - - <html><head/><body><p><img src=":/tags/community.svg" height=30 width=30 /></p></body></html> - - - - - + + <html><head/><body><p>Capable to Ubuntu 22.04</p></body></html> <html><head/><body><p>Capable de la Ubuntu 22.04</p></body></html> - - <html><head/><body><p><img src=":/tags/ubuntu.png" width=30 height=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/uos-authorize.svg" height=30 width=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/logo_icon.svg" height=30 width=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/deepin.svg" height=30 width=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/a2d.png"height=30 width=30 /></p></body></html> - - - - - + + <html><head/><body><p>A Wine app.Spark Store will automatically configure the wine kit for you</p></body></html> <html><head/><body><p>L'application wine. Spark Store configure automatiquement le kit Wine pour vous</p></body></html> - - <html><head/><body><p><img src=":/tags/dwine5.svg" height=30 width=30 /></p></body></html> - - - - + + <html><head/><body><p>Capable to Debian Stable</p></body></html> - - <html><head/><body><p><img src=":/tags/debian.svg" height="30" width="30"/></p></body></html> - - - - + Update Moderniser - + Contributor Contributeurs - + Pkgname Nom de l'emballage - + Author Auteur - + Size Taille - + Website Site Web @@ -260,18 +216,18 @@ - + Spark Store Le Spark store - + Uninstall succeeded Désinstallation réussie - + The URL has been copied to the clipboard L'URL a été copiée dans le presse - papiers @@ -359,9 +315,9 @@ Le téléchargement est terminé. - - + + Spark Store Le Spark store @@ -372,32 +328,32 @@ Installation en cours - + Installation complete. L'installation est terminée. - - + + Finish Terminé - + Retry Essayez à nouveau - - - - - Error happened in dpkg progress , please check the install info or try to reinstall. - Une erreur s'est produite dans le processus dpkg, vérifiez les informations d'installation ou essayez de réinstaller. - + Error happened in dpkg progress , please check the install info or try to reinstall. + Une erreur s'est produite dans le processus dpkg, vérifiez les informations d'installation ou essayez de réinstaller. + + + + + dpkg progress had been aborted, please check the install info or try to reinstall. La progression de DPKG a été interrompue, veuillez vérifier les informations d’installation ou essayer de réinstaller. diff --git a/translations/spark-store_zh_CN.ts b/translations/spark-store_zh_CN.ts index 3765f74..fae7ea2 100644 --- a/translations/spark-store_zh_CN.ts +++ b/translations/spark-store_zh_CN.ts @@ -24,63 +24,58 @@ 下载量 - - + + + <html><head/><body><p>Capable to deepin 23</p></body></html> + <html><head/><body><p>支持deepin 20</p></body></html> {23<?} + + + + <html><head/><body><p>This app is developed by community user,we give this tag to honor those who contribute to the Linux Ecology</p></body></html> <html><head/><body><p>这款应用是社区开发者开发的,我们为社区开发者颁发这款勋章以表彰他们对Linux生态的贡献</p></body></html> - - + + <html><head/><body><p>Capable to UOS home 20</p></body></html> <html><head/><body><p>支持UOS家庭版 20</p></body></html> - - + + <html><head/><body><p>A deepin-wine2 app. Spark Store will automatically configure the wine kit for you.</p></body></html> 这是一款 deepin-wine2 应用。星火商店会为你自动配置wine环境 - - <html><head/><body><p><img src=":/tags/dwine2-small.png"/></p></body></html> - - - - - + + <html><head/><body><p>This is a DTK5 app,which means it would have better effect on Deepin Desktop Environment</p></body></html> <html><head/><body><p>这是一款DTK5应用,请使用深度桌面环境来获得最完美的体验</p></body></html> - - - <html><head/><body><p>Capable to deepin 20</p></body></html> - <html><head/><body><p>支持deepin 20</p></body></html> - - - - + + <html><head/><body><p>An Appimage to deb app.</p></body></html> <html><head/><body><p>这是一款Appimage转制应用.</p></body></html> - + Share Spk分享链接 - + APP Feedback 应用反馈 - + Description 描述 - + Screen capture 屏幕截图 @@ -89,99 +84,60 @@ - + Download and Install 下载并安装 - - <html><head/><body><p><img src=":/tags/community.svg" height=30 width=30 /></p></body></html> - - - - - + + <html><head/><body><p>Capable to Ubuntu 22.04</p></body></html> <html><head/><body><p>支持Ubuntu 22.04</p></body></html> - - <html><head/><body><p><img src=":/tags/ubuntu.png" width=30 height=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/uos-authorize.svg" height=30 width=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/logo_icon.svg" height=30 width=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/deepin.svg" height=30 width=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/a2d.png"height=30 width=30 /></p></body></html> - - - - - + + <html><head/><body><p>A Wine app.Spark Store will automatically configure the wine kit for you</p></body></html> 这是一款 Wine 应用。星火商店会为你自动配置wine环境 - - <html><head/><body><p><img src=":/tags/dwine5.svg" height=30 width=30 /></p></body></html> - - - - + + <html><head/><body><p>Capable to Debian Stable</p></body></html> <html><head/><body><p>支持Debian Stable</p></body></html> - - <html><head/><body><p><img src=":/tags/debian.svg" height="30" width="30"/></p></body></html> - - - - + Introduction 介绍 - + Update 更新时间 - + Contributor 投稿用户 - + Pkgname 软件包名 - + Author 软件作者 - + Size 软件大小 - + Website 软件官网 @@ -260,18 +216,18 @@ 当前应用不支持或未在您的平台上测试过,安装后可能会出现问题 - + Spark Store 星火应用商店 - + Uninstall succeeded 卸载成功 - + The URL has been copied to the clipboard 链接已复制到剪贴板 @@ -359,9 +315,9 @@ 下载完成. - - + + Spark Store 星火应用商店 @@ -372,32 +328,32 @@ 正在安装 - + Installation complete. 安装完成. - - + + Finish 完成 - + Retry 重试 - - - - - Error happened in dpkg progress , please check the install info or try to reinstall. - 安装出现错误,请检查安装详情或尝试重新安装。 - + Error happened in dpkg progress , please check the install info or try to reinstall. + 安装出现错误,请检查安装详情或尝试重新安装。 + + + + + dpkg progress had been aborted, please check the install info or try to reinstall. 安装被中止,请检查安装详情或尝试重新安装。 diff --git a/translations/spark-store_zh_TW.ts b/translations/spark-store_zh_TW.ts index ddc6048..6d84644 100644 --- a/translations/spark-store_zh_TW.ts +++ b/translations/spark-store_zh_TW.ts @@ -24,63 +24,58 @@ 下載次數 - - + + + <html><head/><body><p>Capable to deepin 23</p></body></html> + <html><head/><body><p>支持deepin 20</p></body></html> {23<?} + + + + <html><head/><body><p>This app is developed by community user,we give this tag to honor those who contribute to the Linux Ecology</p></body></html> <html><head/><body><p>这款应用是社区开发者开发的,我们为社区开发者颁发这款勋章以表彰他们对Linux生态的贡献</p></body></html> - - + + <html><head/><body><p>Capable to UOS home 20</p></body></html> <html><head/><body><p>支持UOS家庭版 20</p></body></html> - - + + <html><head/><body><p>A deepin-wine2 app. Spark Store will automatically configure the wine kit for you.</p></body></html> 这是一款 deepin-wine2 应用。星火商店会为你自动配置wine环境 - - <html><head/><body><p><img src=":/tags/dwine2-small.png"/></p></body></html> - - - - - + + <html><head/><body><p>This is a DTK5 app,which means it would have better effect on Deepin Desktop Environment</p></body></html> <html><head/><body><p>这是一款DTK5应用,请使用深度桌面环境来获得最完美的体验</p></body></html> - - - <html><head/><body><p>Capable to deepin 20</p></body></html> - <html><head/><body><p>支持deepin 20</p></body></html> - - - - + + <html><head/><body><p>An Appimage to deb app.</p></body></html> <html><head/><body><p>这是一款Appimage转制应用.</p></body></html> - + Share Spk共享链接 - + APP Feedback 軟件錯誤回報 - + Description 軟體詳細資料 - + Screen capture 軟體演示 @@ -89,99 +84,60 @@ - + Download and Install 下載並安裝 - - <html><head/><body><p><img src=":/tags/community.svg" height=30 width=30 /></p></body></html> - - - - - + + <html><head/><body><p>Capable to Ubuntu 22.04</p></body></html> <html><head/><body><p>支持Ubuntu 22.04</p></body></html> - - <html><head/><body><p><img src=":/tags/ubuntu.png" width=30 height=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/uos-authorize.svg" height=30 width=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/logo_icon.svg" height=30 width=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/deepin.svg" height=30 width=30 /></p></body></html> - - - - - <html><head/><body><p><img src=":/tags/a2d.png"height=30 width=30 /></p></body></html> - - - - - + + <html><head/><body><p>A Wine app.Spark Store will automatically configure the wine kit for you</p></body></html> 这是一款 Wine 应用。星火商店会为你自动配置wine环境 - - <html><head/><body><p><img src=":/tags/dwine5.svg" height=30 width=30 /></p></body></html> - - - - + + <html><head/><body><p>Capable to Debian Stable</p></body></html> - - <html><head/><body><p><img src=":/tags/debian.svg" height="30" width="30"/></p></body></html> - - - - + Introduction 軟體介紹 - + Update 更新时间 - + Contributor 投稿用户 - + Pkgname 软件包名 - + Author 软件作者 - + Size 软件大小 - + Website 软件官网 @@ -260,18 +216,18 @@ - + Spark Store 星火应用商店 - + Uninstall succeeded 卸载成功 - + The URL has been copied to the clipboard 链接已复制到剪贴板 @@ -359,9 +315,9 @@ 下載完成. - - + + Spark Store 星火应用商店 @@ -372,32 +328,32 @@ 正在安裝 - + Installation complete. 安裝完成. - - + + Finish 完成 - + Retry 重试 - - - - - Error happened in dpkg progress , please check the install info or try to reinstall. - 安裝出現錯誤,請檢查安裝詳情或嘗試重新安裝。 - + Error happened in dpkg progress , please check the install info or try to reinstall. + 安裝出現錯誤,請檢查安裝詳情或嘗試重新安裝。 + + + + + dpkg progress had been aborted, please check the install info or try to reinstall. 安裝被中止,請檢查安裝詳情或嘗試重新安裝。