diff --git a/DOCS/.keep b/DOCS/.keep new file mode 100644 index 0000000..e69de29 diff --git a/DOCS/code-analyze.md b/DOCS/code-analyze.md new file mode 100644 index 0000000..4bad78a --- /dev/null +++ b/DOCS/code-analyze.md @@ -0,0 +1,328 @@ + +#### 说明 + +当前服务器线路列表(项目中包含): + +``` +https://d.store.deepinos.org.cn/ +https://store.deepinos.org.cn/ +``` + + + + + + +# 星火应用商店文档 + +# 目录结构 +几个目录结构 +``` +/ +/icons 图标文件夹 +/tags 首页图标 +/tras 多语言翻译 +``` + +主要的文件分析 +```js +spark-store.pro Qt工程配置文件 +ssinstall 调用包安装器的脚本 +icons.qrc 图标资源文件 +main.cpp 入口文件 +widget.h widget.cpp widget.ui 主要窗口控件 +downloadlist.h downloadlist.cpp downloadlist.ui 单个软件的下载安装展示控件 +progressload.h progressload.cpp 网页加载显示? 得在deepin上编译运行才能搞清楚 +workerthreads.h workerthreads.cpp 应用信息加载线程 +image_show.h image_show.cpp 应用页面截图预览控件 +big_image.h big_image.cpp 大图查看控件 +``` + +# 使用的开源库及第三方工具 +* GDebi 一个 Ubuntu 软件中心的轻量级替代品 https://linux.cn/article-4982-1.html +* libnotify 系统通知 https://developer.gnome.org/libnotify/unstable/ + + +# 源码分析 +## 应用的组成部分 +左侧应用分类菜单 +主窗口的下拉菜单 +应用列表页面 +应用详情页面 +应用首页,有几个链接跳转 +商店设置页面 +下载列表页面 + +## 应用初始化,及主控件加载 +初始化 `DApplication` 进入事件循环。 +设置关于我们弹窗 `DAboutDialog`。 +主控件 Widget 根据不同屏幕大小自适应。 +首页打开webview页面,如果传入了`spk://`参数,会打开应用详情页。 +```cpp +// main.cpp +QString arg1=argv[1]; +if(arg1.left(6)=="spk://"){ + w.openUrl(QUrl(argv[1])); +} + +// widget.cpp +void Widget::openUrl(QUrl u) +{ + QString app=serverUrl + "store"+u.path()+"/app.json"; + ui->webEngineView->setUrl(app); // 会触发 webEngineView 的 +} + +``` +## Tags处理方式 + +**Tags处理方式** +```cpp +// widget.cpp +QString tags=json["Tags"].toString(); //Read the Tags + QStringList tagList=tags.split(";"); + for (int i=0;itag_community->show();//Tags icon shows like this + if(tagList[i]=="ubuntu") + ui->tag_ubuntu->show(); + if(tagList[i]=="deepin") + ui->tag_deepin->show(); + if(tagList[i]=="uos") + ui->tag_uos->show(); + if(tagList[i]=="dtk5") + ui->tag_dtk5->show(); + if(tagList[i]=="dwine2") + ui->tag_dwine2->show(); + if(tagList[i]=="dwine5") + ui->tag_dwine5->show(); + if(tagList[i]=="a2d") + ui->tag_a2d->show(); + } +``` + +**Widget 初始化** +```cpp +void Widget::initConfig() +{ + ... + // 读取服务器URL并初始化菜单项的链接 + QSettings readConfig(QDir::homePath()+"/.config/spark-store/config.ini",QSettings::IniFormat); + if(readConfig.value("server/choose").toString()!=""){ + ui->comboBox_server->setCurrentText(readConfig.value("server/choose").toString()); + appinfoLoadThread.setServer(serverUrl=readConfig.value("server/choose").toString()); + }else { + appinfoLoadThread.setServer(serverUrl="http://sucdn.jerrywang.top/"); // 默认URL + } + configCanSave=true; // 防止触发保存配置信号 + menuUrl[0]=serverUrl + "store/#/"; // 首页 + // 下面是各个应用分类页面,直接加载的webview的 + // 每个连接对应一个左侧的菜单项,在构造函数用连接到 chooseLeftMenu 槽函数 + menuUrl[1]=serverUrl + "store/#/network"; + ... + menuUrl[12]=serverUrl + "store/#/others"; + ... + ui->webfoot->hide(); + + //初始化首页 + ui->webEngineView->setUrl(menuUrl[0]); +} +/** + * 菜单切换逻辑 + * + */ +void Widget::chooseLeftMenu(int index) +{ + nowMenu=index; + updateUI(); + left_list[index]->setStyleSheet("color:#FFFFFF;background-color:"+main_color.name()+";border-radius:8;border:0px"); + // index <=12 加载某个分类的应用列表的webviejw + // index == 13 加载下载列表页面 + if(index<=12){ + if(themeIsDark){ + darkurl = 夜间模式的URL + ui->webEngineView->setUrl(darkurl); + }else { + ui->webEngineView->setUrl(menuUrl[index]); + } + ui->stackedWidget->setCurrentIndex(0); + }else if (index==13) { + ui->stackedWidget->setCurrentIndex(1); + } +} +``` + +## 应用下载安装卸载分析 +**应用详情页面加载** +```cpp +/** + * 加载单个应用的信息 + */ +void Widget::on_webEngineView_urlChanged(const QUrl &arg1) +{ + //分析出服务器中的分类名称 + ... + //如果是app.json就打开详情页 + if(arg1.path().right(8)=="app.json"){ + ... + // 读取相应的应用信息 + appinfoLoadThread.requestInterruption(); + appinfoLoadThread.wait(100); + appinfoLoadThread.setUrl(arg1); + appinfoLoadThread.start(); + } +} +// 设置详情页的APP信息 +SpkAppInfoLoaderThread::requestSetAppInformation() -> Widget::sltAppinfoDetails() +// 设置详情页的APP图标 +SpkAppInfoLoaderThread::finishedIconLoad() -> Widget::sltAppinfoIcon() +// 设置详情页的APP截图 +SpkAppInfoLoaderThread::finishedScreenshotLoad() -> Widget::sltAppinfoScreenshot() + +// 下载APP详情信息线程 +void SpkAppInfoLoaderThread::run() +{ + QProcess get_json; + get_json.start("curl -o app.json " + targetUrl.toString()); + QFile app_json("app.json"); + 读取 app.json 里的信息,提取应用名、描述、图标、截图 + 处理完毕后发射相应的信号 +} +``` + + +**应用下载** +Widget::on_pushButton_download_clicked() 是点击下载的安装方法。 +最终使用的是 `QNetwrokAccessManager` 进行GET请求获取数据写入文件。 +```cpp +void Widget::on_pushButton_download_clicked() +{ + if(!isBusy){ + file = new QFile(fileName); + ... + nowDownload+=1; + startRequest(urList.at(nowDownload-1)); // 进行链接请求 + } +} +void Widget::startRequest(QUrl url) +{ + reply = manager->get(QNetworkRequest(url)); + // 请求响应完成,关闭文件,清理下载队列 + connect(reply,SIGNAL(finished()),this,SLOT(httpFinished())); + // 接收应用下载数据 + connect(reply,SIGNAL(readyRead()),this,SLOT(httpReadyRead())); + // 更新应用下载进度 + connect(reply,SIGNAL(downloadProgress(qint64,qint64)),this,SLOT(updateDataReadProgress(qint64,qint64))); +} +``` + +使用 QSettings 来读取配置,更换服务源 +```cpp +void Widget::on_comboBox_server_currentIndexChanged(const QString &arg1) +{ + appinfoLoadThread.setServer(arg1); // 服务器信息更新 + if(configCanSave){ + ui->label_setting1->show(); + QSettings *setConfig=new QSettings(QDir::homePath()+"/.config/spark-store/config.ini",QSettings::IniFormat); + setConfig->setValue("server/choose",arg1); + } +} +``` +使用 `QProcess` 来调用各种小文件下载、包安装卸载的命令。 + +**应用安装** +```cpp +void Widget::httpFinished() // 完成下载 +{ + ...清理资源 + download_list[nowDownload-1].readyInstall(); + download_list[nowDownload-1].free=true; + if(nowDownloadpushButton_install->setEnabled(true); + ui->pushButton_install->show(); + ui->pushButton_2->hide(); + Widget::sendNotification(tr("Finished downloading %1, awaiting to install").arg(ui->label->text()), 5000, + "/tmp/spark-store/icon_"+QString::number(num).toUtf8()+".png"); +} +void downloadlist::on_pushButton_install_clicked() +{ + //弹出菜单 + menu_install->exec(cursor().pos()); +} +在 downloadlist 构造函数里将三种安装方式的按钮按条件放入了 menu_install 菜单里 +用户点击时,downloadlist::install() 方法 +三种安装方式为: gdebi, dpkg, deepin-deb-installer +void downloadlist::install(int t) +{ + QtConcurrent::run([=](){ + QProcess installer; + installer.start("pkexec gdebi -n /tmp/spark-store/"+ui->label_filename->text().toUtf8()); + installer.start("pkexec ssinstall /tmp/spark-store/"+ui->label_filename->text().toUtf8()); + installer.start("deepin-deb-installer /tmp/spark-store/"+ui->label_filename->text().toUtf8()); + }); +} +``` + +**应用卸载** +```cpp +void Widget::on_pushButton_uninstall_clicked() +{ + QtConcurrent::run([=](){ + uninstall.start("pkexec apt purge -y "+pkgName); + }); +} +``` + +**仓库源更新** +```cpp +// 更新源列表 +void Widget::on_pushButton_updateServer_clicked() +{ + QtConcurrent::run([=](){ + ... + QFile::remove(QDir::homePath().toUtf8()+"/.config/spark-store/server.list"); + system("curl -o "+QDir::homePath().toUtf8()+"/.config/spark-store/server.list http://dcstore.shenmo.tech/store/server.list"); + server.open(QDir::homePath().toUtf8()+"/.config/spark-store/server.list",std::ios::in); + ... + while (getline(server,lineTmp)) { + ui->comboBox_server->addItem(QString::fromStdString(lineTmp)); + } + }); +} +// 更新星火商店apt源 +void Widget::on_pushButton_updateApt_clicked() +{ + QtConcurrent::run([=](){ + 读取 comboBox_server 的内容,写入 /tmp/spark-store/sparkstore.list 文件 + 创建bash脚本,内容为将 sparkstore.list 移动到 /etc/apt/sources.list.d/ 目录下 + 使用QProcess 执行命令 pkexec update.sh + }): +} +``` + +## 发送系统通知 +```cpp +#include + +static NotifyNotification *_notify = nullptr; // 初始化 +notify_init(tr("Spark\\ Store").toLocal8Bit()); // 构造函数初始化 +notify_uninit(); // 析构函数调用 + +void Widget::sendNotification(const QString &message, const int msTimeout, const QString &icon) +{ + if(_notify == nullptr) + { + _notify = notify_notification_new(tr("Spark\\ Store").toLocal8Bit(), message.toLocal8Bit(), icon.toLocal8Bit()); + notify_notification_set_timeout(_notify, msTimeout); + } + else + notify_notification_update(_notify, tr("Spark\\ Store").toLocal8Bit(), message.toLocal8Bit(), icon.toLocal8Bit()); + + notify_notification_show(_notify, nullptr); +} +``` diff --git a/DOCS/spk-doc.md b/DOCS/spk-doc.md new file mode 100644 index 0000000..a3c4e6d --- /dev/null +++ b/DOCS/spk-doc.md @@ -0,0 +1,25 @@ +#### 调用参数(spk规则) + +参数只有一个Url,该url应当遵循这种格式:`spk://<任意合法字符>/web分类/包名` + +例如: + +[spk://abcdefg/games/store.spark-app.hmcl](spk://abcdefg/games/store.spark-app.hmcl) + + +可选的web分类: + +| 分类名称 | web分类   | +| -------- | -------------- | +| 网络应用 | network | +| 社交沟通 | chat | +| 音乐欣赏 | music | +| 视频播放 | video | +| 图形图像 | graphics | +| 游戏娱乐 | games | +| 办公学习 | office | +| 阅读翻译 | reading | +| 编程开发 | development | +| 系统工具 | tools | +| 主题美化 | beautify | +| 其他应用 | others | diff --git a/README.en.md b/README.en.md index 478bed6..e2ede1d 100644 --- a/README.en.md +++ b/README.en.md @@ -1,39 +1,73 @@ -

- -

+# Spark App Store +[![star](https://gitee.com/deepin-community-store/spark-store/badge/star.svg?theme=gvp)](https://gitee.com/deepin-community-store/spark-store/stargazers) [![fork](https://gitee.com/deepin-community-store/spark-store/badge/fork.svg?theme=gvp)](https://gitee.com/deepin-community-store/spark-store/members) -
+Spark Store aims to collect Linux apps for the convieniece of Linux new comers -# Spark App Store +The collecting process needs everyone's help -The `Spark App Store` is now designed for Linux! +We set up this APP Store and collect APPs/tools that everyone need widely. Also we pack Windows apps with wine. + +All packages will be shared in our repository for users to get freely. + +Distrobution supported:Deepin 20 ; Ubuntu 22.04 LTS / Ubuntu 20.04 LTS(May stop support in the future) ; UniontechOS Home 21 + +*About OpenKylin and deepin 23* + +The adaptation work is scheduled after their official release. + +You can track our Issue resoving progress here https://gitee.com/deepin-community-store/spark-store/board -
- ---- - -As we all know, there are few Linux applications in our country, wine applications are hard to get, high-quality tools are scattered in various folk forums, unable to form synergy, difficult to improve the ecology -Ecological construction does not need one party to fight alone, but everyone to act, gather sparks, resulting in a prairie fire - -We created this app store, which includes a wide range of software packages we need, a collection of quality widgets, an active adaptation of wine apps, and a repository for everyone to access - -We support: Deepin 20; Ubuntu 20.04LTS; UOS Home 20 - -We’d love to see some of you join us as well, and we’d love to help build the Linux application ecosystem +We hope people who see here can also join our team,development help or submit applications are welcomed +If you want to submit an APP to share with others,Please [Click here](https://upload.deepinos.org/index) ## 🙌 A simple start +If you simply want to install the Spark Store,just enter the [Release] page, find the version you want and install. -If you want to install the `Spark App Store`, open the [Release] page on the right, find the latest version, and select the installation package that works for your current system. +If you are using Debian11/Ubuntu 20.04, you will need extra dependency package. Available [here](https://code.gitlink.org.cn/shenmo7192/spark-store-dependencies/raw/branch/master/spark-store-dependencies-kylin.zip) + +--- +#### Compile and developement + + +For Deepin V20/UOS 21/ Debian 11 + +```shell +sudo apt install git qt5-default debhelper pkg-config qtchooser libqt5core5a libqt5gui5 libqt5widgets5 libqt5network5 libqt5concurrent5 libdtkcore-dev libdtkgui-dev libdtkwidget-dev qttools5-private-dev libnotify-dev qtwebengine5-dev + +``` + +Ubuntu 22.04 +```shell +sudo apt install git qtbase5-dev debhelper pkg-config qtchooser libqt5core5a libqt5gui5 libqt5widgets5 libqt5network5 libqt5concurrent5 libdtkcore-dev libdtkgui-dev libdtkwidget-dev qttools5-private-dev libnotify-dev qtwebengine5-dev + +``` + +Then + +```shell +git clone https://gitee.com/deepin-community-store/spark-store.git +cd spark-store +dpkg-buildpackage +``` -**Watch** project to get updates on the application. +## 🚀 Coorperation +We use Gitee as our code hosting platform. Please click here to contact us. -## 🚀 Collaboration +https://gitee.com/deepin-community-store/spark-store -Many thanks to interested developers or enthusiasts for participating in the Spark App Store project and sharing your insights and ideas. \ No newline at end of file +### Rocket Chat + +https://chat.shenmo.tech/ + +PWA Client: + +spk://store/chat/store.spark-app.feedback + +(Copy and paste to search bar or in browser address bar after installing Spark Store) \ No newline at end of file diff --git a/README.md b/README.md index 51be455..4a452df 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,66 @@ -

- -

- -
- -# 星火应用商店 - -`星火应用商店` 现在为 Linux 设计! - - -
- ---- +# 星火应用商店 +[![star](https://gitee.com/deepin-community-store/spark-store/badge/star.svg?theme=gvp)](https://gitee.com/deepin-community-store/spark-store/stargazers) [![fork](https://gitee.com/deepin-community-store/spark-store/badge/fork.svg?theme=gvp)](https://gitee.com/deepin-community-store/spark-store/members) 众所周知,国内的Linux应用比较少,wine应用难以获取,优质工具分散在民间各大论坛,无法形成合力,难以改善生态 生态构建需要的不是某一方的单打独斗,而是人人行动起来,汇聚星火,产生燎原之势 我们创建了这个应用商店,广泛收录大家需要的软件包,搜集优质小工具,主动适配wine应用,存放到储存库供大家获取 +我们支持:Deepin 20 ; Ubuntu 22.04 LTS / Ubuntu 20.04 LTS(将会逐渐停止支持) ; UOS Home 21 -我们支持:Deepin 20 ; Ubuntu 20.04 LTS ; UOS Home 20 +*关于OpenKylin和deepin 23* + +支持计划将会在对应系统发布正式版之后开始评估和执行 希望看到这里的人也可以加入我们的队伍,开发或者投递应用都很欢迎,共同构建Linux应用生态 +在这里追踪我们的Issue处理情况 https://gitee.com/deepin-community-store/spark-store/board + +如果有想要提交的软件包,请 [在这里投稿](https://upload.deepinos.org/index) + ## 🙌 简单的开始 如果想安装 `星火应用商店` ,请打开右侧的 [Release] 页面,找到最新版本,并选择适用于当前系统的安装包下载。 +如果你在使用 `Debian 11/Ubuntu 20.04`,你需要额外下载[依赖补充包](https://code.gitlink.org.cn/shenmo7192/spark-store-dependencies/raw/branch/master/spark-store-dependencies-kylin.zip) + +--- +#### 编译安装 + + +Deepin V20/UOS 21 系统下, 安装依赖 + +```shell +sudo apt install git qt5-default debhelper pkg-config qtchooser libqt5core5a libqt5gui5 libqt5widgets5 libqt5network5 libqt5concurrent5 libdtkcore-dev libdtkgui-dev libdtkwidget-dev qttools5-private-dev libnotify-dev qtwebengine5-dev fakeroot + +``` + +Ubuntu 22.04 系统下, 安装依赖 +```shell +sudo apt install git qtbase5-dev debhelper pkg-config qtchooser libqt5core5a libqt5gui5 libqt5widgets5 libqt5network5 libqt5concurrent5 libdtkcore-dev libdtkgui-dev libdtkwidget-dev qttools5-private-dev libnotify-dev qtwebengine5-dev + +``` + +然后 +```shell +git clone https://gitee.com/deepin-community-store/spark-store.git +cd spark-store +dpkg-buildpackage +``` + -**Watch** 项目,以获取应用的更新动态。 ## 🚀 协作 -非常感谢有兴趣的开发者或爱好者参与 `星火应用商店` 项目,分享你的见解与思路。 \ No newline at end of file +非常感谢有兴趣的开发者或爱好者参与 `星火应用商店` 项目,分享你的见解与思路。 + +### 交流平台 + +https://chat.shenmo.tech/ + +客户端PWA: + +spk://store/chat/store.spark-app.feedback + +(安装星火商店后在浏览器打开或复制到搜索栏打开) \ No newline at end of file diff --git a/debian/changelog b/debian/changelog index c062988..ede3d6a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,369 @@ -spark-store (3.1.0~pre1) unstable; urgency=medium +spark-store (3.4~test1) stable; urgency=medium - * Initial commit for dpkg-buildpackage scripts + * feat: aptss不再尝试安装apt-fast,转而自带 + * chore: 删除password-check模块 - -- shenmo Wed, 12 Jan 2022 02:00:00 +0800 +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.3.3) stable; urgency=medium + + * feat: 首页链接调用浏览器打开 + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +0spark-store (3.3.3~test5) stable; urgency=medium + + * 修复可能的内存泄漏问题 + * 修复应用搜索为空但仍显示上一次搜索结果的问题 + * 修复动画加载延后的问题 + * 修复统计下载量卡主渲染线程的问题 + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.3.3~test4) stable; urgency=medium + + * Enable i386 arch support by default + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.3.3~test3) stable; urgency=medium + + * Now use ss-apt-fast instead of apt-fast + * 修复:右上角 更新和安装设置 菜单中进入更新列表失效 + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.3.3~test2) stable; urgency=medium + + * bug fix: 更新和检查更新出错时不报错.此更新需要一个推送 + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.3.3~test1) stable; urgency=medium + + * 3.3.3将会是修复大部分bug后的最终版本 + * 图形环境中所有root权限的组件剥离到cli(可用于deepin 23 daily,只保证商店本体正常运作,不处理安装依赖不满足) + * 文案更改:更新检查-->检查更新 + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.3.1~test1) stable; urgency=medium + + * 安装时不再需要联网 + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.3.0.4) stable; urgency=medium + + * 为减轻服务器压力,不再单独更新某一个应用,而是作为整体更新 + + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.3.0.3) stable; urgency=medium + + * 回滚 更新中行为到进度条而不是实时输出 + * 更新应用时显示正在更新哪个应用 + + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.3.0.2) stable; urgency=medium + + * 修复 pkexec未执行 + + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.3.0.1) stable; urgency=medium + + * 修复 检查更新的更新进程未实际运行 + + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.3) stable; urgency=medium + + * 修复 检查更新 未刷新软件源 + * 把检查更新单独拿出作为左列 + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.3~test3) stable; urgency=medium + + * 把检查更新加入免密码 + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.3~test2) stable; urgency=medium + + * 更新检测功能全部更改到zenity + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.3~test1) stable; urgency=medium + + * zenity,选择可更新应用 + * 自动更新检测现在会跳过hold + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.2.4) stable; urgency=medium + + * 修改tag相关的文案内容:wine相关环境已可自动配置了 + * 准备发版 + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.2.4~test4) stable; urgency=medium + + * 现在在商店启动后点击spk链接仍会正常启动 https://gitee.com/deepin-community-store/spark-store/commit/dd6780d636042bf12d77414e6f1552cc7d1ed24c + + + + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.2.4~test3) stable; urgency=medium + + * 发版,合入到master + * 翻译完毕 + * 合入先前的各项改动,为:客户端集成投稿器入口和支持,修复:安装依赖时间较长时错误地返回“安装完毕”结果,现在客户端版本更新时不关闭免密码登录,UOS安装进程合并正常aptss中 + + + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.2.4~test2) stable; urgency=medium + + * 客户端集成投稿器入口和支持 + * 修复:安装依赖时间较长时错误地返回“安装完毕”结果 + + + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.2.4~test1) stable; urgency=medium + + * 客户端更新时不关闭免密码登录 + * UOS合并正常aptss中 + + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.2.3) stable; urgency=medium + + * 客户端异常退出时仍然占用资源问题修复 + * 降低dtk依赖版本,Debian 11 stable可直接安装 + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.2.2) stable; urgency=medium + + * aptss will now refresh the system source before doing install, policy....etc + * 启动客户端GPU加速支持 + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.2.1) stable; urgency=medium + + * 更改刷新系统源的功能 + + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.2) stable; urgency=medium + + * 新增 下载量统计功能 + * 新增 显示下载量 + * 修复 spk链接生成错误 + * 调整 启动时检测商店applist源 + * 新增 applist cdn加速 + * 调整 ssupdate不再更新/etc/aptss下的cache,如要如此,请使用aptss update + * 修复 在更新检测设置中的是否开启自动更新检测设置项的显示不随开启或关闭状态改变 + * 修复 在检测更新时临时降低优先级到100,防止系统中有且版本一致的包被反复来回更新 + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.1.6) stable; urgency=medium + + * 修复部分情况下无法选中正确的镜像源的问题 + * 合入3.1.5以来的各项修改 + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.1.5-5) stable; urgency=medium + + * 从所有镜像源中选取最快镜像源高速下载 + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.1.5-4) stable; urgency=medium + + * 更改ss-apt-fast策略,现在只会在update,ssupdate和没有检测到配置文件的时候更新配置文件 + * 新增ss-apt-fast别名:aptss + * 更新检测服务优化:从分体改为一体 + * aptss 支持自动补全 + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.1.5-3) stable; urgency=medium + + * 包内自带密钥 + + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.1.5-2) stable; urgency=medium + + * 下载软件时跳过获取大小,修复部分软件无法下载的问题 + * 修复 获取key时出错,指定使用http1.1 + + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.1.5-1) stable; urgency=medium + + * 改变更新策略,UOS也下载加速,但是安装不加速 + + + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.1.5) stable; urgency=medium + + * 改变更新策略,现在支持应用在更新时引入新依赖 + * ss-apt-fast现在默认允许降级,以与apt使用体验一致 + + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.1.4-2) stable; urgency=medium + + * 客户端下载使用metalink来支持bt下载加速 + * 修复使用更新和安装设置更新商店本体时出错 + + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.1.4-1) stable; urgency=medium + + * 安装脚本和检测更新脚本检查网络时间超时时间延长至5s + * 修复:ssinstall在没有安装apt-fast的情况下首次安装需要依赖的软件时安装失败 + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.1.4) stable; urgency=medium + + * 发布正式版,同步到官网 + * 修复安装时使用wget的问题 + * 合并3.1.3-1和3.1.3-2的更改 + * 屏蔽了ssinstall之外的安装方式 + * 调整了报错框的形式 + * 修复pkexec下ssinstall不处理依赖 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.1.3-2) stable; urgency=medium + + * 调整 现在与系统更新分开,不再导致更新失败 + * 支持直接更新软件源文件,不再让d.吃全部更新流量 + * ss-apt-fast不再强制root权限 + * 修改ss-apt-fast的策略,现在除了安装,下载和更新都改用apt + * ssinstall 现在也会在不适用ss-apt-fast的时候模拟源了(针对UOS) + + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.1.3-1) stable; urgency=medium + + * 修复 下载提前退出 + * 移除 下载量显示 + + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.1.3) stable; urgency=medium + + * Now uses aria2 to download softwares form all mirrors + * 新增:ssinstall现在会在没有apt-fast的时候自动安装 + * 新增:ss-apt-fast现在会在没有apt-fast的时候自动安装 + * 修改:删除ssinstall中无用的 || dpkg -P $1 + * 新增:ss-apt-fast会先下载云上的conf以确保mirror是最新的 + * 修复:去除wget指令 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + +spark-store (3.1.2) stable; urgency=medium + + * Now let apt-fast method support all mirrors + * Now will download dependencies and upgrade with all mirrors + + -- shenmo Mon, 17 Jan 2022 00:00:00 +0800 + + + + +spark-store (3.1.1) stable; urgency=medium + + * Now will delete the link of policy file after uninstall or upgrade + * Now ss-update-controler will create symbol link instead of hard link + + -- shenmo Mon, 17 Jan 2022 00:00:00 +0800 + + + + +spark-store (3.1.0) stable; urgency=medium + + * Add pkexec policy: ssinstall. Only will be enabled after permitted. + * Modify ssinistall script: Now will ask for password when not run as root + + -- shenmo Mon, 17 Jan 2022 00:00:00 +0800 + + + +spark-store (3.0.3-13) stable; urgency=medium + + * Update the ssinstall script. Now support apt-fast and will temporarily increase the spark store source priority to 500 to make depends install correctly + * Change the style of About Dialog + * Modified depends to avoid Deb installers can not handle "Provides" + + -- shenmo Mon, 17 Jan 2022 00:00:00 +0800 + + + +spark-store (3.0.3-12) stable; urgency=medium + + * Rollback to use DApplication::loadDXcbPlugin() to make titlebar behave normally in ubuntu + * Now can run on Debian 11 + * Now can run on Ubuntu 22.04 + + -- shenmo Mon, 17 Jan 2022 00:00:00 +0800 + + + + +spark-store (3.0.3-11) stable; urgency=medium + + * Now support autoupdate + + -- shenmo Mon, 17 Jan 2022 00:00:00 +0800 + + + + +spark-store (3.0.3-10) stable; urgency=medium + + * Now also compile dstore patch + + -- shenmo Mon, 17 Jan 2022 00:00:00 +0800 + + +spark-store (3.0.3-9) stable; urgency=medium + + * Support dpkg-buildpackage + + -- shenmo Mon, 17 Jan 2022 00:00:00 +0800 diff --git a/debian/control b/debian/control index b6670ac..db6434c 100644 --- a/debian/control +++ b/debian/control @@ -3,42 +3,44 @@ Maintainer: shenmo Section: utils Priority: optional Build-Depends: - debhelper (>= 9), - pkg-config, - qtchooser (>= 55-gc9562a1-1~), - libqt5core5a, - libqt5gui5, - libqt5widgets5, - libqt5network5, - libqt5concurrent5, - libdtkcore-dev, - libdtkgui-dev, - libdtkwidget-dev, - qttools5-private-dev, - libnotify-dev -Standards-Version: 3.1.0 + debhelper (>= 9), + pkg-config, + qtchooser (>= 55-gc9562a1-1~), + libqt5core5a, + libqt5gui5, + libqt5widgets5, + libqt5network5, + libqt5concurrent5, + libdtkcore-dev(>=5.0), + libdtkgui-dev(>=5.0), + libdtkwidget-dev(>=5.0), + qttools5-private-dev, + libnotify-dev, + qtwebengine5-dev +Standards-Version: 3.0 Homepage: https://www.spark-app.store/ Package: spark-store Architecture: any Depends:${shlibs:Depends}, ${misc:Depends}, - libqt5core5a, - libqt5gui5, - libqt5widgets5, - libqt5network5, - libqt5concurrent5, - libdtkcore5, - libdtkgui5, - libdtkwidget5, - libnotify4, - curl, - openssl, - libssl-dev, - dde-qt5integration, - bubblewrap, - aria2, - gcc, - zenity + libqt5core5a, + libqt5gui5, + libqt5widgets5, + libqt5network5, + libqt5concurrent5, + libdtkcore5, + libdtkgui5, + libdtkwidget5, + libnotify4, + curl, + openssl, + libssl-dev, + dde-qt5integration, + bubblewrap, + aria2, + gcc, + zenity Description: Spark Store A community powered app store, based on DTK. +Recommends: apt-fast diff --git a/debian/copyright b/debian/copyright index a2577b2..e212ce7 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,9 +1,9 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: spark-store -Source: https://gitee.com/deepin-community-store/spark-store-new +Source: https://gitee.com/deepin-community-store/spark-store Files: * -Copyright: yzzi +Copyright: The Spark Project Developers License: GPL-3+ This package is free software; you can redistribute it and/or modify diff --git a/debian/rules b/debian/rules index 6b25651..c7846f5 100755 --- a/debian/rules +++ b/debian/rules @@ -17,11 +17,12 @@ override_dh_auto_clean: override_dh_auto_configure: mkdir -p $(CURDIR)/build - - dh_auto_configure MAKEFLAGS=-j$(JOBS) -- spark-store.pro \ + + dh_auto_configure MAKEFLAGS=-j$(JOBS) -- spark-store-project.pro \ -spec linux-g++ CONFIG+=qtquickcompiler \ -o $(CURDIR)/build/ + override_dh_auto_build: make -C $(CURDIR)/build -j$(JOBS) @@ -29,6 +30,7 @@ override_dh_auto_install: make -C $(CURDIR)/build install \ INSTALL_ROOT=$(CURDIR)/debian/spark-store + # Ignore the dpkg-shlibdeps: warning (it uses none of the library's symbols) # Qt Mutidedia lib will ref to network libraray. override_dh_shlibdeps: diff --git a/debian/source/format b/debian/source/format index 163aaf8..9f8e9b6 100644 --- a/debian/source/format +++ b/debian/source/format @@ -1 +1 @@ -3.0 (quilt) +1.0 \ No newline at end of file diff --git a/debian/spark-store.postinst b/debian/spark-store.postinst index 5383e1e..f00831e 100755 --- a/debian/spark-store.postinst +++ b/debian/spark-store.postinst @@ -2,6 +2,21 @@ case "$1" in configure) + + # Enable i386 arch + echo "Enable i386 arch..." + dpkg --add-architecture i386 + + # config for aptss + mkdir -p /etc/aptss/sources.list.d + ln -s -f /etc/apt/sources.list /etc/aptss/sources.list + + # Remove the sources.list file + if [ -e /etc/apt/sources.list.d/sparkstore.list ];then + rm /etc/apt/sources.list.d/sparkstore.list + fi + + # Check if /usr/local/bin existed mkdir -p /usr/local/bin @@ -11,11 +26,31 @@ case "$1" in ln -s -f /opt/durapps/spark-store/bin/spark-store /usr/local/bin/spark-store ln -s -f /opt/durapps/spark-store/bin/ssinstall /usr/local/bin/ssinstall ln -s -f /opt/durapps/spark-store/bin/spark-dstore-patch /usr/local/bin/spark-dstore-patch + ln -s -f /opt/durapps/spark-store/bin/aptss /usr/local/bin/ss-apt-fast + + ln -s -f /opt/durapps/spark-store/bin/aptss /usr/bin/aptss - # Download and install - cd /tmp/spark-store-install - wget https://d.store.deepinos.org.cn/dcs-repo.gpg-key.asc - apt-key add dcs-repo.gpg-key.asc + # Compile the Sender module + + gcc /opt/durapps/spark-store/bin/ss-feedback/sender-d.sh.c -o /opt/durapps/spark-store/bin/ss-feedback/sender-d + + # Install key + mkdir -p /tmp/spark-store-install/ + cp -f /opt/durapps/spark-store/bin/spark-store.asc /tmp/spark-store-install/spark-store.asc + gpg --dearmor /tmp/spark-store-install/spark-store.asc + cp -f /tmp/spark-store-install/spark-store.asc.gpg /etc/apt/trusted.gpg.d/spark-store.gpg + + + + # Run apt update to avoid users being fucked up by the non-exist dependency problem + # Now abandoned as aptss now run ssupdate everytime + #aptss ssupdate + + + # Start upgrade detect service + systemctl enable spark-update-notifier + service spark-update-notifier start + # Update certain caches update-icon-caches /usr/share/icons/hicolor || true @@ -25,20 +60,26 @@ case "$1" in # Send email for statistics # /tmp/spark-store-install/feedback.sh + + # Remove temp dir + rm -rf /tmp/spark-store-install + + ;; triggered) - # Trigger for UOS debs installation - echo '-----------星火应用商店现已集成 UOS 包补丁工具--------------' - if [ -x "/usr/bin/deepin-app-store-tool" ] ; then - echo '----------检测到已安装深度应用商店,不运行补丁---------------' + # Quit if deepin-app-store-tool existed + if [ -x "/usr/bin/deepin-app-store-tool" ] ; then exit 0 fi + # Trigger for UOS debs installation + echo '--------检测到Uniontech标准软件包,运行补丁以修正安装--------' if [ -x "/usr/local/bin/spark-dstore-patch" ] ; then - echo '-------检测到 Uniontech 标准软件包,运行补丁以修正安装-------' - /usr/local/bin/spark-dstore-patch - echo '---------- spark-dstore-patch 补丁工具已运行完毕----------' + /usr/local/bin/spark-dstore-patch + echo '-----------spark-dstore-patch补丁工具已运行完毕-----------' + else + echo '------------spark-dstore-patch补丁工具运行失败------------' fi ;; esac diff --git a/debian/spark-store.preinst b/debian/spark-store.preinst new file mode 100755 index 0000000..1eae804 --- /dev/null +++ b/debian/spark-store.preinst @@ -0,0 +1,28 @@ +#!/bin/bash +#检测网络链接畅通 +function network-check() +{ + #超时时间 + local timeout=15 + + #目标网站 + local target=www.baidu.com + + #获取响应状态码 + local ret_code=`curl -I -s --connect-timeout ${timeout} ${target} -w %{http_code} | tail -n1` + + if [ "x$ret_code" = "x200" ]; then + echo "Network Checked successful ! Continue..." + echo "网络通畅,继续安装" + else + #网络不畅通 + echo "Network failed ! Cancel the installation" + echo "网络不畅,终止安装" + exit -1 + fi + +} + + +#network-check +echo "不再检测网络" \ No newline at end of file diff --git a/debian/spark-store.prerm b/debian/spark-store.prerm index fc931fa..8c44924 100755 --- a/debian/spark-store.prerm +++ b/debian/spark-store.prerm @@ -1,8 +1,47 @@ #!/bin/sh +if [ "$1" = "remove" ] || [ "$1" = "purge" ];then # Remove residual symbol links rm /usr/local/bin/spark-store rm /usr/local/bin/ssinstall rm /usr/local/bin/spark-dstore-patch rm /usr/local/bin/ussinstall rm /usr/local/bin/ussremove +rm /usr/local/bin/ss-apt-fast +rm /usr/bin/aptss + +rm -rf /etc/aptss/ + +# Remove Sender module +rm /opt/durapps/spark-store/bin/ss-feedback/sender-d + +# Remove residual symbol links to stop upgrade detect if exist +if [ -e /etc/xdg/autostart/spark-update-notifier.desktop ];then +rm /etc/xdg/autostart/spark-update-notifier.desktop +fi + +# Shutdown services +service spark-update-notifier stop + +# Stop update detect service +systemctl disable spark-update-notifier + + + +# Clean the auto install polkit file if exist +if [ -f "/usr/share/polkit-1/actions/store.spark-app.ssinstall.policy" ] ; then + rm /usr/share/polkit-1/actions/store.spark-app.ssinstall.policy +fi + +# Remove gpg key file +if [ -f "/etc/apt/trusted.gpg.d/spark-store.gpg" ] ; then + rm /etc/apt/trusted.gpg.d/spark-store.gpg +fi + +apt-key del '9D9A A859 F750 24B1 A1EC E16E 0E41 D354 A29A 440C' + +else + +echo "非卸载操作,不进行配置清理" + +fi diff --git a/pkg/etc/aptss/sources.list.d/sparkstore.list b/pkg/etc/aptss/sources.list.d/sparkstore.list new file mode 100644 index 0000000..0563772 --- /dev/null +++ b/pkg/etc/aptss/sources.list.d/sparkstore.list @@ -0,0 +1 @@ +deb [by-hash=force] https://d.store.deepinos.org.cn / diff --git a/pkg/tmp/spark-store-install/feedback.sh b/pkg/tmp/spark-store-install/feedback.sh index e668d77..007f976 100755 --- a/pkg/tmp/spark-store-install/feedback.sh +++ b/pkg/tmp/spark-store-install/feedback.sh @@ -6,4 +6,4 @@ Subject: spark-store_3.0.2: $(lsb_release -a | grep "Description" | sed -e "s#\t $(uname -a)" | tee /tmp/spark-store-install/feedback.txt > /dev/null -curl -s --url "smtp://smtp.163.com" --mail-from "sparkstorefeedback@163.com" --mail-rcpt "sparkstorefeedback@163.com" --upload-file /tmp/spark-store-install/feedback.txt --user "sparkstorefeedback@163.com:YWYGLQNOPLWNNJJY" +curl -s --url "smtp://smtp.163.com" --mail-from "${MAIL_FEEDBACK}" --mail-rcpt "${MAIL_FEEDBACK}" --upload-file /tmp/spark-store-install/feedback.txt --user "${MAIL_FEEDBACK}:${M}AIL_AUTH" diff --git a/pkg/usr/lib/systemd/system/spark-update-notifier.service b/pkg/usr/lib/systemd/system/spark-update-notifier.service new file mode 100644 index 0000000..de8f8fa --- /dev/null +++ b/pkg/usr/lib/systemd/system/spark-update-notifier.service @@ -0,0 +1,14 @@ +[Unit] +Description=Spark Store update notifier +After=apt-daily.service network.target network-online.target systemd-networkd.service NetworkManager.service connman.service + + +[Service] +Type=simple +RemainAfterExit=yes +ExecStart=/opt/durapps/spark-store/bin/update-upgrade/ss-update-notifier.sh +Restart=on-failure +RestartSec=10 + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/pkg/usr/share/bash-completion/completions/aptss b/pkg/usr/share/bash-completion/completions/aptss new file mode 100644 index 0000000..4afc938 --- /dev/null +++ b/pkg/usr/share/bash-completion/completions/aptss @@ -0,0 +1,228 @@ +# Debian apt(8) completion -*- shell-script -*- + +_aptss() +{ + local sourcesdir="/etc/apt/sources.list.d" + local cur prev words cword + _init_completion || return + + local GENERIC_APT_GET_OPTIONS=' + -d --download-only + -y --assume-yes + --assume-no + -u --show-upgraded + -m --ignore-missing + -t --target-release + --download + --fix-missing + --ignore-hold + --upgrade + --only-upgrade + --allow-change-held-packages + --allow-remove-essential + --allow-downgrades + --print-uris + --trivial-only + --remove + --arch-only + --allow-unauthenticated + --allow-insecure-repositories + --install-recommends + --install-suggests + --no-install-recommends + --no-install-suggests + --fix-policy + ' + + # see if the user selected a command already + local COMMANDS=( + "ssupdate" + "list" + "search" + "show" "showsrc" + "install" "remove" "purge" "autoremove" + "update" + "upgrade" "full-upgrade" "dist-upgrade" + "edit-sources" + "help" + "source" "build-dep" + "clean" "autoclean" + "download" "changelog" + "moo" + "depends" "rdepends" + "policy") + + local command i + for (( i=0; i < ${#words[@]}-1; i++ )); do + if [[ ${COMMANDS[@]} =~ ${words[i]} ]]; then + command=${words[i]} + break + fi + done + + # Complete a -t + case $prev in + -t|--target-release) + COMPREPLY=( $( compgen -W "$( apt-cache policy -o Dir::Cache="/etc/aptss/" | egrep -o 'a=[^,]*|n=[^,]*' | cut -f2- -d= | sort -u)" -- "$cur" ) ) + return 0 + ;; + esac + + # supported options per command + if [[ "$cur" == -* ]]; then + case $command in + install|remove|purge|upgrade|dist-upgrade|full-upgrade|autoremove) + COMPREPLY=( $( compgen -W '--show-progress + --fix-broken --purge --verbose-versions --auto-remove + -s --simulate --dry-run + --download + --fix-missing + --fix-policy + --ignore-hold + --force-yes + --trivial-only + --reinstall --solver + -t --target-release'"$GENERIC_APT_GET_OPTIONS" -- "$cur" ) ) + return 0 + ;; + update) + COMPREPLY=( $( compgen -W '--list-cleanup + --print-uris + --allow-insecure-repositories + ' -- "$cur" ) ) + return 0 + ;; + list) + COMPREPLY=( $( compgen -W '--installed --upgradable + --manual-installed + -v --verbose + -a --all-versions + -t --target-release + ' -- "$cur" ) ) + return 0 + ;; + show) + COMPREPLY=( $( compgen -W '-a --all-versions + ' -- "$cur" ) ) + return 0 + ;; + depends|rdepends) + COMPREPLY=( $( compgen -W '-i + --important + --installed + --pre-depends + --depends + --recommends + --suggests + --replaces + --breaks + --conflicts + --enhances + --recurse + --implicit' -- "$cur" ) ) + return 0 + ;; + search) + COMPREPLY=( $( compgen -W ' + -n --names-only + -f --full' -- "$cur" ) ) + return 0 + ;; + showsrc) + COMPREPLY=( $( compgen -W ' + --only-source' -- "$cur" ) ) + return 0 + ;; + source) + COMPREPLY=( $( compgen -W ' + -s --simulate --dry-run + -b --compile --build + -P --build-profiles + --diff-only --debian-only + --tar-only + --dsc-only + -t --target-release + '"$GENERIC_APT_GET_OPTIONS" -- "$cur" ) ) + return 0 + ;; + build-dep) + COMPREPLY=( $( compgen -W ' + -a --host-architecture + -s --simulate --dry-run + -P --build-profiles + -t --target-release + --purge --solver + '"$GENERIC_APT_GET_OPTIONS" -- "$cur" ) ) + return 0 + ;; + moo) + COMPREPLY=( $( compgen -W ' + --color + ' -- "$cur" ) ) + return 0 + ;; + clean|autoclean) + COMPREPLY=( $( compgen -W ' + -s --simulate --dry-run + ' -- "$cur" ) ) + return 0 + ;; + esac + fi + + # specific command arguments + if [[ -n $command ]]; then + case $command in + remove|purge|autoremove) + if [[ -f /etc/debian_version ]]; then + # Debian system + COMPREPLY=( $( \ + _xfunc dpkg _comp_dpkg_installed_packages $cur ) ) + else + # assume RPM based + _xfunc rpm _rpm_installed_packages + fi + return 0 + ;; + show|list|download|changelog|depends|rdepends) + COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" -o Dir::Cache="/etc/aptss/" \ + 2> /dev/null ) ) + return 0 + ;; + install) + COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" -o Dir::Cache="/etc/aptss/" \ + 2> /dev/null ) ) + if [[ "$cur" == ./* || "$cur" == /* ]]; then + _filedir "deb" + fi + return 0 + ;; + source|build-dep|showsrc|policy) + COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" -o Dir::Cache="/etc/aptss/" \ + 2> /dev/null ) $( apt-cache dumpavail -o Dir::Cache="/etc/aptss/" | \ + command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) ) + return 0 + ;; + edit-sources) + COMPREPLY=( $( compgen -W '$( command ls $sourcesdir )' \ + -- "$cur" ) ) + return 0 + ;; + moo) + COMPREPLY=( $( compgen -W 'moo' \ + -- "$cur" ) ) + return 0 + ;; + esac + fi + + # no command yet, show what commands we have + if [ "$command" = "" ]; then + COMPREPLY=( $( compgen -W '${COMMANDS[@]}' -- "$cur" ) ) + fi + + return 0 +} && +complete -F _aptss aptss + +# ex: ts=4 sw=4 et filetype=sh diff --git a/pkg/usr/share/polkit-1/actions/store.spark-app.ss-do-upgrade-worker.policy b/pkg/usr/share/polkit-1/actions/store.spark-app.ss-do-upgrade-worker.policy new file mode 100644 index 0000000..49c5000 --- /dev/null +++ b/pkg/usr/share/polkit-1/actions/store.spark-app.ss-do-upgrade-worker.policy @@ -0,0 +1,18 @@ + + + + Spark Store + x-package-repository + + 运行ss-do-upgrade-worker需要权限 + 要使用ss-do-upgrade-worker需要权限 + + yes + yes + yes + + /opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh + true + + diff --git a/spark-store.pro b/spark-store-project.pro similarity index 50% rename from spark-store.pro rename to spark-store-project.pro index 724db21..d183c6d 100644 --- a/spark-store.pro +++ b/spark-store-project.pro @@ -10,12 +10,13 @@ TEMPLATE = subdirs CONFIG += ordered SUBDIRS += \ + src/spark-dstore-patch \ src/spark-store.pro -TRANSLATIONS += \ - translations/spark-store_fr.ts \ - translations/spark-store_en.ts \ - translations/spark-store_zh_CN.ts +#TRANSLATIONS += \ +# translations/spark-store_fr.ts \ +# translations/spark-store_en.ts \ +# translations/spark-store_zh_CN.ts # Update translation files CONFIG(release, debug|release): system(bash $${PWD}/translate_generation.sh) @@ -27,15 +28,24 @@ tool.path = /opt/durapps/$${TARGET}/bin qm.files += translations/*.qm qm.path = /usr/share/spark-store/translations -preferences.files += pkg/etc/apt/preferences.d/sparkstore -preferences.path = /etc/apt/preferences.d +#preferences.files += pkg/etc/apt/preferences.d/sparkstore +#preferences.path = /etc/apt/preferences.d -sourceslist.files += pkg/etc/apt/sources.list.d/sparkstore.list -sourceslist.path = /etc/apt/sources.list.d +#sourceslist.files += pkg/etc/apt/sources.list.d/sparkstore.list +#sourceslist.path = /etc/apt/sources.list.d + +bash_completion.files += pkg/usr/share/bash-completion/completions/aptss +bash_completion.path = /usr/share/bash-completion/completions desktop.files += pkg/usr/share/applications/spark-store.desktop desktop.path = /usr/share/applications +service.files += pkg/usr/lib/systemd/system/spark-update-notifier.service +service.path = /usr/lib/systemd/system/ + +polkit-1.files +=pkg/usr/share/polkit-1/actions/store.spark-app.ss-do-upgrade-worker.policy +polkit-1.path = /usr/share/polkit-1/actions/ + icon.files += pkg/usr/share/icons/hicolor/scalable/apps/spark-store.svg icon.path = /usr/share/icons/hicolor/scalable/apps @@ -47,6 +57,10 @@ INSTALLS += \ qm \ desktop \ icon \ - sourceslist \ - preferences \ - tmp +# preferences \ +# sourceslist \ + tmp \ + service \ + bash_completion \ + polkit-1 +# 暂时不添加 \ No newline at end of file diff --git a/src/spark-dstore-patch/spark-dstore-patch.pro b/src/spark-dstore-patch/spark-dstore-patch.pro new file mode 100644 index 0000000..841f15e --- /dev/null +++ b/src/spark-dstore-patch/spark-dstore-patch.pro @@ -0,0 +1,9 @@ +TARGET = spark-dstore-patch +TEMPLATE += app +QT += widgets +SOURCES += spark-dstore-tool.cpp + +# Default rules for deployment. +qnx: target.path = /tmp/spark-store/bin +else: unix:!android: target.path = /opt/durapps/spark-store/bin +!isEmpty(target.path): INSTALLS += target \ No newline at end of file diff --git a/src/spark-dstore-patch/spark-dstore-tool.cpp b/src/spark-dstore-patch/spark-dstore-tool.cpp new file mode 100644 index 0000000..dbf3881 --- /dev/null +++ b/src/spark-dstore-patch/spark-dstore-tool.cpp @@ -0,0 +1,195 @@ +#include +#include +#include +#include +#include +#include +#include + +#include + +QList enumAppInfoList() +{ + QList appInfoList; + QDir apps("/opt/apps"); + auto list = apps.entryList(QDir::Dirs | QDir::NoDotAndDotDot); + for (auto &appID : list) { + auto infoPath = apps.absoluteFilePath(appID + "/info"); + QFile infoFile(infoPath); + if (!infoFile.open(QIODevice::ReadOnly)) { + continue; + } + auto doc = QJsonDocument::fromJson(infoFile.readAll()); + appInfoList.push_back(doc.object()); + } + return appInfoList; +} +//这段是去找appid和info,没看懂用来干啥的,在此之后info文件也没再用过 +//可能以后版本的实现会用到,等官方加功能再说 +void linkDir(const QString &source, const QString &target) +{ + auto ensureTargetDir = [](const QString &targetFile) { + QFileInfo t(targetFile); + QDir tDir(t.dir()); + tDir.mkpath("."); + }; + + QDir sourceDir(source); + QDir targetDir(target); + QDirIterator iter(source, QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); + while (iter.hasNext()) { + auto sourceFile = iter.next(); + auto targetFile = targetDir.absoluteFilePath(sourceDir.relativeFilePath(sourceFile)); + + QFileInfo tfi(targetFile); + // if (tfi.isSymLink() && (tfi.canonicalFilePath() == sourceFile)) { + //这里官方应该是写错了,否则会每触发一次就把所有软链接都删了重新创建一次 + if (tfi.isSymLink() && (tfi.symLinkTarget() == sourceFile)) { + continue; + } else { + QFile::remove(targetFile); + } + + ensureTargetDir(targetFile); + auto ret = symlink(sourceFile.toStdString().c_str(), targetFile.toStdString().c_str()); + if (0 != ret) { + qDebug() << "link failed" << sourceFile << "=>" << targetFile << ret; + } + } +} + +//reset Dynamic library rpath +void setRpath(const QString &file, const QString &path) +{ + if (!QFileInfo::exists(path)) + return; + QProcess p; + auto cmd = "patchelf " + file + " --set-rpath " + path; + p.start("bash", QStringList {"-c", cmd}); + p.waitForFinished(); +} + +QString getGlic() +{ + //get arch & glibc + QProcess p; + auto cmd = "gcc -dumpmachine"; + p.start("bash", QStringList {"-c", cmd}); + p.waitForFinished(); + return p.readAll(); +} + +void linkApp(const QJsonObject &app) +{ + auto appID = app.value("appid").toString(); + auto appEntriesDir = QDir("/opt/apps/" + appID + "/entries"); + auto appLibsDir = QDir("/opt/apps/" + appID + "/files/lib"); + auto autoStartDir = QDir(appEntriesDir.absoluteFilePath("autostart")); + + bool autoStart = app.value("permissions").toObject().value("autostart").toBool(); + if (autoStart) { + linkDir(appEntriesDir.absoluteFilePath("autostart"), "/etc/xdg/autostart"); + } + + // link application + auto sysShareDir = QDir("/usr/share"); + linkDir(appEntriesDir.absoluteFilePath("applications"), sysShareDir.absoluteFilePath("applications")); + linkDir(appEntriesDir.absoluteFilePath("icons"), sysShareDir.absoluteFilePath("icons")); + linkDir(appEntriesDir.absoluteFilePath("mime"), sysShareDir.absoluteFilePath("mime")); + linkDir(appEntriesDir.absoluteFilePath("glib-2.0"), sysShareDir.absoluteFilePath("glib-2.0")); + linkDir(appEntriesDir.absoluteFilePath("services"), sysShareDir.absoluteFilePath("dbus-1/services")); + linkDir(appEntriesDir.absoluteFilePath("GConf"), sysShareDir.absoluteFilePath("GConf")); + linkDir(appEntriesDir.absoluteFilePath("help"), sysShareDir.absoluteFilePath("help")); + linkDir(appEntriesDir.absoluteFilePath("locale"), sysShareDir.absoluteFilePath("locale")); + linkDir(appEntriesDir.absoluteFilePath("fcitx"), sysShareDir.absoluteFilePath("fcitx")); + linkDir(appEntriesDir.absoluteFilePath("polkit"), sysShareDir.absoluteFilePath("polkit-1")); + linkDir(appEntriesDir.absoluteFilePath("fonts/conf"), "/etc/fonts/conf.d"); + linkDir(appEntriesDir.absoluteFilePath("fonts/files"), sysShareDir.absoluteFilePath("fonts")); + + +//原来会导致Gtk相关应用翻译缺失,补足了 + + + auto pluginDir = QDir(appEntriesDir.absoluteFilePath("plugins")); + if (pluginDir.exists()) { + QString arch = getGlic(); + // if (pluginDir.exists()) { + // QDirIterator iter(pluginDir.absolutePath(), QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); + // while (iter.hasNext()) { + // auto sourceFile = iter.next(); + // setRpath(sourceFile, appLibsDir.absolutePath()); //set rpath + // } + // } + + linkDir(appEntriesDir.absoluteFilePath("plugins/fcitx"), "/usr/lib/" + arch + "/fcitx"); + linkDir(appEntriesDir.absoluteFilePath("plugins/browser"), "/usr/lib/mozilla/plugins"); + } +} + +void cleanLink() +{ + auto cleanDirBrokenLink = [](const QString &dir) { + QProcess p; + auto cmd = "find " + dir + " -xtype l -delete"; + p.start("bash", QStringList {"-c", cmd}); + p.waitForFinished(); + }; + + QString arch = getGlic(); + auto sysShareDir = QDir("/usr/share"); + cleanDirBrokenLink(sysShareDir.absoluteFilePath("applications")); + cleanDirBrokenLink(sysShareDir.absoluteFilePath("icons")); + cleanDirBrokenLink(sysShareDir.absoluteFilePath("mime/packages")); + cleanDirBrokenLink(sysShareDir.absoluteFilePath("glib-2.0")); + cleanDirBrokenLink(sysShareDir.absoluteFilePath("dbus-1/services")); + cleanDirBrokenLink("/etc/xdg/autostart"); + cleanDirBrokenLink(sysShareDir.absoluteFilePath("fcitx")); + cleanDirBrokenLink(sysShareDir.absoluteFilePath("help")); + cleanDirBrokenLink(sysShareDir.absoluteFilePath("locale")); + cleanDirBrokenLink("/usr/lib/" + arch + "/fcitx"); + cleanDirBrokenLink("/usr/lib/mozilla/plugins"); + cleanDirBrokenLink(sysShareDir.absoluteFilePath("polkit-1/actions")); + cleanDirBrokenLink(sysShareDir.absoluteFilePath("fonts")); + cleanDirBrokenLink("/etc/fonts/conf.d"); +} + +void update() +{ + QProcess p; + auto cmd = "glib-compile-schemas /usr/share/glib-2.0/schemas/"; + p.start("bash", QStringList {"-c", cmd}); + p.waitForFinished(); + + cmd = "update-icon-caches /usr/share/icons/*"; + p.start("bash", QStringList {"-c", cmd}); + p.waitForFinished(); + + cmd = "update-desktop-database -q"; + p.start("bash", QStringList {"-c", cmd}); + p.waitForFinished(); + + cmd = "update-mime-database -V /usr/share/mime"; + p.start("bash", QStringList {"-c", cmd}); + p.waitForFinished(); + + +} + + + +int main(int argc, char **argv) +{ + QCoreApplication app(argc, argv); + + cleanLink(); + + for (auto &a : enumAppInfoList()) { + linkApp(a); + } + qInfo()<<"Spark dstore patch (c) The Spark Project 2022-Now. Modified from deepin-app-store-tool"; + + // trigger + update(); + + return 0; +}