Compare commits
34 Commits
4.5.1
...
4.7.1test1
| Author | SHA1 | Date | |
|---|---|---|---|
| ea6e7a19bd | |||
| 930111f2df | |||
| b708b63113 | |||
| 74cc0fbce9 | |||
| bbc4d27d7a | |||
| dc28c2e9d1 | |||
| b4935edf0a | |||
| 4f294cee8f | |||
| 45c52d7755 | |||
| 90ad08a6f9 | |||
| 819e680222 | |||
| 6697bd04f1 | |||
| 2a6e9046e7 | |||
| 460d965ac1 | |||
| 2b929f8a06 | |||
| f2cafe0567 | |||
| 564966daef | |||
| 668e5dc28d | |||
| 7ae592776d | |||
| 6f3980e6cb | |||
| e2a0079c6e | |||
| 73f84a2861 | |||
| 8218080f40 | |||
| 264b0ba8da | |||
| b114db583b | |||
| 832b53dfc9 | |||
| 244f58ecce | |||
| 470666cf41 | |||
| 4abfc19399 | |||
| e3e8684f18 | |||
|
|
c60399df0b | ||
|
|
9036140ceb | ||
|
|
da7e8ea9fc | ||
| a158966e2d |
@@ -7,7 +7,7 @@ import json
|
|||||||
sha = os.getenv("GIT_COMMIT")
|
sha = os.getenv("GIT_COMMIT")
|
||||||
# sha = '48fed26c51a8c42554e45f72f43e49703e04c97f'
|
# sha = '48fed26c51a8c42554e45f72f43e49703e04c97f'
|
||||||
#get sha from environment
|
#get sha from environment
|
||||||
url = "https://gitee.com/api/v5/repos/deepin-community-store/spark-store/commits/{}/comments".format(sha)
|
url = "https://gitee.com/api/v5/repos/spark-store-project/spark-store/commits/{}/comments".format(sha)
|
||||||
|
|
||||||
token = os.getenv("gitee_token")
|
token = os.getenv("gitee_token")
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ stages:
|
|||||||
- tar -xf DEBIANARM.tar.xz
|
- tar -xf DEBIANARM.tar.xz
|
||||||
- mkdir -p DEBIAN/root/build-spark
|
- mkdir -p DEBIAN/root/build-spark
|
||||||
- mv ../spark-store-git DEBIAN/root/build-spark/spark-store
|
- mv ../spark-store-git DEBIAN/root/build-spark/spark-store
|
||||||
- wget https://gitee.com/deepin-community-store/repo_auto_update_script/raw/master/spark-build-aarch64.sh && mv spark-build-aarch64.sh DEBIAN/root
|
- wget https://gitee.com/spark-store-project/repo_auto_update_script/raw/master/spark-build-aarch64.sh && mv spark-build-aarch64.sh DEBIAN/root
|
||||||
- mv /usr/bin/qemu-aarch64-static DEBIAN/
|
- mv /usr/bin/qemu-aarch64-static DEBIAN/
|
||||||
- chroot DEBIAN /qemu-aarch64-static /bin/bash /root/spark-build-aarch64.sh
|
- chroot DEBIAN /qemu-aarch64-static /bin/bash /root/spark-build-aarch64.sh
|
||||||
- ''
|
- ''
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
`{SOURCE_URL}/{ARCH}/{CATOGARY}/applist.json`
|
`{SOURCE_URL}/{ARCH}/{CATOGARY}/applist.json`
|
||||||
说明:SOURCE_URL:线路链接,目前推荐 https://cdn.d.store.deepinos.org.cn,你也可以使用其他的星火线路
|
说明:SOURCE_URL:线路链接,目前推荐 https://cdn.d.store.deepinos.org.cn,你也可以使用其他的星火线路
|
||||||
ARCH:架构文件夹 x86是store或amd64-store,arm是aarch64-store。特别的,如果你使用非https://cdn.d.store.deepinos.org.cn的线路,你可能会发现amd64-store会返回404,因为不是所有的服务器都支持软连接
|
ARCH:架构文件夹 x86是store或amd64-store,arm是aarch64-store。特别的,如果你使用非https://cdn.d.store.deepinos.org.cn的线路,你可能会发现amd64-store会返回404,因为不是所有的服务器都支持软连接
|
||||||
CATOGARY:分类目录。参考 https://gitee.com/deepin-community-store/spark-store/blob/dev/DOCS/spk-doc.md 中 store 直达的对应关系
|
CATOGARY:分类目录。参考 https://gitee.com/spark-store-project/spark-store/blob/dev/DOCS/spk-doc.md 中 store 直达的对应关系
|
||||||
|
|
||||||
例子:https://cdn.d.store.deepinos.org.cn/aarch64-store/tools/applist.json
|
例子:https://cdn.d.store.deepinos.org.cn/aarch64-store/tools/applist.json
|
||||||
|
|
||||||
|
|||||||
@@ -4,4 +4,4 @@
|
|||||||
|
|
||||||
为方便使用(其实是早期屎山使然),请将仓库放置于 `/home/ftp/spark-store`
|
为方便使用(其实是早期屎山使然),请将仓库放置于 `/home/ftp/spark-store`
|
||||||
|
|
||||||
仓库管理相关代码请移步 [这里](https://gitee.com/deepin-community-store/repo_auto_update_script),update.sh请联系 @shenmo 获取
|
仓库管理相关代码请移步 [这里](https://gitee.com/spark-store-project/repo_auto_update_script),update.sh请联系 @shenmo 获取
|
||||||
6
FAQ.md
@@ -8,7 +8,7 @@ The Spark App Store is an application store aimed at Linux users and supports mu
|
|||||||
|
|
||||||
### Communication and Feedback
|
### Communication and Feedback
|
||||||
**Q: Where can I join the community group?**
|
**Q: Where can I join the community group?**
|
||||||
**A:** You can click [here](https://www.deepinos.org/) to enter the main communication platform of the Spark Store.
|
**A:** You can click [here](https://bbs.spark-app.store/) to enter the main communication platform of the Spark Store.
|
||||||
> ⚠️ If the above link doesn't work, you can also join our QQ groups as an alternative. The group numbers are 872690351 and 865927727. We also offer forums for communication.
|
> ⚠️ If the above link doesn't work, you can also join our QQ groups as an alternative. The group numbers are 872690351 and 865927727. We also offer forums for communication.
|
||||||
|
|
||||||
#### Differences Between arm64 and amd64
|
#### Differences Between arm64 and amd64
|
||||||
@@ -79,12 +79,12 @@ Linux:
|
|||||||
|
|
||||||
### Reporting Issues and Removing Apps
|
### Reporting Issues and Removing Apps
|
||||||
**Q: Some apps are outdated or inactive, and I want them removed**
|
**Q: Some apps are outdated or inactive, and I want them removed**
|
||||||
**A:** You can report issues [here](https://gitee.com/deepin-community-store/software_-issue).
|
**A:** You can report issues [here](https://gitee.com/spark-store-project/software_-issue).
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Installing Spark App Store
|
### Installing Spark App Store
|
||||||
If you wish to install the Spark App Store, please visit the [Release page](https://gitee.com/deepin-community-store/spark-store/releases), find the latest version, and choose the package suitable for your current system.
|
If you wish to install the Spark App Store, please visit the [Release page](https://gitee.com/spark-store-project/spark-store/releases), find the latest version, and choose the package suitable for your current system.
|
||||||
|
|
||||||
> ⚠️ Special Note: If you are using Debian10/Debian11 or Ubuntu 20.04, you may need to download additional dependency packages. After downloading, unzip multiple times until you see the software user guide. For operating systems later than Ubuntu 22.04, you do not need to install dependency packages. Just follow the steps above to install the main program directly.
|
> ⚠️ Special Note: If you are using Debian10/Debian11 or Ubuntu 20.04, you may need to download additional dependency packages. After downloading, unzip multiple times until you see the software user guide. For operating systems later than Ubuntu 22.04, you do not need to install dependency packages. Just follow the steps above to install the main program directly.
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
### 交流与反馈
|
### 交流与反馈
|
||||||
**Q: 在哪进交流群?**
|
**Q: 在哪进交流群?**
|
||||||
**A:** 你可以点击[这里](https://www.deepinos.org/)进入星火商店的主交流平台。
|
**A:** 你可以点击[这里](https://bbs.spark-app.store/)进入星火商店的主交流平台。
|
||||||
> ⚠️ 如果上面的链接无法使用,你还可以加入我们的 QQ 群作为备选方案,群号是 872690351 和 865927727。我们还提供论坛作为交流平台。
|
> ⚠️ 如果上面的链接无法使用,你还可以加入我们的 QQ 群作为备选方案,群号是 872690351 和 865927727。我们还提供论坛作为交流平台。
|
||||||
|
|
||||||
arm64与amd64的区别
|
arm64与amd64的区别
|
||||||
@@ -78,12 +78,12 @@ Linux:
|
|||||||
|
|
||||||
### 报告问题和应用下架
|
### 报告问题和应用下架
|
||||||
**Q: 有些应用已经过时或者失效了,我想让他下架**
|
**Q: 有些应用已经过时或者失效了,我想让他下架**
|
||||||
**A:** 你可以前往 [这里](https://gitee.com/deepin-community-store/software_-issue) 报告问题。
|
**A:** 你可以前往 [这里](https://gitee.com/spark-store-project/software_-issue) 报告问题。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 安装星火应用商店
|
### 安装星火应用商店
|
||||||
如果你想安装星火应用商店,请打开[Release页面](https://gitee.com/deepin-community-store/spark-store/releases),找到最新版本,并选择适用于当前系统的安装包下载。
|
如果你想安装星火应用商店,请打开[Release页面](https://gitee.com/spark-store-project/spark-store/releases),找到最新版本,并选择适用于当前系统的安装包下载。
|
||||||
|
|
||||||
> ⚠️ 特别提示: 如果你在使用 Debian10/Debian11 或 Ubuntu 20.04,你可能额外下载依赖补充包。您需要在下载完依赖包后,解压多次一直到看到内部的软件使用说明,对于 Ubuntu22.04 以后的操作系统版本,您无需安装依赖包,您需要按照上面的操作直接安装本体程序。
|
> ⚠️ 特别提示: 如果你在使用 Debian10/Debian11 或 Ubuntu 20.04,你可能额外下载依赖补充包。您需要在下载完依赖包后,解压多次一直到看到内部的软件使用说明,对于 Ubuntu22.04 以后的操作系统版本,您无需安装依赖包,您需要按照上面的操作直接安装本体程序。
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ You will see an output, and that's your system architecture.
|
|||||||
|
|
||||||
Please refer to the [Spark App Store FAQ and Support Guide](https://gitee.com/spark-store-project/spark-store/blob/dev/FAQ.md).
|
Please refer to the [Spark App Store FAQ and Support Guide](https://gitee.com/spark-store-project/spark-store/blob/dev/FAQ.md).
|
||||||
|
|
||||||
You can also check the [Chinese version](https://gitee.com/spark-store-project/spark-store/blob/dev/FAQ.zh.md) here.
|
To customly configure aptss, refer to [aptss](https://gitee.com/GXDE-OS/aptss)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# 星火应用商店
|
# 星火应用商店
|
||||||
[](https://gitee.com/spark-store-project/spark-store/stargazers) [](https://gitee.com/spark-store-project/spark-store/members)
|
[](https://gitee.com/spark-store-project/spark-store/stargazers) [](https://gitee.com/spark-store-project/spark-store/members)
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
## 简介
|
## 简介
|
||||||
@@ -171,9 +171,11 @@ https://github.com/spark-store-project/spark-store
|
|||||||
|
|
||||||
## 常见问题(FAQ)
|
## 常见问题(FAQ)
|
||||||
|
|
||||||
请参见[星火应用商店FAQ与支持指南](https://gitee.com/spark-store-project/spark-store/blob/dev/FAQ.md)。
|
请参见[星火应用商店FAQ与支持指南](https://gitee.com/spark-store-project/spark-store/blob/dev/FAQ.zh.md)。
|
||||||
|
|
||||||
|
自定义配置 aptss config 请参阅 [aptss](https://gitee.com/GXDE-OS/aptss)
|
||||||
|
|
||||||
|
|
||||||
在这里可以查阅[中文版本](https://gitee.com/spark-store-project/spark-store/blob/dev/FAQ.zh.md)。
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
28
debian/changelog
vendored
@@ -1,4 +1,16 @@
|
|||||||
spark-store (4.5.1) UNRELEASED; urgency=medium
|
spark-store (4.7.1~test1) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
|
* ssinstall升级,支持安装到ACE和自动安装到ACE
|
||||||
|
|
||||||
|
-- shenmo <shenmo@spark-app.store> Tue, 24 Sep 2024 11:27:08 +0800
|
||||||
|
|
||||||
|
spark-store (4.5.2) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
|
* 支持安装到 ACE Bookworm
|
||||||
|
|
||||||
|
-- shenmo <shenmo@spark-app.store> Tue, 24 Sep 2024 11:27:08 +0800
|
||||||
|
|
||||||
|
spark-store (4.5.1) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
* 修复 aptss 部分报错
|
* 修复 aptss 部分报错
|
||||||
* 重新设计了 Tag 区的展示方式
|
* 重新设计了 Tag 区的展示方式
|
||||||
@@ -200,7 +212,7 @@ spark-store (4.2.7.3) stable; urgency=medium
|
|||||||
|
|
||||||
* 修复:aptss现在会正确地透传错误码而不是exit 0
|
* 修复:aptss现在会正确地透传错误码而不是exit 0
|
||||||
* 修复:下载时如果卡0%(无法下载metalink),会在超时后报错中断而不是一直傻等
|
* 修复:下载时如果卡0%(无法下载metalink),会在超时后报错中断而不是一直傻等
|
||||||
* 修复:排队下载时CPU占满单核的bug https://gitee.com/deepin-community-store/spark-store/issues/I7B91V
|
* 修复:排队下载时CPU占满单核的bug https://gitee.com/spark-store-project/spark-store/issues/I7B91V
|
||||||
* 修复:在终端中打开的icon过大导致无法投稿到UOS
|
* 修复:在终端中打开的icon过大导致无法投稿到UOS
|
||||||
* 修复:v23下编译出错
|
* 修复:v23下编译出错
|
||||||
* 薪怎:支持崩溃日志收集系统
|
* 薪怎:支持崩溃日志收集系统
|
||||||
@@ -437,7 +449,7 @@ spark-store (4.2.3~test2) stable; urgency=medium
|
|||||||
spark-store (4.2.3~test1) stable; urgency=medium
|
spark-store (4.2.3~test1) stable; urgency=medium
|
||||||
|
|
||||||
* 修复:因判断安装状态错误创建多个相同任务的bug
|
* 修复:因判断安装状态错误创建多个相同任务的bug
|
||||||
* 测试中:尝试修复安装结束的闪退问题 https://gitee.com/deepin-community-store/spark-store/commit/cb093dcc2bb0a193db89aa0ce5f20ea9cc5d56eb
|
* 测试中:尝试修复安装结束的闪退问题 https://gitee.com/spark-store-project/spark-store/commit/cb093dcc2bb0a193db89aa0ce5f20ea9cc5d56eb
|
||||||
* 修复:Deepin 显示开发者模式未开启
|
* 修复:Deepin 显示开发者模式未开启
|
||||||
* 修复:从托盘打开主窗口时透明度动画不流畅
|
* 修复:从托盘打开主窗口时透明度动画不流畅
|
||||||
* 修复:主窗口关闭后,从托盘打开关于窗口会被主窗口遮挡
|
* 修复:主窗口关闭后,从托盘打开关于窗口会被主窗口遮挡
|
||||||
@@ -519,8 +531,8 @@ spark-store (4.1.2) stable; urgency=medium
|
|||||||
* chore: 去除安装依赖:g++
|
* chore: 去除安装依赖:g++
|
||||||
* fix: 修复下载列表中进度提示文字显示不完整的问题
|
* fix: 修复下载列表中进度提示文字显示不完整的问题
|
||||||
* feat: ssinstall支持从单独文件夹中校验软件包
|
* feat: ssinstall支持从单独文件夹中校验软件包
|
||||||
* feat: 支持分单文件夹下载。具体内容参见:https://gitee.com/deepin-community-store/repo_auto_update_script/blob/master/mirror-list-for-apt-fast/sources.list.d/sparkstore.list
|
* feat: 支持分单文件夹下载。具体内容参见:https://gitee.com/spark-store-project/repo_auto_update_script/blob/master/mirror-list-for-apt-fast/sources.list.d/sparkstore.list
|
||||||
* info: 非常感谢 @jwyh 对星火商店代码仓库设计了很多标准,参见 https://deepin-community-store.gitee.io/spark-wiki/#/Dev/Spark-Store-Git-Repo?id=%e6%9b%b4%e6%96%b0%e6%97%a5%e5%bf%97%e8%a7%84%e5%88%99 ,不过shenmo是自由的
|
* info: 非常感谢 @jwyh 对星火商店代码仓库设计了很多标准,参见 https://wiki.spark-app.store/#/Dev/Spark-Store-Git-Repo?id=%e6%9b%b4%e6%96%b0%e6%97%a5%e5%bf%97%e8%a7%84%e5%88%99 ,不过shenmo是自由的
|
||||||
|
|
||||||
|
|
||||||
* chore: 添加 Application 类,继承 DApplication,将 main 函数中设置属性、关于信息等操作移至 Application 构造函数中进行
|
* chore: 添加 Application 类,继承 DApplication,将 main 函数中设置属性、关于信息等操作移至 Application 构造函数中进行
|
||||||
@@ -539,8 +551,8 @@ spark-store (4.1.2) stable; urgency=medium
|
|||||||
spark-store (4.1.2~test2) stable; urgency=medium
|
spark-store (4.1.2~test2) stable; urgency=medium
|
||||||
|
|
||||||
* feat: ssinstall支持从单独文件夹中校验软件包
|
* feat: ssinstall支持从单独文件夹中校验软件包
|
||||||
* feat: 支持分单文件夹下载。具体内容参见:https://gitee.com/deepin-community-store/repo_auto_update_script/blob/master/mirror-list-for-apt-fast/sources.list.d/sparkstore.list
|
* feat: 支持分单文件夹下载。具体内容参见:https://gitee.com/spark-store-project/repo_auto_update_script/blob/master/mirror-list-for-apt-fast/sources.list.d/sparkstore.list
|
||||||
* info: 非常感谢 @jwyh 对星火商店代码仓库设计了很多标准,参见 https://deepin-community-store.gitee.io/spark-wiki/#/Dev/Spark-Store-Git-Repo ,不过shenmo是自由的
|
* info: 非常感谢 @jwyh 对星火商店代码仓库设计了很多标准,参见 https://wiki.spark-app.store/#/Dev/Spark-Store-Git-Repo ,不过shenmo是自由的
|
||||||
|
|
||||||
-- shenmo <shenmo@spark-app.store> Fri, 30 Jan 2022 00:00:00 +0800
|
-- shenmo <shenmo@spark-app.store> Fri, 30 Jan 2022 00:00:00 +0800
|
||||||
|
|
||||||
@@ -751,7 +763,7 @@ spark-store (3.2.4) stable; urgency=medium
|
|||||||
|
|
||||||
spark-store (3.2.4~test4) stable; urgency=medium
|
spark-store (3.2.4~test4) stable; urgency=medium
|
||||||
|
|
||||||
* 现在在商店启动后点击spk链接仍会正常启动 https://gitee.com/deepin-community-store/spark-store/commit/dd6780d636042bf12d77414e6f1552cc7d1ed24c
|
* 现在在商店启动后点击spk链接仍会正常启动 https://gitee.com/spark-store-project/spark-store/commit/dd6780d636042bf12d77414e6f1552cc7d1ed24c
|
||||||
|
|
||||||
-- shenmo <shenmo@spark-app.store> Fri, 30 Jan 2022 00:00:00 +0800
|
-- shenmo <shenmo@spark-app.store> Fri, 30 Jan 2022 00:00:00 +0800
|
||||||
|
|
||||||
|
|||||||
2
debian/copyright
vendored
@@ -1,6 +1,6 @@
|
|||||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
Upstream-Name: spark-store
|
Upstream-Name: spark-store
|
||||||
Source: https://gitee.com/deepin-community-store/spark-store
|
Source: https://gitee.com/spark-store-project/spark-store
|
||||||
|
|
||||||
Files: *
|
Files: *
|
||||||
Copyright: The Spark Project Developers
|
Copyright: The Spark Project Developers
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
> 用于 zinface-community-cmake-build-system.patch 补丁化构建方式
|
> 用于 zinface-community-cmake-build-system.patch 补丁化构建方式
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
git clone https://gitee.com/deepin-community-store/spark-store
|
git clone https://gitee.com/spark-store-project/spark-store
|
||||||
cd spark-store
|
cd spark-store
|
||||||
git am < patchs/zinface-community-cmake-build-system.patch
|
git am < patchs/zinface-community-cmake-build-system.patch
|
||||||
make package
|
make package
|
||||||
|
|||||||
@@ -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."
|
||||||
@@ -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包"
|
||||||
@@ -45,24 +45,33 @@
|
|||||||
<file>icon/light/update.svg</file>
|
<file>icon/light/update.svg</file>
|
||||||
<file>icon/logo.svg</file>
|
<file>icon/logo.svg</file>
|
||||||
<file>json/features.json</file>
|
<file>json/features.json</file>
|
||||||
<file>tags/a2d-small.png</file>
|
<file>tags/a2d_full.svg</file>
|
||||||
<file>tags/a2d.png</file>
|
<file>tags/a2d.png</file>
|
||||||
<file>tags/community-small.png</file>
|
<file>tags/a2d.svg</file>
|
||||||
|
<file>tags/community_full.svg</file>
|
||||||
<file>tags/community.png</file>
|
<file>tags/community.png</file>
|
||||||
<file>tags/community.svg</file>
|
<file>tags/community.svg</file>
|
||||||
<file>tags/deepin-small.png</file>
|
<file>tags/debian_full.svg</file>
|
||||||
|
<file>tags/debian.png</file>
|
||||||
|
<file>tags/debian.svg</file>
|
||||||
|
<file>tags/deepin_full.svg</file>
|
||||||
|
<file>tags/deepin.png</file>
|
||||||
<file>tags/deepin.svg</file>
|
<file>tags/deepin.svg</file>
|
||||||
<file>tags/dtk-small.png</file>
|
<file>tags/dtk_full.svg</file>
|
||||||
<file>tags/dwine2-small.png</file>
|
<file>tags/dtk.png</file>
|
||||||
<file>tags/dwine5-small.png</file>
|
<file>tags/dtk.svg</file>
|
||||||
|
<file>tags/dwine2_full.svg</file>
|
||||||
|
<file>tags/dwine2.png</file>
|
||||||
|
<file>tags/dwine2.svg</file>
|
||||||
|
<file>tags/dwine5_full.svg</file>
|
||||||
|
<file>tags/dwine5.png</file>
|
||||||
<file>tags/dwine5.svg</file>
|
<file>tags/dwine5.svg</file>
|
||||||
<file>tags/logo_icon.svg</file>
|
<file>tags/ubuntu_full.svg</file>
|
||||||
<file>tags/ubuntu-small.png</file>
|
|
||||||
<file>tags/ubuntu.png</file>
|
<file>tags/ubuntu.png</file>
|
||||||
<file>tags/uos-authorize.svg</file>
|
<file>tags/ubuntu.svg</file>
|
||||||
<file>tags/uos-small.png</file>
|
<file>tags/uos_full.svg</file>
|
||||||
|
<file>tags/uos.png</file>
|
||||||
<file>tags/uos.svg</file>
|
<file>tags/uos.svg</file>
|
||||||
<file>translations/qtwebengine_zh.qm</file>
|
<file>translations/qtwebengine_zh.qm</file>
|
||||||
<file>tags/debian.svg</file>
|
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
@@ -20,6 +20,6 @@
|
|||||||
"description": "Fix 1 detailed description..."
|
"description": "Fix 1 detailed description..."
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"linkUrl": "https://gitee.com/deepin-community-store/spark-store/releases/",
|
"linkUrl": "https://gitee.com/spark-store-project/spark-store/releases/",
|
||||||
"linkButtonVisible": true
|
"linkButtonVisible": true
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 4.7 KiB |
18
src/main.cpp
@@ -142,18 +142,18 @@ int main(int argc, char *argv[])
|
|||||||
// 龙芯机器配置,使得 DApplication 能正确加载 QtWebEngine
|
// 龙芯机器配置,使得 DApplication 能正确加载 QtWebEngine
|
||||||
qputenv("DTK_FORCE_RASTER_WIDGETS", "FALSE");
|
qputenv("DTK_FORCE_RASTER_WIDGETS", "FALSE");
|
||||||
|
|
||||||
|
// 设置 QtWebEngine 环境变量
|
||||||
|
QStringList chromium_flags;
|
||||||
// 浏览器开启 GPU 支持
|
// 浏览器开启 GPU 支持
|
||||||
// qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-features=UseModernMediaControls");
|
// chromium_flags.append("--disable-features=UseModernMediaControls");
|
||||||
// qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-web-security");
|
// chromium_flags.append("--disable-web-security");
|
||||||
// 全平台软件渲染Webkit
|
// 全平台软件渲染Webkit
|
||||||
qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-gpu");
|
chromium_flags.append("--disable-gpu");
|
||||||
#ifdef __sw_64__
|
#if defined __sw_64__ || __loongarch__
|
||||||
qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--no-sandbox");
|
chromium_flags.append("--no-sandbox");
|
||||||
#endif
|
#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
|
* NOTE: https://zhuanlan.zhihu.com/p/550285855
|
||||||
* 避免 wayland 环境下从 QtWebEngine 后退回到 QWidget 时黑屏闪烁
|
* 避免 wayland 环境下从 QtWebEngine 后退回到 QWidget 时黑屏闪烁
|
||||||
@@ -163,8 +163,6 @@ int main(int argc, char *argv[])
|
|||||||
DApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);
|
DApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
||||||
// 开启 Hidpi 支持
|
// 开启 Hidpi 支持
|
||||||
qDebug() << "Enable HiDPI Support.";
|
qDebug() << "Enable HiDPI Support.";
|
||||||
|
|||||||
@@ -562,7 +562,7 @@ void AppIntoPage::on_pushButton_3_clicked()
|
|||||||
ui->pushButton_3->setEnabled(false);
|
ui->pushButton_3->setEnabled(false);
|
||||||
|
|
||||||
QProcess uninstall;
|
QProcess uninstall;
|
||||||
uninstall.start("pkexec", QStringList() << "apt" << "autopurge" << "-y" << info["Pkgname"].toString().toLower());
|
uninstall.start("pkexec", QStringList() << "/opt/durapps/spark-store/bin/store-helper/uninstaller" << info["Pkgname"].toString().toLower());
|
||||||
uninstall.waitForFinished(-1);
|
uninstall.waitForFinished(-1);
|
||||||
uninstall.close();
|
uninstall.close();
|
||||||
|
|
||||||
@@ -595,16 +595,6 @@ void AppIntoPage::on_shareButton_clicked()
|
|||||||
|
|
||||||
void AppIntoPage::on_updateButton_clicked()
|
void AppIntoPage::on_updateButton_clicked()
|
||||||
{
|
{
|
||||||
QString feedbackSpk = "spk://store/chat/store.spark-app.feedback";
|
QString feedbackURL = "https://bbs.spark-app.store/";
|
||||||
QFileInfo actionSubmissionClientStatus("/opt/durapps/store.spark-app.feedback");
|
QProcess::startDetached("xdg-open", QStringList{feedbackURL});
|
||||||
if (actionSubmissionClientStatus.exists() && actionSubmissionClientStatus.isDir())
|
|
||||||
{
|
|
||||||
qDebug() << "反馈器存在";
|
|
||||||
QProcess::startDetached("sh", QStringList() << "/opt/durapps/store.spark-app.feedback/launch.sh");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qDebug() << "反馈器不存在,跳转页面";
|
|
||||||
openUrl(feedbackSpk);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -363,6 +363,19 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_9">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
@@ -383,7 +396,7 @@
|
|||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>16777215</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@@ -392,8 +405,8 @@
|
|||||||
<property name="whatsThis">
|
<property name="whatsThis">
|
||||||
<string><html><head/><body><p>Capable to Ubuntu 22.04</p></body></html></string>
|
<string><html><head/><body><p>Capable to Ubuntu 22.04</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="pixmap">
|
||||||
<string><html><head/><body><p><img src=":/tags/ubuntu.png" height=40 width=40 /></p></body></html></string>
|
<pixmap resource="../assets/assets.qrc">:/tags/ubuntu.png</pixmap>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -402,7 +415,7 @@
|
|||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>16777215</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@@ -411,8 +424,8 @@
|
|||||||
<property name="whatsThis">
|
<property name="whatsThis">
|
||||||
<string><html><head/><body><p>Capable to UOS home 20</p></body></html></string>
|
<string><html><head/><body><p>Capable to UOS home 20</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="pixmap">
|
||||||
<string><html><head/><body><p><img src=":/tags/uos-authorize.svg" height=40 width=40 /></p></body></html></string>
|
<pixmap resource="../assets/assets.qrc">:/tags/uos.png</pixmap>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -421,7 +434,7 @@
|
|||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>16777215</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@@ -430,21 +443,27 @@
|
|||||||
<property name="whatsThis">
|
<property name="whatsThis">
|
||||||
<string><html><head/><body><p>Capable to deepin 23</p></body></html></string>
|
<string><html><head/><body><p>Capable to deepin 23</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="pixmap">
|
||||||
<string><html><head/><body><p><img src=":/tags/deepin.svg" height=40 width=40 /></p></body></html></string>
|
<pixmap resource="../assets/assets.qrc">:/tags/deepin.png</pixmap>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="tag_debian">
|
<widget class="QLabel" name="tag_debian">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Capable to Debian Stable</p></body></html></string>
|
<string><html><head/><body><p>Capable to Debian Stable</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="whatsThis">
|
<property name="whatsThis">
|
||||||
<string><html><head/><body><p>Capable to Debian Stable</p></body></html></string>
|
<string><html><head/><body><p>Capable to Debian Stable</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="pixmap">
|
||||||
<string><html><head/><body><p><img src=":/tags/debian.svg" height=40 width=40 /></p></body></html></string>
|
<pixmap resource="../assets/assets.qrc">:/tags/debian.png</pixmap>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -463,22 +482,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer_9">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Expanding</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||||
<item>
|
<item>
|
||||||
@@ -499,7 +502,7 @@
|
|||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>16777215</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@@ -508,8 +511,8 @@
|
|||||||
<property name="whatsThis">
|
<property name="whatsThis">
|
||||||
<string><html><head/><body><p>An Appimage to deb app.</p></body></html></string>
|
<string><html><head/><body><p>An Appimage to deb app.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="pixmap">
|
||||||
<string><html><head/><body><p><img src=":/tags/a2d.png"height=40 width=40 /></p></body></html></string>
|
<pixmap resource="../assets/assets.qrc">:/tags/a2d.png</pixmap>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -518,7 +521,7 @@
|
|||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>16777215</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@@ -527,8 +530,8 @@
|
|||||||
<property name="whatsThis">
|
<property name="whatsThis">
|
||||||
<string><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></string>
|
<string><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></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="pixmap">
|
||||||
<string><html><head/><body><p><img src=":/tags/community.svg" height=40 width=40 /></p></body></html></string>
|
<pixmap resource="../assets/assets.qrc">:/tags/community.png</pixmap>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -537,7 +540,7 @@
|
|||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>16777215</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@@ -546,8 +549,8 @@
|
|||||||
<property name="whatsThis">
|
<property name="whatsThis">
|
||||||
<string><html><head/><body><p>This is a DTK5 app,which means it would have better effect on Deepin Desktop Environment</p></body></html></string>
|
<string><html><head/><body><p>This is a DTK5 app,which means it would have better effect on Deepin Desktop Environment</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="pixmap">
|
||||||
<string><html><head/><body><p><img src=":/tags/logo_icon.svg" height=40 width=40 /></p></body></html></string>
|
<pixmap resource="../assets/assets.qrc">:/tags/dtk.png</pixmap>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -556,7 +559,7 @@
|
|||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>16777215</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@@ -565,8 +568,8 @@
|
|||||||
<property name="whatsThis">
|
<property name="whatsThis">
|
||||||
<string><html><head/><body><p>A deepin-wine2 app. Spark Store will automatically configure the wine kit for you.</p></body></html></string>
|
<string><html><head/><body><p>A deepin-wine2 app. Spark Store will automatically configure the wine kit for you.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="pixmap">
|
||||||
<string><html><head/><body><p><img src=":/tags/dwine2-small.png" height=40 width=40 ></p></body></html></string>
|
<pixmap resource="../assets/assets.qrc">:/tags/dwine2.png</pixmap>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -575,7 +578,7 @@
|
|||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>16777215</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@@ -584,8 +587,8 @@
|
|||||||
<property name="whatsThis">
|
<property name="whatsThis">
|
||||||
<string><html><head/><body><p>A Wine app.Spark Store will automatically configure the wine kit for you</p></body></html></string>
|
<string><html><head/><body><p>A Wine app.Spark Store will automatically configure the wine kit for you</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="pixmap">
|
||||||
<string><html><head/><body><p><img src=":/tags/dwine5.svg" height=40 width=40 /></p></body></html></string>
|
<pixmap resource="../assets/assets.qrc">:/tags/dwine5.png</pixmap>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -1449,6 +1452,8 @@ QListWidget::item::selected
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources>
|
||||||
|
<include location="../assets/assets.qrc"/>
|
||||||
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ void Utils::setQPAPlatform()
|
|||||||
// }
|
// }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qputenv("QT_QPA_PLATFORM", "dxcb");
|
qputenv("QT_QPA_PLATFORM", "dxcb;xcb");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -186,12 +186,21 @@ VERBOSE_OUTPUT=
|
|||||||
# Download command.
|
# Download command.
|
||||||
_DOWNLOADER='aria2c --no-conf -c -j ${_MAXNUM} -x ${_MAXCONPERSRV} -s ${_SPLITCON} -i ${DLLIST} --min-split-size=${_MINSPLITSZ} --stream-piece-selector=${_PIECEALGO} --connect-timeout=60 --timeout=600 -m0'
|
_DOWNLOADER='aria2c --no-conf -c -j ${_MAXNUM} -x ${_MAXCONPERSRV} -s ${_SPLITCON} -i ${DLLIST} --min-split-size=${_MINSPLITSZ} --stream-piece-selector=${_PIECEALGO} --connect-timeout=60 --timeout=600 -m0'
|
||||||
|
|
||||||
# Load config file.
|
# 定义默认的配置文件列表(按加载顺序排列)
|
||||||
CONFFILE="/tmp/aptss-conf/apt-fast.conf"
|
CONFIG_FILES=(
|
||||||
#### Spark Store apt-fast conf is in /tmp
|
"/tmp/aptss-conf/apt-fast.conf" # 原始配置文件位置
|
||||||
if [ -e "$CONFFILE" ]; then
|
"/etc/aptss/apt-fast.conf" # 系统级配置
|
||||||
source "$CONFFILE"
|
)
|
||||||
fi
|
|
||||||
|
|
||||||
|
# 按顺序加载所有配置文件
|
||||||
|
for conf_file in "${CONFIG_FILES[@]}"; do
|
||||||
|
if [ -e "$conf_file" ]; then
|
||||||
|
source "$conf_file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# no proxy as default
|
# no proxy as default
|
||||||
ftp_proxy=
|
ftp_proxy=
|
||||||
@@ -367,15 +376,15 @@ prepare_auth(){
|
|||||||
AUTH_INFO_PARSED+=("$machine $login $password")
|
AUTH_INFO_PARSED+=("$machine $login $password")
|
||||||
done <<< "$auth_info"
|
done <<< "$auth_info"
|
||||||
done
|
done
|
||||||
|
if [ "${#AUTH_INFO_PARSED[@]}" -eq 0 ]; then
|
||||||
|
# acts like auth disabled when no auth info is provided to improve performance
|
||||||
|
APT_FAST_APT_AUTH=0
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Gets URI as parameter and tries to add basic http credentials. Will fail on
|
# Gets URI as parameter and tries to add basic http credentials. Will fail on
|
||||||
# credentials that contain characters that need URL-encoding.
|
# credentials that contain characters that need URL-encoding.
|
||||||
get_auth(){
|
get_auth(){
|
||||||
if [ "$APT_FAST_APT_AUTH" -eq 0 ]; then
|
|
||||||
echo "$1"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
for auth_info in "${AUTH_INFO_PARSED[@]}"; do
|
for auth_info in "${AUTH_INFO_PARSED[@]}"; do
|
||||||
# convert to array, don't escape variable here
|
# convert to array, don't escape variable here
|
||||||
auth_info_arr=($auth_info)
|
auth_info_arr=($auth_info)
|
||||||
@@ -430,44 +439,40 @@ get_uris(){
|
|||||||
CLEANUP_STATE="$?"
|
CLEANUP_STATE="$?"
|
||||||
if [ "$CLEANUP_STATE" -ne 0 ]
|
if [ "$CLEANUP_STATE" -ne 0 ]
|
||||||
then
|
then
|
||||||
msg "Package manager quit with exit code.Here is the log" "warning"
|
msg "Package manager quit with exit code. Here is the log" "warning"
|
||||||
msg "包管理器以错误代码退出.日志如下" "warning"
|
msg "包管理器以错误代码退出.日志如下" "warning"
|
||||||
msg "${uris_full}"
|
msg "${uris_full}"
|
||||||
exit "$CLEANUP_STATE"
|
exit "$CLEANUP_STATE"
|
||||||
fi
|
fi
|
||||||
prepare_auth
|
prepare_auth
|
||||||
local tmpdir=$(mktemp -d) || {
|
local tmpdir
|
||||||
|
tmpdir=$(mktemp -d) || {
|
||||||
msg "Failed to create tmp dir" "warning"
|
msg "Failed to create tmp dir" "warning"
|
||||||
msg "无法创建临时目录" "warning"
|
msg "无法创建临时目录" "warning"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
## --print-uris format is:
|
## --print-uris format is:
|
||||||
# 'fileurl' filename filesize checksum_hint:filechecksum
|
# 'fileurl' filename filesize checksum_hint:filechecksum
|
||||||
|
# 修改:process_package函数增加第二个参数表示当前线程的临时输出文件
|
||||||
process_package() {
|
process_package() {
|
||||||
local pkg_uri_info="$@"
|
local pkg_uri_info="$1"
|
||||||
|
local thread_file="$2"
|
||||||
local display_line="" # 添加局部变量并初始化为空
|
local display_line="" # 初始化显示信息为空
|
||||||
|
|
||||||
IFS=' ' read -r uri filename filesize checksum_string _ <<<"$pkg_uri_info"
|
IFS=' ' read -r uri filename filesize checksum_string _ <<<"$pkg_uri_info"
|
||||||
[ -z "$uri" ] && continue
|
[ -z "$uri" ] && return
|
||||||
uri="$(get_auth "${uri//"'"/}")"
|
uri="${uri//"'"/}"
|
||||||
|
[ "$APT_FAST_APT_AUTH" -ne 0 ] && uri="$(get_auth "$uri")"
|
||||||
IFS=':' read -r hash_algo checksum _ <<<"$checksum_string"
|
IFS=':' read -r hash_algo checksum _ <<<"$checksum_string"
|
||||||
|
|
||||||
filename_decoded="$(urldecode "$filename")"
|
if [[ "$filename" == *%* ]]; then
|
||||||
|
# decode url string
|
||||||
|
filename_decoded="$(printf '%b' "${filename//%/\\x}")"
|
||||||
|
else
|
||||||
|
filename_decoded="$filename"
|
||||||
|
fi
|
||||||
IFS='_' read -r pkg_name_decoded pkg_version_decoded _ <<<"$filename_decoded"
|
IFS='_' read -r pkg_name_decoded pkg_version_decoded _ <<<"$filename_decoded"
|
||||||
|
|
||||||
|
display_line+="$pkg_name_decoded $pkg_version_decoded $filesize\n"
|
||||||
|
|
||||||
display_line="${display_line}$pkg_name_decoded $pkg_version_decoded"
|
|
||||||
display_line="${display_line} $(echo "$filesize" | numfmt --to=iec-i --suffix=B)\n"
|
|
||||||
|
|
||||||
## whole uri comes encoded (urlencoded). Filename must NOT be decoded because
|
|
||||||
# plain aptitude do not decode it when download and install it. Therefore, we
|
|
||||||
# will have ugly named packages at /var/cache/apt/archives but is the standard
|
|
||||||
# behavior.
|
|
||||||
# But package version must be decoded, otherways package=version calls will
|
|
||||||
# not work.
|
|
||||||
|
|
||||||
if [ -n "$HASH_SUPPORTED" ]; then
|
if [ -n "$HASH_SUPPORTED" ]; then
|
||||||
case "$hash_algo" in
|
case "$hash_algo" in
|
||||||
SHA512) [ -z "$SHA512_SUPPORTED" ] && hash_algo= || hash_algo=sha-512 ;;
|
SHA512) [ -z "$SHA512_SUPPORTED" ] && hash_algo= || hash_algo=sha-512 ;;
|
||||||
@@ -522,30 +527,27 @@ get_uris(){
|
|||||||
hash_algo=
|
hash_algo=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# 原来利用文件锁写入,现在改为写入当前线程的临时文件
|
||||||
# 使用文件锁安全写入下载列表
|
|
||||||
(
|
|
||||||
flock -x 200 # 获取排他锁
|
|
||||||
{
|
{
|
||||||
get_mirrors "$uri"
|
get_mirrors "$uri"
|
||||||
[ -n "$hash_algo" ] && echo " checksum=$hash_algo=$checksum"
|
[ -n "$hash_algo" ] && echo " checksum=$hash_algo=$checksum"
|
||||||
echo " out=$filename"
|
echo " out=$filename"
|
||||||
} >> "$DLLIST"
|
} >> "$thread_file"
|
||||||
) 200>>"$DLLIST" # 使用文件描述符200关联锁文件
|
|
||||||
|
|
||||||
# 将显示信息和文件大小存入临时文件
|
echo -e "$display_line" >> "$tmpdir/display"
|
||||||
echo "$display_line" >> "$tmpdir/display"
|
|
||||||
echo "$filesize" >> "$tmpdir/sizes"
|
echo "$filesize" >> "$tmpdir/sizes"
|
||||||
}
|
}
|
||||||
|
|
||||||
# 主并行处理逻辑(新增线程控制)
|
# 主并行处理逻辑
|
||||||
mapfile -t pkg_uri_list < <(echo "$uris_full" | grep -E "^'(http(s|)|(s|)ftp)://")
|
mapfile -t pkg_uri_list < <(echo "$uris_full" | grep -E "^'(http(s|)|(s|)ftp)://")
|
||||||
total_pkgs=${#pkg_uri_list[@]}
|
total_pkgs=${#pkg_uri_list[@]}
|
||||||
threads=${THREADS:-4} # 默认4线程
|
threads=${THREADS:-4} # 默认4线程
|
||||||
per_thread=$(( (total_pkgs + threads - 1) / threads )) # 向上取整
|
per_thread=$(( (total_pkgs + threads - 1) / threads )) # 向上取整
|
||||||
|
|
||||||
# 分割任务到不同线程
|
# 分配任务到不同线程,每个线程使用自己的临时文件
|
||||||
for ((i=0; i<threads; i++)); do
|
for ((i=0; i<threads; i++)); do
|
||||||
|
thread_file="${DLLIST}.thread.${i}"
|
||||||
|
> "$thread_file" # 清空或创建临时文件
|
||||||
start=$((i * per_thread))
|
start=$((i * per_thread))
|
||||||
end=$((start + per_thread -1))
|
end=$((start + per_thread -1))
|
||||||
[ $end -ge $total_pkgs ] && end=$((total_pkgs -1))
|
[ $end -ge $total_pkgs ] && end=$((total_pkgs -1))
|
||||||
@@ -554,7 +556,7 @@ get_uris(){
|
|||||||
(
|
(
|
||||||
for ((j=start; j<=end; j++)); do
|
for ((j=start; j<=end; j++)); do
|
||||||
[ -z "${pkg_uri_list[j]}" ] && continue
|
[ -z "${pkg_uri_list[j]}" ] && continue
|
||||||
process_package "${pkg_uri_list[j]}"
|
process_package "${pkg_uri_list[j]}" "$thread_file"
|
||||||
done
|
done
|
||||||
) &
|
) &
|
||||||
done
|
done
|
||||||
@@ -562,6 +564,15 @@ get_uris(){
|
|||||||
# 等待所有后台任务完成
|
# 等待所有后台任务完成
|
||||||
wait
|
wait
|
||||||
|
|
||||||
|
# 合并所有线程的临时文件到最终的 $DLLIST 中(保留之前添加的 header)
|
||||||
|
for ((i=0; i<threads; i++)); do
|
||||||
|
thread_file="${DLLIST}.thread.${i}"
|
||||||
|
if [ -f "$thread_file" ]; then
|
||||||
|
cat "$thread_file" >> "$DLLIST"
|
||||||
|
rm -f "$thread_file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# 合并显示信息
|
# 合并显示信息
|
||||||
if [ -f "$tmpdir/display" ]; then
|
if [ -f "$tmpdir/display" ]; then
|
||||||
DOWNLOAD_DISPLAY+="\n$(cat "$tmpdir/display")"
|
DOWNLOAD_DISPLAY+="\n$(cat "$tmpdir/display")"
|
||||||
@@ -574,12 +585,10 @@ get_uris(){
|
|||||||
|
|
||||||
# 清理临时目录
|
# 清理临时目录
|
||||||
rm -rf "$tmpdir"
|
rm -rf "$tmpdir"
|
||||||
|
|
||||||
#cat "$DLLIST"
|
|
||||||
#exit
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
display_downloadfile(){
|
display_downloadfile(){
|
||||||
if [ -n "$VERBOSE_OUTPUT" ]; then
|
if [ -n "$VERBOSE_OUTPUT" ]; then
|
||||||
cat "$DLLIST"
|
cat "$DLLIST"
|
||||||
@@ -590,7 +599,7 @@ display_downloadfile(){
|
|||||||
while IFS=' ' read -r pkg ver size _; do
|
while IFS=' ' read -r pkg ver size _; do
|
||||||
[ -z "$pkg" ] && continue
|
[ -z "$pkg" ] && continue
|
||||||
printf '%s%-40s %-20s %10s\n' "$aptfast_prefix" "$pkg" "$ver" "$size"
|
printf '%s%-40s %-20s %10s\n' "$aptfast_prefix" "$pkg" "$ver" "$size"
|
||||||
done <<<"$(echo -e "$DOWNLOAD_DISPLAY" | sort "${DISPLAY_SORT_OPTIONS[@]}")"
|
done <<<"$(echo -e "$DOWNLOAD_DISPLAY" | sort "${DISPLAY_SORT_OPTIONS[@]}" | numfmt --to=iec-i --suffix=B --field=3)"
|
||||||
fi
|
fi
|
||||||
msg "Download size: $(echo "$DOWNLOAD_SIZE" | numfmt --to=iec-i --suffix=B)" "normal"
|
msg "Download size: $(echo "$DOWNLOAD_SIZE" | numfmt --to=iec-i --suffix=B)" "normal"
|
||||||
msg "下载大小: $(echo "$DOWNLOAD_SIZE" | numfmt --to=iec-i --suffix=B)" "normal"
|
msg "下载大小: $(echo "$DOWNLOAD_SIZE" | numfmt --to=iec-i --suffix=B)" "normal"
|
||||||
@@ -827,3 +836,4 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# After error or all done remove our lockfile (done with EXIT trap)
|
# After error or all done remove our lockfile (done with EXIT trap)
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ source /opt/durapps/spark-store/bin/bashimport/log.amber
|
|||||||
load_transhell
|
load_transhell
|
||||||
|
|
||||||
case `arch` in
|
case `arch` in
|
||||||
x86_64)
|
x86_64 | i686 | i386)
|
||||||
STORE_URL="store"
|
STORE_URL="store"
|
||||||
STORE_LIST_URL=""
|
STORE_LIST_URL=""
|
||||||
;;
|
;;
|
||||||
|
|||||||
489
tool/ssaudit
@@ -1,149 +1,454 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# 初始化常量和全局变量
|
||||||
|
readonly SPARK_DOWNLOAD_SERVER_URL="https://d.spark-app.store/"
|
||||||
|
readonly SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL="d.spark-app.store"
|
||||||
|
# ACE环境配置 - 修改此数组即可添加或删除支持的环境
|
||||||
|
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"
|
||||||
|
)
|
||||||
|
# 生成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
|
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
|
load_transhell_debug
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
# 根据架构设置仓库URL
|
||||||
case $(arch) in
|
case $(arch) in
|
||||||
x86_64)
|
x86_64) STORE_URL="store" ;;
|
||||||
STORE_URL="store"
|
aarch64) STORE_URL="aarch64-store" ;;
|
||||||
;;
|
loongarch64) STORE_URL="loong64-store" ;;
|
||||||
aarch64)
|
|
||||||
STORE_URL="aarch64-store"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
# 帮助函数
|
||||||
echo "Spark Store Install script. 星火商店审核脚本"
|
function show_help() {
|
||||||
|
echo "Spark Store Audit script. 星火商店审核脚本"
|
||||||
function pkexec_as_current_user() {
|
echo "用法: $0 [选项] <deb路径>"
|
||||||
local user=$(who | awk '{print $1}' | head -n 1)
|
echo "选项:"
|
||||||
local uid=$(id -u "$user")
|
echo " -h, --help 显示帮助信息"
|
||||||
sudo -u "$user" DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/"$uid"/bus pkexec "$@"
|
echo " --delete-after-install 安装成功后删除软件包"
|
||||||
|
echo " --no-create-desktop-entry 不创建桌面快捷方式"
|
||||||
|
echo " --force-create-desktop-entry 强制创建桌面快捷方式"
|
||||||
|
echo "$(generate_ace_help)"
|
||||||
|
echo " --native 只在主机安装,不使用ACE容器"
|
||||||
}
|
}
|
||||||
function create_desktop_file() {
|
# 参数解析
|
||||||
local user=$(who | awk '{print $1}' | head -n 1)
|
function parse_args() {
|
||||||
if [ -e $(sudo -u "$user" xdg-user-dir)/.config/spark-union/spark-store/ssshell-config-do-not-create-desktop ];then
|
while [ $# -gt 0 ]; do
|
||||||
echo "It is configured that do not create desktop file. Give up"
|
case "$1" in
|
||||||
else
|
-h|--help)
|
||||||
exec_create_desktop_file
|
show_help
|
||||||
fi
|
exit 0
|
||||||
}
|
;;
|
||||||
function exec_create_desktop_file() {
|
--delete-after-install)
|
||||||
local user=$(who | awk '{print $1}' | head -n 1)
|
DELETE_AFTER_INSTALL="1"
|
||||||
for desktop_file_path in $(dpkg -L "$package_name" |grep /usr/share/applications/ | awk '/\.desktop$/ {print}'); do
|
shift
|
||||||
if [ "$(cat $desktop_file_path | grep NoDisplay=true)" = "" ];then
|
;;
|
||||||
echo $desktop_file_path is checked and will be installed to desktop
|
--native)
|
||||||
sudo -u "$user" cp "$desktop_file_path" "$(sudo -u "$user" xdg-user-dir DESKTOP)/"
|
FORCE_NATIVE="1"
|
||||||
fi
|
shift
|
||||||
done
|
;;
|
||||||
for desktop_file_path in $(dpkg -L "$package_name" |grep /opt/apps/$package_name/entries/applications | awk '/\.desktop$/ {print}'); do
|
--no-create-desktop-entry)
|
||||||
if [ "$(cat $desktop_file_path | grep NoDisplay=true)" = "" ];then
|
NO_CREATE_DESKTOP="1"
|
||||||
echo $desktop_file_path is checked and will be installed to desktop
|
shift
|
||||||
chmod +x $desktop_file_path
|
;;
|
||||||
sudo -u "$user" cp "$desktop_file_path" "$(sudo -u "$user" xdg-user-dir DESKTOP)/"
|
--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
|
||||||
|
FORCE_ACE_ENV="${ace_entry%%:*}"
|
||||||
|
is_ace_param=1
|
||||||
|
shift
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# 如果不是ACE参数,则视为DEB路径
|
||||||
|
if [ "$is_ace_param" -eq 0 ]; then
|
||||||
|
DEBPATH="$1"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function zenity() {
|
# 验证当前用户
|
||||||
local user=$(who | awk '{print $1}' | head -n 1)
|
function validate_user() {
|
||||||
local uid=$(id -u "$user")
|
if [ "$(id -u)" != "0" ]; then
|
||||||
sudo -u "$user" DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/"$uid"/bus zenity "$@"
|
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() {
|
function hash_check() {
|
||||||
if [ ! -e "/var/lib/aptss/lists/cdn.d.store.deepinos.org.cn_${STORE_URL}_Packages" ] && \
|
local PACKAGES_DATA_PATH=""
|
||||||
[ ! -e "/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" ] && \
|
|
||||||
[ ! -e "/var/lib/aptss/lists/mirrors.sdu.edu.cn_spark-store-repository_${STORE_URL}_Packages" ]; then
|
|
||||||
echo "接收星火仓库软件信息中..."
|
|
||||||
aptss ssupdate
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -e "/var/lib/aptss/lists/cdn.d.store.deepinos.org.cn_${STORE_URL}_Packages" ]; then
|
# 检查可能的仓库位置
|
||||||
PACKAGES_DATA_PATH="/var/lib/aptss/lists/cdn.d.store.deepinos.org.cn_${STORE_URL}_Packages"
|
if [ -e "/var/lib/aptss/lists/${SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL}_${STORE_URL}_Packages" ]; then
|
||||||
echo "星火仓库的Packages位置为 $PACKAGES_DATA_PATH,是星火域名单目录仓库配置"
|
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
|
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"
|
PACKAGES_DATA_PATH="/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages"
|
||||||
echo "星火仓库的Packages位置为 $PACKAGES_DATA_PATH,是星火域名单目录仓库配置"
|
|
||||||
else
|
else
|
||||||
PACKAGES_DATA_PATH="/var/lib/aptss/lists/mirrors.sdu.edu.cn_spark-store-repository_${STORE_URL}_Packages"
|
PACKAGES_DATA_PATH="/var/lib/aptss/lists/mirrors.sdu.edu.cn_spark-store-repository_${STORE_URL}_Packages"
|
||||||
echo "星火仓库的Packages位置为 $PACKAGES_DATA_PATH,是SDU镜像仓库配置"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "正在运行包验证..."
|
echo "正在运行包验证..."
|
||||||
echo "Running Spark Package Verify..."
|
echo "Running Spark Package Verify..."
|
||||||
|
|
||||||
DEB_SHA512SUM=$(sha512sum "$1" | cut -d ' ' -f 1)
|
DEB_SHA512SUM=$(sha512sum "$1" | cut -d ' ' -f 1)
|
||||||
IS_SHA512SUM_CHECKED=$(cat "$PACKAGES_DATA_PATH" | grep "$DEB_SHA512SUM")
|
unset IS_SHA512SUM_CHECKED
|
||||||
|
IS_SHA512SUM_CHECKED=$(grep -F "$DEB_SHA512SUM" "$PACKAGES_DATA_PATH")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 确保aptss存在
|
||||||
|
function ensure_aptss_exist() {
|
||||||
|
if ! command -v aptss &>/dev/null; then
|
||||||
|
local deb_file="/tmp/spark-store-console-in-container_latest_all.deb"
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
####################################
|
if ! apt install -y "$deb_file"; then
|
||||||
|
echo "安装 .deb 包失败" >&2
|
||||||
|
rm -f "$deb_file"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
rm -f "$deb_file"
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
if ! command -v aptss &>/dev/null; then
|
||||||
echo "没有接收到参数,退出"
|
echo "成功安装但未找到 aptss 命令" >&2
|
||||||
echo "用法:$0 deb路径"
|
return 1
|
||||||
echo "OMG-IT-GOES-WRONG"
|
fi
|
||||||
exit
|
fi
|
||||||
fi
|
}
|
||||||
|
export -f ensure_aptss_exist
|
||||||
|
|
||||||
if [ ! -f "$1" ]; then
|
# 确保ACE环境存在
|
||||||
echo "${TRANSHELL_CONTENT_FILE_NOT_EXIST}"
|
function ensure_ace_env() {
|
||||||
echo "OMG-IT-GOES-WRONG"
|
local ace_env_pkg="${1}"
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$(id -u)" != "0" ]; then
|
if ! dpkg -l "$ace_env_pkg" &>/dev/null; then
|
||||||
echo "${TRANSHELL_CONTENT_PLEASE_RUN_AS_ROOT}"
|
echo "ACE环境$ace_env_pkg未安装,正在尝试安装..."
|
||||||
echo "OMG-IT-GOES-WRONG"
|
zenity --info --text="首次使用$ace_env_pkg环境,重启或注销桌面后才能在启动器中展示,不影响应用启动。安装将在后台继续。" --title="ACE环境安装" &
|
||||||
exit 1
|
if ! aptss install -y "$ace_env_pkg"; then
|
||||||
fi
|
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
|
||||||
|
|
||||||
DEBPATH=$(realpath "$1")
|
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$'))
|
||||||
|
|
||||||
package_name=$(dpkg-deb -f "$DEBPATH" Package)
|
for desktop_file_path in "${desktop_files[@]}"; do
|
||||||
echo "Package name is $package_name"
|
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
|
||||||
|
|
||||||
try_run_output=$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh test-install-app "$DEBPATH")
|
# 在ACE环境中创建桌面快捷方式
|
||||||
try_run_ret="$?"
|
function create_desktop_in_ace() {
|
||||||
if [ "$try_run_ret" -ne 0 ]; then
|
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
|
||||||
|
echo "根据ACE环境中的配置,跳过创建桌面快捷方式"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 在指定ACE环境中安装
|
||||||
|
function install_in_ace_env() {
|
||||||
|
local ace_cmd="$1"
|
||||||
|
local deb_path="$2"
|
||||||
|
local ace_env_pkg="${3#*:}"
|
||||||
|
|
||||||
|
if ! ensure_ace_env "$ace_env_pkg"; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "----------------------------------------"
|
||||||
|
echo "正在尝试使用 $ace_cmd 环境安装..."
|
||||||
|
echo "----------------------------------------"
|
||||||
|
|
||||||
|
# 在ACE环境中执行安装
|
||||||
|
if $ace_cmd "ensure_aptss_exist && { dpkg -i '$deb_path' || aptss install '$deb_path' -yfq; }"; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
# 如果第一次安装失败,执行aptss update后再试一次
|
||||||
|
echo "第一次安装失败,正在更新仓库信息后重试..."
|
||||||
|
$ace_cmd "aptss update"
|
||||||
|
if $ace_cmd "dpkg -i '$deb_path' || aptss install '$deb_path' -yfq"; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 在主机安装
|
||||||
|
function install_in_host() {
|
||||||
|
local deb_path="$1"
|
||||||
|
|
||||||
|
if dpkg -i "$deb_path" || aptss install "$deb_path" -yfq; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
# 如果第一次安装失败,执行aptss update后再试一次
|
||||||
|
echo "第一次安装失败,正在更新仓库信息后重试..."
|
||||||
aptss update
|
aptss update
|
||||||
try_run_output=$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh test-install-app "$DEBPATH")
|
if dpkg -i "$deb_path" || aptss install "$deb_path" -yfq; then
|
||||||
try_run_ret="$?"
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 自动尝试在各种环境中安装
|
||||||
|
function auto_try_install() {
|
||||||
|
local deb_path="$1"
|
||||||
|
|
||||||
|
# 首先尝试在主机安装
|
||||||
|
if install_in_host "$deb_path"; then
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$try_run_ret" -ne 0 ]; then
|
# 如果主机安装失败且不在强制本地模式,尝试ACE环境
|
||||||
echo "OMG-IT-GOES-WRONG"
|
if [ "$FORCE_NATIVE" -eq 0 ]; then
|
||||||
echo -e "${try_run_output}"
|
for ace_entry in "${ACE_ENVIRONMENTS_FOR_AUTOINSTALL[@]}"; do
|
||||||
exit "$try_run_ret"
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
if [ "$?" = "0" ] && [ "$2" = "--delete-after-install" ]; then
|
# 清理安装后的文件
|
||||||
|
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
|
if dpkg -s "$package_name" >/dev/null 2>&1; then
|
||||||
echo "软件包已安装:$package_name"
|
echo "软件包已在主机安装:$package_name"
|
||||||
create_desktop_file
|
create_desktop_file
|
||||||
rm "$DEBPATH"
|
unlock_file "$deb_path"
|
||||||
|
rm "$deb_path"
|
||||||
echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}"
|
echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}"
|
||||||
else
|
else
|
||||||
echo "软件包未安装:$package_name"
|
echo "软件包未在主机安装:$package_name"
|
||||||
echo "安装异常!抛出错误"
|
echo "安装异常!抛出错误"
|
||||||
echo "OMG-IT-GOES-WRONG"
|
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
|
fi
|
||||||
else
|
else
|
||||||
echo "${TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB}"
|
echo "${TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB}"
|
||||||
if dpkg -s "$package_name" >/dev/null 2>&1; then
|
if [ "$FORCE_NATIVE" -eq 1 ] && ! dpkg -s "$package_name" >/dev/null 2>&1; then
|
||||||
echo "软件包已安装:$package_name"
|
echo "软件包未在主机安装:$package_name"
|
||||||
create_desktop_file
|
|
||||||
else
|
|
||||||
echo "软件包未安装:$package_name"
|
|
||||||
echo "安装异常!抛出错误"
|
echo "安装异常!抛出错误"
|
||||||
echo "OMG-IT-GOES-WRONG"
|
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
|
fi
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 文件锁定/解锁函数
|
||||||
|
function lock_file() {
|
||||||
|
chattr +i "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
function unlock_file() {
|
||||||
|
chattr -i "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# 主安装流程
|
||||||
|
function main_install() {
|
||||||
|
parse_args "$@"
|
||||||
|
|
||||||
|
if [ -z "$DEBPATH" ]; then
|
||||||
|
echo "没有接收到参数,退出"
|
||||||
|
show_help
|
||||||
|
echo "OMG-IT-GOES-WRONG"
|
||||||
|
exit 1
|
||||||
|
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 [ -n "$FORCE_ACE_ENV" ]; then
|
||||||
|
# 查找对应的ACE环境包名
|
||||||
|
local ace_env_pkg=""
|
||||||
|
for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do
|
||||||
|
if [ "${ace_entry%%:*}" = "$FORCE_ACE_ENV" ]; then
|
||||||
|
ace_env_pkg="${ace_entry#*:}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# 强制使用指定的ACE环境安装
|
||||||
|
if command -v "$FORCE_ACE_ENV" >/dev/null 2>&1; then
|
||||||
|
install_in_ace_env "$FORCE_ACE_ENV" "$DEBPATH" "$ace_env_pkg"
|
||||||
|
install_success=$?
|
||||||
|
if [ "$install_success" -eq 0 ]; then
|
||||||
|
create_desktop_in_ace "$FORCE_ACE_ENV" "$package_name"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "指定的ACE环境 $FORCE_ACE_ENV 不可用"
|
||||||
|
echo "OMG-IT-GOES-WRONG"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# 自动选择安装方式
|
||||||
|
auto_try_install "$DEBPATH"
|
||||||
|
install_success=$?
|
||||||
|
fi
|
||||||
|
|
||||||
|
post_install_cleanup "$install_success" "$DEBPATH" "$package_name"
|
||||||
|
}
|
||||||
|
|
||||||
|
# 执行主函数
|
||||||
|
main_install "$@"
|
||||||
|
|||||||
523
tool/ssinstall
@@ -1,81 +1,144 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# 初始化常量和全局变量
|
||||||
|
readonly SPARK_DOWNLOAD_SERVER_URL="https://d.spark-app.store/"
|
||||||
|
readonly SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL="d.spark-app.store"
|
||||||
|
# ACE环境配置 - 修改此数组即可添加或删除支持的环境
|
||||||
|
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"
|
||||||
|
)
|
||||||
|
# 生成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
|
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
|
load_transhell_debug
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
# 根据架构设置仓库URL
|
||||||
trap 'unlock_file $DEBPATH' EXIT
|
|
||||||
case $(arch) in
|
case $(arch) in
|
||||||
x86_64)
|
x86_64) STORE_URL="store" ;;
|
||||||
STORE_URL="store"
|
aarch64) STORE_URL="aarch64-store" ;;
|
||||||
;;
|
loongarch64) STORE_URL="loong64-store" ;;
|
||||||
aarch64)
|
|
||||||
STORE_URL="aarch64-store"
|
|
||||||
;;
|
|
||||||
loongarch64)
|
|
||||||
STORE_URL="loong64-store"
|
|
||||||
STORE_LIST_URL="-loong64"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
# 帮助函数
|
||||||
echo "Spark Store Install script. 星火商店安装脚本"
|
function show_help() {
|
||||||
|
echo "Spark Store Install script. 星火商店安装脚本"
|
||||||
function pkexec_as_current_user() {
|
echo "用法: $0 [选项] <deb路径>"
|
||||||
local user=$(who | awk '{print $1}' | head -n 1)
|
echo "选项:"
|
||||||
local uid=$(id -u "$user")
|
echo " -h, --help 显示帮助信息"
|
||||||
sudo -u "$user" DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/"$uid"/bus pkexec "$@"
|
echo " --delete-after-install 安装成功后删除软件包"
|
||||||
|
echo " --no-create-desktop-entry 不创建桌面快捷方式"
|
||||||
|
echo " --force-create-desktop-entry 强制创建桌面快捷方式"
|
||||||
|
echo "$(generate_ace_help)"
|
||||||
|
echo " --native 只在主机安装,不使用ACE容器"
|
||||||
}
|
}
|
||||||
function create_desktop_file() {
|
# 参数解析
|
||||||
local user=$(who | awk '{print $1}' | head -n 1)
|
function parse_args() {
|
||||||
if [ -e $(sudo -u "$user" xdg-user-dir)/.config/spark-union/spark-store/ssshell-config-do-not-create-desktop ];then
|
while [ $# -gt 0 ]; do
|
||||||
echo "It is configured that do not create desktop file. Give up"
|
case "$1" in
|
||||||
else
|
-h|--help)
|
||||||
exec_create_desktop_file
|
show_help
|
||||||
fi
|
exit 0
|
||||||
}
|
;;
|
||||||
function exec_create_desktop_file() {
|
--delete-after-install)
|
||||||
local user=$(who | awk '{print $1}' | head -n 1)
|
DELETE_AFTER_INSTALL="1"
|
||||||
for desktop_file_path in $(dpkg -L "$package_name" |grep /usr/share/applications/ | awk '/\.desktop$/ {print}'); do
|
shift
|
||||||
if [ "$(cat $desktop_file_path | grep NoDisplay=true)" = "" ];then
|
;;
|
||||||
echo $desktop_file_path is checked and will be installed to desktop
|
--native)
|
||||||
sudo -u "$user" cp "$desktop_file_path" "$(sudo -u "$user" xdg-user-dir DESKTOP)/"
|
FORCE_NATIVE="1"
|
||||||
fi
|
shift
|
||||||
done
|
;;
|
||||||
for desktop_file_path in $(dpkg -L "$package_name" |grep /opt/apps/$package_name/entries/applications | awk '/\.desktop$/ {print}'); do
|
--no-create-desktop-entry)
|
||||||
if [ "$(cat $desktop_file_path | grep NoDisplay=true)" = "" ];then
|
NO_CREATE_DESKTOP="1"
|
||||||
echo $desktop_file_path is checked and will be installed to desktop
|
shift
|
||||||
chmod +x $desktop_file_path
|
;;
|
||||||
sudo -u "$user" cp "$desktop_file_path" "$(sudo -u "$user" xdg-user-dir DESKTOP)/"
|
--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
|
||||||
|
FORCE_ACE_ENV="${ace_entry%%:*}"
|
||||||
|
is_ace_param=1
|
||||||
|
shift
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# 如果不是ACE参数,则视为DEB路径
|
||||||
|
if [ "$is_ace_param" -eq 0 ]; then
|
||||||
|
DEBPATH="$1"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 验证当前用户
|
||||||
function zenity() {
|
function validate_user() {
|
||||||
local user=$(who | awk '{print $1}' | head -n 1)
|
if [ "$(id -u)" != "0" ]; then
|
||||||
local uid=$(id -u "$user")
|
echo "${TRANSHELL_CONTENT_PLEASE_RUN_AS_ROOT}"
|
||||||
sudo -u "$user" DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/"$uid"/bus zenity "$@"
|
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() {
|
function hash_check() {
|
||||||
if [ ! -e "/var/lib/aptss/lists/d.spark-app.store_${STORE_URL}_Packages" ] && \
|
local PACKAGES_DATA_PATH=""
|
||||||
[ ! -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"
|
if [ -e "/var/lib/aptss/lists/${SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL}_${STORE_URL}_Packages" ]; then
|
||||||
echo "星火仓库的Packages位置为 $PACKAGES_DATA_PATH,是星火域名仓库配置"
|
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
|
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"
|
PACKAGES_DATA_PATH="/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages"
|
||||||
echo "星火仓库的Packages位置为 $PACKAGES_DATA_PATH,是d域名单目录仓库配置"
|
|
||||||
else
|
else
|
||||||
PACKAGES_DATA_PATH="/var/lib/aptss/lists/mirrors.sdu.edu.cn_spark-store-repository_${STORE_URL}_Packages"
|
PACKAGES_DATA_PATH="/var/lib/aptss/lists/mirrors.sdu.edu.cn_spark-store-repository_${STORE_URL}_Packages"
|
||||||
echo "星火仓库的Packages位置为 $PACKAGES_DATA_PATH,是SDU镜像仓库配置"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "正在运行包验证..."
|
echo "正在运行包验证..."
|
||||||
@@ -83,58 +146,265 @@ function hash_check() {
|
|||||||
|
|
||||||
DEB_SHA512SUM=$(sha512sum "$1" | cut -d ' ' -f 1)
|
DEB_SHA512SUM=$(sha512sum "$1" | cut -d ' ' -f 1)
|
||||||
unset IS_SHA512SUM_CHECKED
|
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(){
|
# 确保aptss存在
|
||||||
chattr +i "$1"
|
function ensure_aptss_exist() {
|
||||||
|
if ! command -v aptss &>/dev/null; then
|
||||||
|
local deb_file="/tmp/spark-store-console-in-container_latest_all.deb"
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
if ! apt install -y "$deb_file"; then
|
||||||
|
echo "安装 .deb 包失败" >&2
|
||||||
|
rm -f "$deb_file"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
rm -f "$deb_file"
|
||||||
|
|
||||||
|
if ! command -v aptss &>/dev/null; then
|
||||||
|
echo "成功安装但未找到 aptss 命令" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
export -f ensure_aptss_exist
|
||||||
|
|
||||||
function unlock_file(){
|
# 确保ACE环境存在
|
||||||
chattr -i "$1"
|
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
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
exec_create_desktop_file
|
||||||
echo "没有接收到参数,退出"
|
}
|
||||||
echo "用法:$0 deb路径"
|
export CURRENT_USER_DIR_DESKTOP=$(sudo -u "$user" xdg-user-dir DESKTOP)
|
||||||
echo "OMG-IT-GOES-WRONG"
|
function exec_create_desktop_file() {
|
||||||
exit
|
local desktop_files=()
|
||||||
fi
|
|
||||||
|
|
||||||
|
# 收集所有桌面文件
|
||||||
|
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
|
||||||
|
|
||||||
if [ "$(id -u)" != "0" ]; then
|
# 在ACE环境中创建桌面快捷方式
|
||||||
echo "${TRANSHELL_CONTENT_PLEASE_RUN_AS_ROOT}"
|
function create_desktop_in_ace() {
|
||||||
echo "OMG-IT-GOES-WRONG"
|
local ace_cmd="$1"
|
||||||
exit 1
|
local package_name="$2"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f "$1" ]; then
|
# 如果明确要求不要创建,则直接返回
|
||||||
echo "${TRANSHELL_CONTENT_FILE_NOT_EXIST},Trying to redownload"
|
if [ "$NO_CREATE_DESKTOP" -eq 1 ]; then
|
||||||
FILEPATH=$(dirname "$1")
|
echo "根据参数要求,跳过在ACE中创建桌面快捷方式"
|
||||||
FILENAME=$(basename "$1")
|
return 0
|
||||||
PACKAGE_NAME=$(echo "$FILENAME" | sed -r 's/^([^_]+)_.*$/\1/')
|
fi
|
||||||
VERSION=$(echo "$FILENAME" | sed -r 's/^[^_]+_([^_]+)_.*$/\1/')
|
|
||||||
pushd ${FILEPATH}
|
# 如果是强制创建,或者没有配置禁止创建
|
||||||
aptss download ${PACKAGE_NAME}
|
if [ "$FORCE_CREATE_DESKTOP" -eq 1 ] || ! $ace_cmd "[ -e ~/.config/spark-union/spark-store/ssshell-config-do-not-create-desktop ]"; then
|
||||||
popd
|
echo "在ACE环境中创建桌面快捷方式..."
|
||||||
if [ ! -f "$1" ]; then
|
export -f exec_create_desktop_file
|
||||||
echo "OMG-IT-GOES-WRONG"
|
export package_name
|
||||||
exit 1
|
export FORCE_CREATE_DESKTOP
|
||||||
|
$ace_cmd "exec_create_desktop_file"
|
||||||
else
|
else
|
||||||
DEBPATH=$(realpath "$1")
|
echo "根据ACE环境中的配置,跳过创建桌面快捷方式"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 在指定ACE环境中安装
|
||||||
|
function install_in_ace_env() {
|
||||||
|
local ace_cmd="$1"
|
||||||
|
local deb_path="$2"
|
||||||
|
local ace_env_pkg="${3#*:}"
|
||||||
|
|
||||||
|
if ! ensure_ace_env "$ace_env_pkg"; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "----------------------------------------"
|
||||||
|
echo "正在尝试使用 $ace_cmd 环境安装..."
|
||||||
|
echo "----------------------------------------"
|
||||||
|
|
||||||
|
# 在ACE环境中执行安装
|
||||||
|
if $ace_cmd "ensure_aptss_exist && { dpkg -i '$deb_path' || aptss install '$deb_path' -yfq; }"; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
# 如果第一次安装失败,执行aptss update后再试一次
|
||||||
|
echo "第一次安装失败,正在更新仓库信息后重试..."
|
||||||
|
$ace_cmd "aptss update"
|
||||||
|
if $ace_cmd "dpkg -i '$deb_path' || aptss install '$deb_path' -yfq"; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 在主机安装
|
||||||
|
function install_in_host() {
|
||||||
|
local deb_path="$1"
|
||||||
|
|
||||||
|
if dpkg -i "$deb_path" || aptss install "$deb_path" -yfq; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
# 如果第一次安装失败,执行aptss update后再试一次
|
||||||
|
echo "第一次安装失败,正在更新仓库信息后重试..."
|
||||||
|
aptss update
|
||||||
|
if dpkg -i "$deb_path" || aptss install "$deb_path" -yfq; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 自动尝试在各种环境中安装
|
||||||
|
function auto_try_install() {
|
||||||
|
local deb_path="$1"
|
||||||
|
|
||||||
|
# 首先尝试在主机安装
|
||||||
|
if install_in_host "$deb_path"; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 如果主机安装失败且不在强制本地模式,尝试ACE环境
|
||||||
|
if [ "$FORCE_NATIVE" -eq 0 ]; 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
|
||||||
|
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
|
fi
|
||||||
else
|
else
|
||||||
DEBPATH=$(realpath "$1")
|
# ACE环境中安装的情况,不检查主机dpkg数据库
|
||||||
fi
|
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
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
lock_file "$DEBPATH"
|
# 文件锁定/解锁函数
|
||||||
|
function lock_file() {
|
||||||
|
chattr +i "$1"
|
||||||
|
}
|
||||||
|
|
||||||
hash_check "$DEBPATH"
|
function unlock_file() {
|
||||||
|
chattr -i "$1"
|
||||||
|
}
|
||||||
|
|
||||||
if [ -z "$IS_SHA512SUM_CHECKED" ]; then
|
# 主安装流程
|
||||||
|
function main_install() {
|
||||||
|
parse_args "$@"
|
||||||
|
|
||||||
|
if [ -z "$DEBPATH" ]; then
|
||||||
|
echo "没有接收到参数,退出"
|
||||||
|
show_help
|
||||||
|
echo "OMG-IT-GOES-WRONG"
|
||||||
|
exit 1
|
||||||
|
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 "尝试更新仓库信息重新校验"
|
echo "尝试更新仓库信息重新校验"
|
||||||
aptss ssupdate
|
aptss ssupdate
|
||||||
hash_check "$DEBPATH"
|
hash_check "$DEBPATH"
|
||||||
@@ -144,52 +414,41 @@ if [ -z "$IS_SHA512SUM_CHECKED" ]; then
|
|||||||
echo "OMG-IT-GOES-WRONG"
|
echo "OMG-IT-GOES-WRONG"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z "$IS_SHA512SUM_CHECKED" ]; then
|
|
||||||
echo "校验成功,开始安装"
|
|
||||||
echo "----------------------------------------------------------------------------------"
|
|
||||||
package_name=$(dpkg-deb -f "$DEBPATH" Package)
|
package_name=$(dpkg-deb -f "$DEBPATH" Package)
|
||||||
echo "Package name is $package_name"
|
local install_success=1
|
||||||
try_run_output=$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh test-install-app "$DEBPATH")
|
|
||||||
try_run_ret="$?"
|
|
||||||
|
|
||||||
if [ "$try_run_ret" -ne 0 ]; then
|
if [ -n "$FORCE_ACE_ENV" ]; then
|
||||||
aptss update
|
# 查找对应的ACE环境包名
|
||||||
try_run_output=$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh test-install-app "$DEBPATH")
|
local ace_env_pkg=""
|
||||||
try_run_ret="$?"
|
for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do
|
||||||
|
if [ "${ace_entry%%:*}" = "$FORCE_ACE_ENV" ]; then
|
||||||
|
ace_env_pkg="${ace_entry#*:}"
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
if [ "$try_run_ret" -ne 0 ]; then
|
# 强制使用指定的ACE环境安装
|
||||||
echo "OMG-IT-GOES-WRONG"
|
if command -v "$FORCE_ACE_ENV" >/dev/null 2>&1; then
|
||||||
echo -e "${try_run_output}"
|
install_in_ace_env "$FORCE_ACE_ENV" "$DEBPATH" "$ace_env_pkg"
|
||||||
exit "$try_run_ret"
|
install_success=$?
|
||||||
fi
|
if [ "$install_success" -eq 0 ]; then
|
||||||
|
create_desktop_in_ace "$FORCE_ACE_ENV" "$package_name"
|
||||||
dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf
|
|
||||||
|
|
||||||
unlock_file "$DEBPATH"
|
|
||||||
|
|
||||||
if [ "$?" = "0" ] && [ "$2" = "--delete-after-install" ]; then
|
|
||||||
if dpkg -s "$package_name" >/dev/null 2>&1; then
|
|
||||||
echo "软件包已安装:$package_name"
|
|
||||||
create_desktop_file
|
|
||||||
rm "$DEBPATH"
|
|
||||||
echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}"
|
|
||||||
else
|
|
||||||
echo "软件包未安装:$package_name"
|
|
||||||
echo "安装异常!抛出错误"
|
|
||||||
echo "OMG-IT-GOES-WRONG"
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "${TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB}"
|
echo "指定的ACE环境 $FORCE_ACE_ENV 不可用"
|
||||||
if dpkg -s "$package_name" >/dev/null 2>&1; then
|
|
||||||
echo "软件包已安装:$package_name"
|
|
||||||
create_desktop_file
|
|
||||||
else
|
|
||||||
echo "软件包未安装:$package_name"
|
|
||||||
echo "安装异常!抛出错误"
|
|
||||||
echo "OMG-IT-GOES-WRONG"
|
echo "OMG-IT-GOES-WRONG"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
# 自动选择安装方式
|
||||||
|
auto_try_install "$DEBPATH"
|
||||||
|
install_success=$?
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
post_install_cleanup "$install_success" "$DEBPATH" "$package_name"
|
||||||
|
}
|
||||||
|
|
||||||
|
# 执行主函数
|
||||||
|
main_install "$@"
|
||||||
|
|||||||
@@ -1,2 +1,42 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
dpkg -l | grep "^ii $1 " > /dev/null
|
dpkg -s "$1" > /dev/null
|
||||||
|
RET="$?"
|
||||||
|
if [[ "$RET" != "0" ]] &&[[ "$IS_ACE_ENV" == "" ]];then ## 如果未在ACE环境中
|
||||||
|
# 定义按顺序尝试的ACE环境(命令:推荐安装包)
|
||||||
|
declare -a ace_commands_order=(
|
||||||
|
"bookworm-run:amber-ce-bookworm"
|
||||||
|
"trixie-run:amber-ce-trixie"
|
||||||
|
"deepin23-run:amber-ce-deepin23"
|
||||||
|
)
|
||||||
|
for ace_entry in "${ace_commands_order[@]}"; do
|
||||||
|
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"
|
||||||
|
|||||||
@@ -1,142 +1,132 @@
|
|||||||
#!/bin/bash
|
#!/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"
|
# ===== ACE环境配置 =====
|
||||||
return 0
|
declare -a ace_commands_order=(
|
||||||
|
"bookworm-run:amber-ce-bookworm"
|
||||||
|
"trixie-run:amber-ce-trixie"
|
||||||
|
"deepin23-run:amber-ce-deepin23"
|
||||||
|
)
|
||||||
|
|
||||||
|
# ===== 日志和函数 =====
|
||||||
|
[ -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 <level> ...content
|
function scan_desktop_file_log() {
|
||||||
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(){
|
|
||||||
unset desktop_file_path
|
unset desktop_file_path
|
||||||
local result=""
|
local package_name=$1
|
||||||
for desktop_file_path in $(dpkg -L "$1" | grep /usr/share/applications/ | awk '/\.desktop$/ {print}'); do
|
# 标准desktop文件检测
|
||||||
if [ "$(grep NoDisplay=true $desktop_file_path)" = "" ]; then
|
while IFS= read -r path; do
|
||||||
result+="$desktop_file_path,"
|
[ -z "$(grep 'NoDisplay=true' "$path")" ] && {
|
||||||
fi
|
log.info "Found valid desktop file: $path"
|
||||||
done
|
desktop_file_path="$path"
|
||||||
for desktop_file_path in $(dpkg -L "$1" | grep /opt/apps/$package_name/entries/applications | awk '/\.desktop$/ {print}'); do
|
return 0
|
||||||
if [ "$(grep NoDisplay=true $desktop_file_path)" = "" ]; then
|
}
|
||||||
result+="$desktop_file_path,"
|
done < <(dpkg -L "$package_name" 2>/dev/null | grep -E '/usr/share/applications/.*\.desktop$|/opt/apps/.*/entries/applications/.*\.desktop$')
|
||||||
fi
|
|
||||||
done
|
# 深度环境特殊处理
|
||||||
# 去掉最后一个逗号
|
while IFS= read -r path; do
|
||||||
if [ -n "$result" ]; then
|
[ -z "$(grep 'NoDisplay=true' "$path")" ] && {
|
||||||
result=${result%,}
|
log.info "Found deepin desktop file: $path"
|
||||||
fi
|
desktop_file_path="$path"
|
||||||
echo "$result"
|
return 0
|
||||||
|
}
|
||||||
|
done < <(find /opt/apps/$package_name -path '*/entries/applications/*.desktop' 2>/dev/null)
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function launch_app(){
|
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$')
|
||||||
|
|
||||||
# 检查是否传入了路径参数
|
# 深度环境补充扫描
|
||||||
if [ -z "$1" ]; then
|
while IFS= read -r path; do
|
||||||
log.error "请传入文件路径作为参数"
|
[ -z "$(grep 'NoDisplay=true' "$path")" ] && result+="$path,"
|
||||||
|
done < <(find /opt/apps/$package_name -path '*/entries/applications/*.desktop' 2>/dev/null)
|
||||||
|
|
||||||
|
echo "${result%,}"
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
log.info "Launching: $exec_command"
|
||||||
|
# 图形环境启动优化
|
||||||
|
if [ -n "$DISPLAY" ]; then
|
||||||
|
nohup env DISPLAY=$DISPLAY XAUTHORITY=${XAUTHORITY:-~/.Xauthority} ${SHELL:-bash} -c "$exec_command" >/dev/null 2>&1 &
|
||||||
|
else
|
||||||
|
nohup ${SHELL:-bash} -c "$exec_command" >/dev/null 2>&1 &
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# ===== ACE环境执行器 =====
|
||||||
|
function ace_runner() {
|
||||||
|
local command_type=$1 package_name=$2
|
||||||
|
for ace_entry in "${ace_commands_order[@]}"; do
|
||||||
|
local ace_cmd=${ace_entry%%:*}
|
||||||
|
command -v "$ace_cmd" >/dev/null || continue
|
||||||
|
|
||||||
|
log.info "Checking in $ace_cmd environment..."
|
||||||
|
if output=$($ace_cmd "$0" "$command_type" "$package_name" 2>/dev/null); then
|
||||||
|
[ "$command_type" = "list" ] && echo "$output"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# ===== 主逻辑 =====
|
||||||
|
[ $# -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 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
DESKTOP_FILE_PATH=$1
|
list)
|
||||||
|
# 当前环境列表
|
||||||
if [[ $DESKTOP_FILE_PATH == file://* ]]; then
|
if result=$(scan_desktop_file "$2"); then
|
||||||
# 如果是,移除 'file://' 部分并输出结果
|
echo "$result"
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "$#" -lt 2 ];then
|
|
||||||
log.info "Usage: $0 check/launch/list/start packagename/desktop-file"
|
|
||||||
exit -1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = "check" ];then
|
|
||||||
|
|
||||||
scan_desktop_file_log "$2"
|
|
||||||
if [ "$desktop_file_path" = "" ];then
|
|
||||||
log.error "No desktop file found. exit -1"
|
|
||||||
exit -1
|
|
||||||
else
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
|
||||||
|
|
||||||
elif [ "$1" = "list" ];then
|
|
||||||
scan_desktop_file "$2"
|
|
||||||
if [ "$desktop_file_path" = "" ];then
|
|
||||||
exit -1
|
|
||||||
else
|
else
|
||||||
|
# 非ACE环境下执行ACE环境扫描
|
||||||
|
[ -z "$IS_ACE_ENV" ] && ace_runner list "$2"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
launch|start)
|
||||||
|
# 当前环境启动
|
||||||
|
if scan_desktop_file_log "$2" && launch_app "$desktop_file_path"; then
|
||||||
exit 0
|
exit 0
|
||||||
|
else
|
||||||
|
# 非ACE环境下通过ACE环境启动
|
||||||
|
[ -z "$IS_ACE_ENV" ] && ace_runner launch "$2"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
elif [ "$1" = "launch" ];then
|
;;
|
||||||
scan_desktop_file_log "$2"
|
*)
|
||||||
if [ "$desktop_file_path" = "" ];then
|
log.error "Invalid command: $1"
|
||||||
log.error "No desktop file found. exit -1"
|
exit 2
|
||||||
exit -1
|
;;
|
||||||
fi
|
esac
|
||||||
|
|
||||||
|
|
||||||
launch_app "${desktop_file_path}"
|
|
||||||
|
|
||||||
elif [ "$1" = "start" ];then
|
|
||||||
launch_app "${desktop_file_path}"
|
|
||||||
fi
|
|
||||||
|
|||||||
54
tool/store-helper/uninstaller
Executable file
@@ -0,0 +1,54 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# ===== ACE环境配置 =====
|
||||||
|
declare -a ace_commands_order=(
|
||||||
|
"bookworm-run:amber-ce-bookworm"
|
||||||
|
"trixie-run:amber-ce-trixie"
|
||||||
|
"deepin23-run:amber-ce-deepin23"
|
||||||
|
)
|
||||||
|
|
||||||
|
# ===== 日志和函数 =====
|
||||||
|
[ -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: $*"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
dpkg -s "$1" > /dev/null
|
||||||
|
RET="$?"
|
||||||
|
if [[ "$RET" == "0" ]] ;then
|
||||||
|
apt autopurge $1 -y
|
||||||
|
else
|
||||||
|
|
||||||
|
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 dpkg -l | grep "^ii $1 " > /dev/null
|
||||||
|
try_run_ret="$?"
|
||||||
|
|
||||||
|
|
||||||
|
# 最终检测结果处理
|
||||||
|
if [ "$try_run_ret" -eq 0 ]; then
|
||||||
|
echo "----------------------------------------"
|
||||||
|
echo "在 $ace_cmd 环境中找到了安装"
|
||||||
|
echo "----------------------------------------"
|
||||||
|
$ace_cmd apt autopurge $1 -y
|
||||||
|
else
|
||||||
|
echo "----------------------------------------"
|
||||||
|
echo "在 $ace_cmd 环境中未能找到安装,继续查找"
|
||||||
|
echo "----------------------------------------"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "----------------------------------------"
|
||||||
|
echo "所有已安装的 ACE 环境中未能找到安装,退出"
|
||||||
|
echo "----------------------------------------"
|
||||||
|
exit "$RET"
|
||||||
|
fi
|
||||||
|
exit "$RET"
|
||||||
@@ -146,7 +146,7 @@ for PKG_UPGRADE in $PKG_UPGRADE_LIST; do
|
|||||||
update_transhell
|
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))
|
progress=$(( count * 100 / total - 1))
|
||||||
|
|||||||