mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-15 21:32:05 +08:00
Compare commits
19 Commits
3.0.3-9
...
3.0.3-11-m
| Author | SHA1 | Date | |
|---|---|---|---|
| e14b1baaab | |||
| 0bfa7c9136 | |||
| 6d38c0bf70 | |||
| a932966795 | |||
| a63c7ec750 | |||
| ad53669098 | |||
| 69b42f2afe | |||
| c4f4465e87 | |||
| f292f954f7 | |||
| 161c9e320b | |||
| f33386ee5c | |||
|
|
61c10944c9 | ||
|
|
6db6fe6060 | ||
|
|
14506b18b2 | ||
| 44d1041087 | |||
| dd941bcf8e | |||
| 75fc22d2a2 | |||
| ee549b91f1 | |||
| 38209d0efb |
16
debian/changelog
vendored
16
debian/changelog
vendored
@@ -1,3 +1,19 @@
|
|||||||
|
spark-store (3.0.3-11) stable; urgency=medium
|
||||||
|
|
||||||
|
* Now support autoupdate
|
||||||
|
|
||||||
|
-- shenmo <shenmo@spark-app.store> Mon, 17 Jan 2022 00:00:00 +0800
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
spark-store (3.0.3-10) stable; urgency=medium
|
||||||
|
|
||||||
|
* Now also compile dstore patch
|
||||||
|
|
||||||
|
-- shenmo <shenmo@spark-app.store> Mon, 17 Jan 2022 00:00:00 +0800
|
||||||
|
|
||||||
|
|
||||||
spark-store (3.0.3-9) stable; urgency=medium
|
spark-store (3.0.3-9) stable; urgency=medium
|
||||||
|
|
||||||
* Support dpkg-buildpackage
|
* Support dpkg-buildpackage
|
||||||
|
|||||||
12
debian/control
vendored
12
debian/control
vendored
@@ -11,9 +11,9 @@ Build-Depends:
|
|||||||
libqt5widgets5,
|
libqt5widgets5,
|
||||||
libqt5network5,
|
libqt5network5,
|
||||||
libqt5concurrent5,
|
libqt5concurrent5,
|
||||||
libdtkcore-dev,
|
libdtkcore-dev(>=5.4),
|
||||||
libdtkgui-dev,
|
libdtkgui-dev(>=5.4),
|
||||||
libdtkwidget-dev,
|
libdtkwidget-dev(>=5.4),
|
||||||
qttools5-private-dev,
|
qttools5-private-dev,
|
||||||
libnotify-dev,
|
libnotify-dev,
|
||||||
qtwebengine5-dev
|
qtwebengine5-dev
|
||||||
@@ -29,9 +29,9 @@ Depends:${shlibs:Depends}, ${misc:Depends},
|
|||||||
libqt5widgets5,
|
libqt5widgets5,
|
||||||
libqt5network5,
|
libqt5network5,
|
||||||
libqt5concurrent5,
|
libqt5concurrent5,
|
||||||
libdtkcore5,
|
libdtkcore5(>=5.4),
|
||||||
libdtkgui5,
|
libdtkgui5(>=5.4),
|
||||||
libdtkwidget5,
|
libdtkwidget5(>=5.4),
|
||||||
libnotify4
|
libnotify4
|
||||||
Description: Spark Store
|
Description: Spark Store
|
||||||
A community powered app store, based on DTK.
|
A community powered app store, based on DTK.
|
||||||
|
|||||||
2
debian/source/format
vendored
2
debian/source/format
vendored
@@ -1 +1 @@
|
|||||||
3.0 (quilt)
|
1.0
|
||||||
10
debian/spark-store.postinst
vendored
10
debian/spark-store.postinst
vendored
@@ -12,6 +12,8 @@ case "$1" in
|
|||||||
ln -s -f /opt/durapps/spark-store/bin/ssinstall /usr/local/bin/ssinstall
|
ln -s -f /opt/durapps/spark-store/bin/ssinstall /usr/local/bin/ssinstall
|
||||||
ln -s -f /opt/durapps/spark-store/bin/spark-dstore-patch /usr/local/bin/spark-dstore-patch
|
ln -s -f /opt/durapps/spark-store/bin/spark-dstore-patch /usr/local/bin/spark-dstore-patch
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Download and install key
|
# Download and install key
|
||||||
wget -O /tmp/spark-store-install/spark-store.asc https://d.store.deepinos.org.cn/dcs-repo.gpg-key.asc
|
wget -O /tmp/spark-store-install/spark-store.asc https://d.store.deepinos.org.cn/dcs-repo.gpg-key.asc
|
||||||
gpg --dearmor /tmp/spark-store-install/spark-store.asc
|
gpg --dearmor /tmp/spark-store-install/spark-store.asc
|
||||||
@@ -20,6 +22,14 @@ case "$1" in
|
|||||||
# Run apt update to avoid users being fucked up by the non-exist dependency problem
|
# Run apt update to avoid users being fucked up by the non-exist dependency problem
|
||||||
apt update
|
apt update
|
||||||
|
|
||||||
|
# Create symbo links to start upgrade detect
|
||||||
|
ln -s /opt/durapps/spark-store/bin/update-upgrade/autostart/spark-update-notifier.desktop /etc/xdg/autostart/spark-update-notifier.desktop
|
||||||
|
|
||||||
|
# Start upgrade detect service
|
||||||
|
systemctl enable spark-update-notifier
|
||||||
|
service spark-update-notifier start
|
||||||
|
|
||||||
|
|
||||||
# Update certain caches
|
# Update certain caches
|
||||||
update-icon-caches /usr/share/icons/hicolor || true
|
update-icon-caches /usr/share/icons/hicolor || true
|
||||||
update-desktop-database /usr/share/applications || true
|
update-desktop-database /usr/share/applications || true
|
||||||
|
|||||||
0
debian/spark-store.postrm
vendored
Normal file → Executable file
0
debian/spark-store.postrm
vendored
Normal file → Executable file
19
debian/spark-store.prerm
vendored
19
debian/spark-store.prerm
vendored
@@ -7,9 +7,28 @@ rm /usr/local/bin/spark-dstore-patch
|
|||||||
rm /usr/local/bin/ussinstall
|
rm /usr/local/bin/ussinstall
|
||||||
rm /usr/local/bin/ussremove
|
rm /usr/local/bin/ussremove
|
||||||
|
|
||||||
|
# Remove residual symbol links to stop upgrade detect if exist
|
||||||
|
if [ -f /etc/xdg/autostart/spark-update-notifier.desktop ];then
|
||||||
|
rm /etc/xdg/autostart/spark-update-notifier.desktop
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Shutdown services
|
||||||
|
service spark-update-notifier stop
|
||||||
|
|
||||||
|
# Stop update detect service
|
||||||
|
systemctl disable spark-update-notifier
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Clean the service place file
|
||||||
|
if [ -d "/tmp/spark-store-updatenum/" ] ; then
|
||||||
|
rm -rf /tmp/spark-store-updatenum/s
|
||||||
|
fi
|
||||||
|
|
||||||
# Remove gpg key file
|
# Remove gpg key file
|
||||||
if [ -f "/etc/apt/trusted.gpg.d/spark-store.gpg" ] ; then
|
if [ -f "/etc/apt/trusted.gpg.d/spark-store.gpg" ] ; then
|
||||||
rm /etc/apt/trusted.gpg.d/spark-store.gpg
|
rm /etc/apt/trusted.gpg.d/spark-store.gpg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
apt-key del '9D9A A859 F750 24B1 A1EC E16E 0E41 D354 A29A 440C'
|
apt-key del '9D9A A859 F750 24B1 A1EC E16E 0E41 D354 A29A 440C'
|
||||||
|
|
||||||
|
|||||||
14
pkg/usr/lib/systemd/system/spark-update-notifier.service
Normal file
14
pkg/usr/lib/systemd/system/spark-update-notifier.service
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Spark Store update notifier
|
||||||
|
After=apt-daily.service network.target network-online.target systemd-networkd.service NetworkManager.service connman.service
|
||||||
|
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=/opt/durapps/spark-store/bin/update-upgrade/ss-update-notify-placer.sh
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=10
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
@@ -4,8 +4,10 @@ TEMPLATE = subdirs
|
|||||||
CONFIG += ordered
|
CONFIG += ordered
|
||||||
|
|
||||||
SUBDIRS += \
|
SUBDIRS += \
|
||||||
|
src/spark-dstore-patch \
|
||||||
third-party/QtNetworkService \
|
third-party/QtNetworkService \
|
||||||
src/spark-store.pro
|
src/spark-store.pro
|
||||||
|
|
||||||
|
|
||||||
spark-store.depends = third-party/QtNetworkService
|
spark-store.depends = third-party/QtNetworkService
|
||||||
|
|
||||||
@@ -28,6 +30,10 @@ sourceslist.path = /etc/apt/sources.list.d
|
|||||||
desktop.files += pkg/usr/share/applications/spark-store.desktop
|
desktop.files += pkg/usr/share/applications/spark-store.desktop
|
||||||
desktop.path = /usr/share/applications
|
desktop.path = /usr/share/applications
|
||||||
|
|
||||||
|
service.files += pkg/usr/lib/systemd/system/spark-update-notifier.service
|
||||||
|
service.path = /usr/lib/systemd/system/
|
||||||
|
|
||||||
|
|
||||||
icon.files += pkg/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
icon.files += pkg/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||||
icon.path = /usr/share/icons/hicolor/scalable/apps
|
icon.path = /usr/share/icons/hicolor/scalable/apps
|
||||||
|
|
||||||
@@ -41,4 +47,5 @@ INSTALLS += \
|
|||||||
icon \
|
icon \
|
||||||
sourceslist \
|
sourceslist \
|
||||||
preferences \
|
preferences \
|
||||||
tmp
|
tmp \
|
||||||
|
service
|
||||||
|
|||||||
14
src/main.cpp
14
src/main.cpp
@@ -2,6 +2,7 @@
|
|||||||
#include <DApplicationSettings>
|
#include <DApplicationSettings>
|
||||||
#include <DWidgetUtil> // Dtk::Widget::moveToCenter(&w); 要调用它,就得引用 DWidgetUtil
|
#include <DWidgetUtil> // Dtk::Widget::moveToCenter(&w); 要调用它,就得引用 DWidgetUtil
|
||||||
|
|
||||||
|
#include <QVector>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
|
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
@@ -9,9 +10,16 @@
|
|||||||
DWIDGET_USE_NAMESPACE
|
DWIDGET_USE_NAMESPACE
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
DApplication::loadDXcbPlugin(); // 让 bar 处在标题栏中
|
//DApplication::loadDXcbPlugin(); // 已废弃
|
||||||
DApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // 开启 Hidpi 支持
|
DApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // 开启 Hidpi 支持
|
||||||
DApplication a(argc, argv);
|
// 程序内强制添加"-platformtheme deepin"参数喂给Qt让Qt正确使用Deepin主题修复各种奇怪样式问题
|
||||||
|
QVector<char*> fakeArgs(argc + 2);
|
||||||
|
fakeArgs[0] = argv[0];
|
||||||
|
fakeArgs[1] = "-platformtheme";
|
||||||
|
fakeArgs[2] = "deepin";
|
||||||
|
for(int i = 1; i < argc; i++) fakeArgs[i + 2] = argv[i];
|
||||||
|
int fakeArgc = argc + 2; // 为啥DApplication的argc要用引用啊?
|
||||||
|
DApplication a(fakeArgc, fakeArgs.data());
|
||||||
|
|
||||||
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
a.loadTranslator(); // 载入翻译
|
a.loadTranslator(); // 载入翻译
|
||||||
@@ -42,7 +50,7 @@ int main(int argc, char *argv[])
|
|||||||
a.setOrganizationName("spark-union");
|
a.setOrganizationName("spark-union");
|
||||||
a.setOrganizationDomain("https://www.deepinos.org/");
|
a.setOrganizationDomain("https://www.deepinos.org/");
|
||||||
a.setApplicationName("Spark Store"); //不需要翻译,否则 ~/.local/share/ 下文件夹名称也被翻译为中文
|
a.setApplicationName("Spark Store"); //不需要翻译,否则 ~/.local/share/ 下文件夹名称也被翻译为中文
|
||||||
a.setApplicationVersion(DApplication::buildVersion("3.0.3-9"));
|
a.setApplicationVersion(DApplication::buildVersion("3.0.3-11"));
|
||||||
a.setApplicationAcknowledgementPage("https://gitee.com/deepin-community-store/spark-store");
|
a.setApplicationAcknowledgementPage("https://gitee.com/deepin-community-store/spark-store");
|
||||||
a.setApplicationDescription(
|
a.setApplicationDescription(
|
||||||
QObject::tr(
|
QObject::tr(
|
||||||
|
|||||||
9
src/spark-dstore-patch/spark-dstore-patch.pro
Normal file
9
src/spark-dstore-patch/spark-dstore-patch.pro
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
TARGET = spark-dstore-patch
|
||||||
|
TEMPLATE += app
|
||||||
|
QT += widgets
|
||||||
|
SOURCES += spark-dstore-tool.cpp
|
||||||
|
|
||||||
|
# Default rules for deployment.
|
||||||
|
qnx: target.path = /tmp/spark-store/bin
|
||||||
|
else: unix:!android: target.path = /opt/durapps/spark-store/bin
|
||||||
|
!isEmpty(target.path): INSTALLS += target
|
||||||
195
src/spark-dstore-patch/spark-dstore-tool.cpp
Normal file
195
src/spark-dstore-patch/spark-dstore-tool.cpp
Normal file
@@ -0,0 +1,195 @@
|
|||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDirIterator>
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
QList<QJsonObject> enumAppInfoList()
|
||||||
|
{
|
||||||
|
QList<QJsonObject> appInfoList;
|
||||||
|
QDir apps("/opt/apps");
|
||||||
|
auto list = apps.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
|
for (auto &appID : list) {
|
||||||
|
auto infoPath = apps.absoluteFilePath(appID + "/info");
|
||||||
|
QFile infoFile(infoPath);
|
||||||
|
if (!infoFile.open(QIODevice::ReadOnly)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
auto doc = QJsonDocument::fromJson(infoFile.readAll());
|
||||||
|
appInfoList.push_back(doc.object());
|
||||||
|
}
|
||||||
|
return appInfoList;
|
||||||
|
}
|
||||||
|
//这段是去找appid和info,没看懂用来干啥的,在此之后info文件也没再用过
|
||||||
|
//可能以后版本的实现会用到,等官方加功能再说
|
||||||
|
void linkDir(const QString &source, const QString &target)
|
||||||
|
{
|
||||||
|
auto ensureTargetDir = [](const QString &targetFile) {
|
||||||
|
QFileInfo t(targetFile);
|
||||||
|
QDir tDir(t.dir());
|
||||||
|
tDir.mkpath(".");
|
||||||
|
};
|
||||||
|
|
||||||
|
QDir sourceDir(source);
|
||||||
|
QDir targetDir(target);
|
||||||
|
QDirIterator iter(source, QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
auto sourceFile = iter.next();
|
||||||
|
auto targetFile = targetDir.absoluteFilePath(sourceDir.relativeFilePath(sourceFile));
|
||||||
|
|
||||||
|
QFileInfo tfi(targetFile);
|
||||||
|
// if (tfi.isSymLink() && (tfi.canonicalFilePath() == sourceFile)) {
|
||||||
|
//这里官方应该是写错了,否则会每触发一次就把所有软链接都删了重新创建一次
|
||||||
|
if (tfi.isSymLink() && (tfi.symLinkTarget() == sourceFile)) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
QFile::remove(targetFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureTargetDir(targetFile);
|
||||||
|
auto ret = symlink(sourceFile.toStdString().c_str(), targetFile.toStdString().c_str());
|
||||||
|
if (0 != ret) {
|
||||||
|
qDebug() << "link failed" << sourceFile << "=>" << targetFile << ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//reset Dynamic library rpath
|
||||||
|
void setRpath(const QString &file, const QString &path)
|
||||||
|
{
|
||||||
|
if (!QFileInfo::exists(path))
|
||||||
|
return;
|
||||||
|
QProcess p;
|
||||||
|
auto cmd = "patchelf " + file + " --set-rpath " + path;
|
||||||
|
p.start("bash", QStringList {"-c", cmd});
|
||||||
|
p.waitForFinished();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString getGlic()
|
||||||
|
{
|
||||||
|
//get arch & glibc
|
||||||
|
QProcess p;
|
||||||
|
auto cmd = "gcc -dumpmachine";
|
||||||
|
p.start("bash", QStringList {"-c", cmd});
|
||||||
|
p.waitForFinished();
|
||||||
|
return p.readAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
void linkApp(const QJsonObject &app)
|
||||||
|
{
|
||||||
|
auto appID = app.value("appid").toString();
|
||||||
|
auto appEntriesDir = QDir("/opt/apps/" + appID + "/entries");
|
||||||
|
auto appLibsDir = QDir("/opt/apps/" + appID + "/files/lib");
|
||||||
|
auto autoStartDir = QDir(appEntriesDir.absoluteFilePath("autostart"));
|
||||||
|
|
||||||
|
bool autoStart = app.value("permissions").toObject().value("autostart").toBool();
|
||||||
|
if (autoStart) {
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("autostart"), "/etc/xdg/autostart");
|
||||||
|
}
|
||||||
|
|
||||||
|
// link application
|
||||||
|
auto sysShareDir = QDir("/usr/share");
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("applications"), sysShareDir.absoluteFilePath("applications"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("icons"), sysShareDir.absoluteFilePath("icons"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("mime"), sysShareDir.absoluteFilePath("mime"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("glib-2.0"), sysShareDir.absoluteFilePath("glib-2.0"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("services"), sysShareDir.absoluteFilePath("dbus-1/services"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("GConf"), sysShareDir.absoluteFilePath("GConf"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("help"), sysShareDir.absoluteFilePath("help"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("locale"), sysShareDir.absoluteFilePath("locale"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("fcitx"), sysShareDir.absoluteFilePath("fcitx"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("polkit"), sysShareDir.absoluteFilePath("polkit-1"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("fonts/conf"), "/etc/fonts/conf.d");
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("fonts/files"), sysShareDir.absoluteFilePath("fonts"));
|
||||||
|
|
||||||
|
|
||||||
|
//原来会导致Gtk相关应用翻译缺失,补足了
|
||||||
|
|
||||||
|
|
||||||
|
auto pluginDir = QDir(appEntriesDir.absoluteFilePath("plugins"));
|
||||||
|
if (pluginDir.exists()) {
|
||||||
|
QString arch = getGlic();
|
||||||
|
// if (pluginDir.exists()) {
|
||||||
|
// QDirIterator iter(pluginDir.absolutePath(), QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
||||||
|
// while (iter.hasNext()) {
|
||||||
|
// auto sourceFile = iter.next();
|
||||||
|
// setRpath(sourceFile, appLibsDir.absolutePath()); //set rpath
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("plugins/fcitx"), "/usr/lib/" + arch + "/fcitx");
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("plugins/browser"), "/usr/lib/mozilla/plugins");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cleanLink()
|
||||||
|
{
|
||||||
|
auto cleanDirBrokenLink = [](const QString &dir) {
|
||||||
|
QProcess p;
|
||||||
|
auto cmd = "find " + dir + " -xtype l -delete";
|
||||||
|
p.start("bash", QStringList {"-c", cmd});
|
||||||
|
p.waitForFinished();
|
||||||
|
};
|
||||||
|
|
||||||
|
QString arch = getGlic();
|
||||||
|
auto sysShareDir = QDir("/usr/share");
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("applications"));
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("icons"));
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("mime/packages"));
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("glib-2.0"));
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("dbus-1/services"));
|
||||||
|
cleanDirBrokenLink("/etc/xdg/autostart");
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("fcitx"));
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("help"));
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("locale"));
|
||||||
|
cleanDirBrokenLink("/usr/lib/" + arch + "/fcitx");
|
||||||
|
cleanDirBrokenLink("/usr/lib/mozilla/plugins");
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("polkit-1/actions"));
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("fonts"));
|
||||||
|
cleanDirBrokenLink("/etc/fonts/conf.d");
|
||||||
|
}
|
||||||
|
|
||||||
|
void update()
|
||||||
|
{
|
||||||
|
QProcess p;
|
||||||
|
auto cmd = "glib-compile-schemas /usr/share/glib-2.0/schemas/";
|
||||||
|
p.start("bash", QStringList {"-c", cmd});
|
||||||
|
p.waitForFinished();
|
||||||
|
|
||||||
|
cmd = "update-icon-caches /usr/share/icons/*";
|
||||||
|
p.start("bash", QStringList {"-c", cmd});
|
||||||
|
p.waitForFinished();
|
||||||
|
|
||||||
|
cmd = "update-desktop-database -q";
|
||||||
|
p.start("bash", QStringList {"-c", cmd});
|
||||||
|
p.waitForFinished();
|
||||||
|
|
||||||
|
cmd = "update-mime-database -V /usr/share/mime";
|
||||||
|
p.start("bash", QStringList {"-c", cmd});
|
||||||
|
p.waitForFinished();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
QCoreApplication app(argc, argv);
|
||||||
|
|
||||||
|
cleanLink();
|
||||||
|
|
||||||
|
for (auto &a : enumAppInfoList()) {
|
||||||
|
linkApp(a);
|
||||||
|
}
|
||||||
|
qInfo()<<"Spark dstore patch (c) The Spark Project 2022-Now. Modified from deepin-app-store-tool";
|
||||||
|
|
||||||
|
// trigger
|
||||||
|
update();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -29,7 +29,7 @@ CONFIG += c++11 link_pkgconfig
|
|||||||
PKGCONFIG += dtkcore dtkgui dtkwidget libnotify
|
PKGCONFIG += dtkcore dtkgui dtkwidget libnotify
|
||||||
|
|
||||||
# 禁止输出 qWarning / qDebug 信息
|
# 禁止输出 qWarning / qDebug 信息
|
||||||
CONFIG(release, debug|release): DEFINES += QT_NO_WARNING_OUTPUT QT_NO_DEBUG_OUTPUT
|
#CONFIG(release, debug|release): DEFINES += QT_NO_WARNING_OUTPUT QT_NO_DEBUG_OUTPUT
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
appitem.cpp \
|
appitem.cpp \
|
||||||
|
|||||||
@@ -192,14 +192,18 @@ void Widget::initUI()
|
|||||||
// 添加菜单项
|
// 添加菜单项
|
||||||
QAction *actionSubmission = new QAction(tr("Submit App"), this);
|
QAction *actionSubmission = new QAction(tr("Submit App"), this);
|
||||||
QAction *setting = new QAction(tr("Settings"));
|
QAction *setting = new QAction(tr("Settings"));
|
||||||
|
QAction *upgrade = new QAction(tr("App Upgrade"));
|
||||||
|
|
||||||
QMenu *menu = new QMenu;
|
QMenu *menu = new QMenu;
|
||||||
menu->addAction(setting);
|
menu->addAction(setting);
|
||||||
|
menu->addAction(upgrade);
|
||||||
menu->addAction(actionSubmission);
|
menu->addAction(actionSubmission);
|
||||||
|
|
||||||
titlebar->setMenu(menu);
|
titlebar->setMenu(menu);
|
||||||
|
|
||||||
connect(actionSubmission, &QAction::triggered, this, [=]{QDesktopServices::openUrl(QUrl("https://upload.deepinos.org/"));});
|
connect(actionSubmission, &QAction::triggered, this, [=]{QDesktopServices::openUrl(QUrl("https://upload.deepinos.org/"));});
|
||||||
connect(setting, &QAction::triggered, this, &Widget::opensetting);
|
connect(setting, &QAction::triggered, this, &Widget::opensetting);
|
||||||
|
connect(upgrade, &QAction::triggered, this, [=]{QProcess::startDetached("x-terminal-emulator -e /opt/durapps/spark-store/bin/update-upgrade/ss-update-controler.sh");});
|
||||||
|
|
||||||
// 载入自定义字体
|
// 载入自定义字体
|
||||||
int loadedFontID = QFontDatabase::addApplicationFont(":/fonts/fonts/hksnzt.ttf");
|
int loadedFontID = QFontDatabase::addApplicationFont(":/fonts/fonts/hksnzt.ttf");
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,5 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Encoding=UTF-8
|
||||||
|
Type=Application
|
||||||
|
Exec=/opt/durapps/spark-store/bin/update-upgrade/ss-update-notify.sh
|
||||||
|
Name=spark-update-notifier
|
||||||
4
tool/update-upgrade/ss-do-upgrade.sh
Executable file
4
tool/update-upgrade/ss-do-upgrade.sh
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
sudo apt upgrade -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
|
||||||
|
|
||||||
62
tool/update-upgrade/ss-update-controler.sh
Executable file
62
tool/update-upgrade/ss-update-controler.sh
Executable file
@@ -0,0 +1,62 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
echo "因为目前没有有时间的Qt程序员志愿者所以现在加功能只有让shenmo写脚本了..."
|
||||||
|
echo
|
||||||
|
echo "此功能被添加的原因是:为了防止影响系统更新,星火源默认的优先级是400,低于默认的500。这导致了与系统仓库相同包名的软件包无法正常更新到比系统仓库更高的版本。例如:hugo,系统仓库中的低版本会被优先安装,而且默认不会更新到星火的更新的版本"
|
||||||
|
echo "此脚本可以检测星火源中是否有比当前系统更高版本的软件包,由您决定是否安装"
|
||||||
|
echo "此脚本使用apt update/apt list --upgrade/apt upgrade来更新软件源、列出更新列表和操作更新"
|
||||||
|
echo
|
||||||
|
echo "该脚本不对其使用效果有任何明示或暗示的担保,在使用前请您确保您清楚地知道您在干什么。您应当清楚,星火商店的软件包并不是适配所有发行版的;尽管绝大多数的软件更新是无害的,您仍然应该仔细检查显示出来的更新内容,以确保不会对您的依赖环境造成破坏,尤其是那些看起来和系统依赖相关的软件包。在查看过更新列表之后,确认更新之前,您仍有一次取消更新的机会。"
|
||||||
|
echo "本脚本的开发者不对使用该脚本可能造成的后果负责"
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo "请按任意键继续..."
|
||||||
|
read
|
||||||
|
|
||||||
|
reset
|
||||||
|
|
||||||
|
endloop=0
|
||||||
|
while [ $endloop -eq 0 ] ;do
|
||||||
|
echo "欢迎使用星火更新工具 脚本版 "
|
||||||
|
echo "请在以下操作中选择一个进行~"
|
||||||
|
echo "输入1 开启或关闭星火更新检测工具(如果开启则会在系统启动后自动检测更新。如有更新则会弹出通知)"
|
||||||
|
echo "输入2 查看可更新软件包列表并决定是否更新"
|
||||||
|
echo "输入3 退出脚本"
|
||||||
|
read option
|
||||||
|
|
||||||
|
case $option in
|
||||||
|
1)
|
||||||
|
echo "执行以下操作需要授权..."
|
||||||
|
if [ -f /etc/xdg/autostart/spark-update-notifier.desktop ];then
|
||||||
|
echo "检测到已经启动了自动更新检测,关闭中"
|
||||||
|
sudo systemctl disable spark-update-notifier
|
||||||
|
sudo rm /etc/xdg/autostart/spark-update-notifier.desktop
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "未检测到自动更新检测,启动中"
|
||||||
|
sudo systemctl enable spark-update-notifier
|
||||||
|
sudo service spark-update-notifier start
|
||||||
|
# ln -s /opt/durapps/spark-store/bin/update-upgrade/autostart/spark-update-notifier.desktop $XDG_CONFIG_HOME/autostart
|
||||||
|
#
|
||||||
|
sudo ln -s /opt/durapps/spark-store/bin/update-upgrade/autostart/spark-update-notifier.desktop /etc/xdg/autostart
|
||||||
|
/opt/durapps/spark-store/bin/update-upgrade/ss-update-notify.sh now
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
2)
|
||||||
|
echo "执行以下操作需要授权..."
|
||||||
|
/opt/durapps/spark-store/bin/update-upgrade/ss-upgrade-list.sh
|
||||||
|
/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade.sh
|
||||||
|
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
echo "按回车退出"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "无法识别的输入!请重新输入"
|
||||||
|
reset
|
||||||
|
esac
|
||||||
|
|
||||||
|
done
|
||||||
57
tool/update-upgrade/ss-update-notify-placer.sh
Executable file
57
tool/update-upgrade/ss-update-notify-placer.sh
Executable file
@@ -0,0 +1,57 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
rm -rf /tmp/spark-store-updatenum/number
|
||||||
|
LANG=en.US
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#检测网络链接畅通
|
||||||
|
function network()
|
||||||
|
{
|
||||||
|
#超时时间
|
||||||
|
local timeout=1
|
||||||
|
|
||||||
|
#目标网站
|
||||||
|
local target=www.baidu.com
|
||||||
|
|
||||||
|
#获取响应状态码
|
||||||
|
local ret_code=`curl -I -s --connect-timeout ${timeout} ${target} -w %{http_code} | tail -n1`
|
||||||
|
|
||||||
|
if [ "x$ret_code" = "x200" ]; then
|
||||||
|
#网络畅通
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
#网络不畅通
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
network
|
||||||
|
if [ $? -eq 1 ];then
|
||||||
|
echo "Network fail. Stop to avoid bother dpkg"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#The code above is modified from https://blog.csdn.net/yaxuan88521/article/details/120516298
|
||||||
|
|
||||||
|
|
||||||
|
updatetext=`sudo apt update -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"`
|
||||||
|
|
||||||
|
mkdir -p /tmp/spark-store-updatenum/
|
||||||
|
|
||||||
|
|
||||||
|
isupdate=`echo ${updatetext: -5}`
|
||||||
|
if [ "$isupdate" = "date." ];then
|
||||||
|
sudo echo "0" > /tmp/spark-store-updatenum/number
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
update_app_number=`echo ${updatetext%package*} #从右向左截取第一个 src 后的字符串`
|
||||||
|
update_app_number=`echo ${update_app_number: -1}`
|
||||||
|
sudo echo "$update_app_number" > /tmp/spark-store-updatenum/number
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
28
tool/update-upgrade/ss-update-notify.sh
Executable file
28
tool/update-upgrade/ss-update-notify.sh
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
isexistnumber=0
|
||||||
|
if [ "$1" = "now" ];then
|
||||||
|
if [ -f /tmp/spark-store-updatenum/number ];then
|
||||||
|
update_app_number=`cat /tmp/spark-store-updatenum/number`
|
||||||
|
echo "$update_app_number"
|
||||||
|
if [ "$update_app_number" = "0" ];then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
notify-send -i spark-store "星火更新提醒" "星火商店仓库中有$update_app_number个软件包可以更新啦!请到星火商店的菜单处理"
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
until [ $isexistnumber -eq 1 ];do
|
||||||
|
if [ -f /tmp/spark-store-updatenum/number ];then
|
||||||
|
sleep 10
|
||||||
|
update_app_number=`cat /tmp/spark-store-updatenum/number`
|
||||||
|
echo "$update_app_number"
|
||||||
|
if [ "$update_app_number" = "0" ];then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
notify-send -i spark-store "星火更新提醒" "星火商店仓库中有$update_app_number个软件包可以更新啦!请到星火商店的菜单处理"
|
||||||
|
isexistnumber=1
|
||||||
|
fi
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
6
tool/update-upgrade/ss-upgrade-list.sh
Executable file
6
tool/update-upgrade/ss-upgrade-list.sh
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
|
||||||
|
echo "可更新的应用有:"
|
||||||
|
sudo apt list --upgradable -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
reset
|
reset
|
||||||
|
|
||||||
echo Copyright (c) 2019-2021 The Spark Project
|
echo "Copyright (c) 2019-2021 The Spark Project"
|
||||||
|
|
||||||
if [ -x "/usr/bin/deepin-deb-installer" ] ; then
|
if [ -x "/usr/bin/deepin-deb-installer" ] ; then
|
||||||
echo "深度软件包安装器已安装,开始检测证书"
|
echo "深度软件包安装器已安装,开始检测证书"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
reset
|
reset
|
||||||
|
|
||||||
echo Copyright (c) 2019-2021 The Spark Project
|
echo "Copyright (c) 2019-2021 The Spark Project"
|
||||||
|
|
||||||
if [ -x "/usr/bin/deepin-deb-installer" ] ; then
|
if [ -x "/usr/bin/deepin-deb-installer" ] ; then
|
||||||
echo "深度软件包安装器已安装,开始检测证书"
|
echo "深度软件包安装器已安装,开始检测证书"
|
||||||
|
|||||||
Reference in New Issue
Block a user