diff --git a/debian/changelog b/debian/changelog index 088306ad67bc9cfd8c1ae481c54233e5d495e7bd..3b23796b845e1e6d23bb5218bb31c4a470bae798 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +spark-store (4.2.5.1) stable; urgency=medium + * 调整:重写了spark-dstore-patch,速度提升,尤其对机械硬盘下 + * 调整:优化了aptss源文件同步策略 + + -- shenmo + + spark-store (4.2.5) stable; urgency=medium * 修复:ssinstall在文件不存在时仍然报安装成功 * 修复:删除不再需要的依赖:libc6-dev diff --git a/debian/control b/debian/control index 2e62d79d386b9b4b01f36249701bcf5335254e3c..6e1dca0610a531202e7dfed9e80078d4c47af65b 100644 --- a/debian/control +++ b/debian/control @@ -40,7 +40,7 @@ Depends:${shlibs:Depends}, ${misc:Depends}, openssl, dde-qt5integration, aria2, - gcc, + gnupg, zenity, policykit-1, libnotify-bin diff --git a/spark-store-project.pro b/spark-store-project.pro index 4b698fe76ac3bb650db1109c9182efac493dfd92..119364ec057090f635ca486345a1c2bc58606f06 100644 --- a/spark-store-project.pro +++ b/spark-store-project.pro @@ -11,7 +11,6 @@ TEMPLATE = subdirs CONFIG += wayland-compositor SUBDIRS += \ - src/spark-dstore-patch \ src/spark-store.pro # https://wiki.debian.org/Hardening diff --git a/src/spark-dstore-patch/spark-dstore-patch.pro b/src/spark-dstore-patch/spark-dstore-patch.pro deleted file mode 100644 index 841f15e4f2243521f0c90b022a5d1da0e0432f9e..0000000000000000000000000000000000000000 --- a/src/spark-dstore-patch/spark-dstore-patch.pro +++ /dev/null @@ -1,9 +0,0 @@ -TARGET = spark-dstore-patch -TEMPLATE += app -QT += widgets -SOURCES += spark-dstore-tool.cpp - -# Default rules for deployment. -qnx: target.path = /tmp/spark-store/bin -else: unix:!android: target.path = /opt/durapps/spark-store/bin -!isEmpty(target.path): INSTALLS += target \ No newline at end of file diff --git a/src/spark-dstore-patch/spark-dstore-tool.cpp b/src/spark-dstore-patch/spark-dstore-tool.cpp deleted file mode 100644 index dbf3881457dabe7d72eef7b342f01489e4d4a4d3..0000000000000000000000000000000000000000 --- a/src/spark-dstore-patch/spark-dstore-tool.cpp +++ /dev/null @@ -1,195 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include - -QList enumAppInfoList() -{ - QList appInfoList; - QDir apps("/opt/apps"); - auto list = apps.entryList(QDir::Dirs | QDir::NoDotAndDotDot); - for (auto &appID : list) { - auto infoPath = apps.absoluteFilePath(appID + "/info"); - QFile infoFile(infoPath); - if (!infoFile.open(QIODevice::ReadOnly)) { - continue; - } - auto doc = QJsonDocument::fromJson(infoFile.readAll()); - appInfoList.push_back(doc.object()); - } - return appInfoList; -} -//这段是去找appid和info,没看懂用来干啥的,在此之后info文件也没再用过 -//可能以后版本的实现会用到,等官方加功能再说 -void linkDir(const QString &source, const QString &target) -{ - auto ensureTargetDir = [](const QString &targetFile) { - QFileInfo t(targetFile); - QDir tDir(t.dir()); - tDir.mkpath("."); - }; - - QDir sourceDir(source); - QDir targetDir(target); - QDirIterator iter(source, QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); - while (iter.hasNext()) { - auto sourceFile = iter.next(); - auto targetFile = targetDir.absoluteFilePath(sourceDir.relativeFilePath(sourceFile)); - - QFileInfo tfi(targetFile); - // if (tfi.isSymLink() && (tfi.canonicalFilePath() == sourceFile)) { - //这里官方应该是写错了,否则会每触发一次就把所有软链接都删了重新创建一次 - if (tfi.isSymLink() && (tfi.symLinkTarget() == sourceFile)) { - continue; - } else { - QFile::remove(targetFile); - } - - ensureTargetDir(targetFile); - auto ret = symlink(sourceFile.toStdString().c_str(), targetFile.toStdString().c_str()); - if (0 != ret) { - qDebug() << "link failed" << sourceFile << "=>" << targetFile << ret; - } - } -} - -//reset Dynamic library rpath -void setRpath(const QString &file, const QString &path) -{ - if (!QFileInfo::exists(path)) - return; - QProcess p; - auto cmd = "patchelf " + file + " --set-rpath " + path; - p.start("bash", QStringList {"-c", cmd}); - p.waitForFinished(); -} - -QString getGlic() -{ - //get arch & glibc - QProcess p; - auto cmd = "gcc -dumpmachine"; - p.start("bash", QStringList {"-c", cmd}); - p.waitForFinished(); - return p.readAll(); -} - -void linkApp(const QJsonObject &app) -{ - auto appID = app.value("appid").toString(); - auto appEntriesDir = QDir("/opt/apps/" + appID + "/entries"); - auto appLibsDir = QDir("/opt/apps/" + appID + "/files/lib"); - auto autoStartDir = QDir(appEntriesDir.absoluteFilePath("autostart")); - - bool autoStart = app.value("permissions").toObject().value("autostart").toBool(); - if (autoStart) { - linkDir(appEntriesDir.absoluteFilePath("autostart"), "/etc/xdg/autostart"); - } - - // link application - auto sysShareDir = QDir("/usr/share"); - linkDir(appEntriesDir.absoluteFilePath("applications"), sysShareDir.absoluteFilePath("applications")); - linkDir(appEntriesDir.absoluteFilePath("icons"), sysShareDir.absoluteFilePath("icons")); - linkDir(appEntriesDir.absoluteFilePath("mime"), sysShareDir.absoluteFilePath("mime")); - linkDir(appEntriesDir.absoluteFilePath("glib-2.0"), sysShareDir.absoluteFilePath("glib-2.0")); - linkDir(appEntriesDir.absoluteFilePath("services"), sysShareDir.absoluteFilePath("dbus-1/services")); - linkDir(appEntriesDir.absoluteFilePath("GConf"), sysShareDir.absoluteFilePath("GConf")); - linkDir(appEntriesDir.absoluteFilePath("help"), sysShareDir.absoluteFilePath("help")); - linkDir(appEntriesDir.absoluteFilePath("locale"), sysShareDir.absoluteFilePath("locale")); - linkDir(appEntriesDir.absoluteFilePath("fcitx"), sysShareDir.absoluteFilePath("fcitx")); - linkDir(appEntriesDir.absoluteFilePath("polkit"), sysShareDir.absoluteFilePath("polkit-1")); - linkDir(appEntriesDir.absoluteFilePath("fonts/conf"), "/etc/fonts/conf.d"); - linkDir(appEntriesDir.absoluteFilePath("fonts/files"), sysShareDir.absoluteFilePath("fonts")); - - -//原来会导致Gtk相关应用翻译缺失,补足了 - - - auto pluginDir = QDir(appEntriesDir.absoluteFilePath("plugins")); - if (pluginDir.exists()) { - QString arch = getGlic(); - // if (pluginDir.exists()) { - // QDirIterator iter(pluginDir.absolutePath(), QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); - // while (iter.hasNext()) { - // auto sourceFile = iter.next(); - // setRpath(sourceFile, appLibsDir.absolutePath()); //set rpath - // } - // } - - linkDir(appEntriesDir.absoluteFilePath("plugins/fcitx"), "/usr/lib/" + arch + "/fcitx"); - linkDir(appEntriesDir.absoluteFilePath("plugins/browser"), "/usr/lib/mozilla/plugins"); - } -} - -void cleanLink() -{ - auto cleanDirBrokenLink = [](const QString &dir) { - QProcess p; - auto cmd = "find " + dir + " -xtype l -delete"; - p.start("bash", QStringList {"-c", cmd}); - p.waitForFinished(); - }; - - QString arch = getGlic(); - auto sysShareDir = QDir("/usr/share"); - cleanDirBrokenLink(sysShareDir.absoluteFilePath("applications")); - cleanDirBrokenLink(sysShareDir.absoluteFilePath("icons")); - cleanDirBrokenLink(sysShareDir.absoluteFilePath("mime/packages")); - cleanDirBrokenLink(sysShareDir.absoluteFilePath("glib-2.0")); - cleanDirBrokenLink(sysShareDir.absoluteFilePath("dbus-1/services")); - cleanDirBrokenLink("/etc/xdg/autostart"); - cleanDirBrokenLink(sysShareDir.absoluteFilePath("fcitx")); - cleanDirBrokenLink(sysShareDir.absoluteFilePath("help")); - cleanDirBrokenLink(sysShareDir.absoluteFilePath("locale")); - cleanDirBrokenLink("/usr/lib/" + arch + "/fcitx"); - cleanDirBrokenLink("/usr/lib/mozilla/plugins"); - cleanDirBrokenLink(sysShareDir.absoluteFilePath("polkit-1/actions")); - cleanDirBrokenLink(sysShareDir.absoluteFilePath("fonts")); - cleanDirBrokenLink("/etc/fonts/conf.d"); -} - -void update() -{ - QProcess p; - auto cmd = "glib-compile-schemas /usr/share/glib-2.0/schemas/"; - p.start("bash", QStringList {"-c", cmd}); - p.waitForFinished(); - - cmd = "update-icon-caches /usr/share/icons/*"; - p.start("bash", QStringList {"-c", cmd}); - p.waitForFinished(); - - cmd = "update-desktop-database -q"; - p.start("bash", QStringList {"-c", cmd}); - p.waitForFinished(); - - cmd = "update-mime-database -V /usr/share/mime"; - p.start("bash", QStringList {"-c", cmd}); - p.waitForFinished(); - - -} - - - -int main(int argc, char **argv) -{ - QCoreApplication app(argc, argv); - - cleanLink(); - - for (auto &a : enumAppInfoList()) { - linkApp(a); - } - qInfo()<<"Spark dstore patch (c) The Spark Project 2022-Now. Modified from deepin-app-store-tool"; - - // trigger - update(); - - return 0; -} diff --git a/tool/aptss b/tool/aptss index 2854dbac818b51b32298673cc49cea2a2c998cf7..21a6ae52533944798c1ed013f44250571c82dec2 100755 --- a/tool/aptss +++ b/tool/aptss @@ -28,19 +28,10 @@ echo "${TRANSHELL_CONTENT_RUNNING_IN_NOT_ROOT_USER}" else -if is_empty_dir /etc/apt/sources.list.d/ ;then -echo "${TRANSHELL_CONTENT_INFO_SOURCES_LIST_D_IS_EMPTY}" -else + ln -sf /etc/apt/sources.list.d/* /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d ###让这里和系统同步,先链接,然后清除无效链接 -for a in `find /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d -type l` - do - stat -L $a >/dev/null 2>/dev/null - if [ $? -gt 0 ];then - rm $a - fi - done -fi +find /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d -xtype l -delete fi diff --git a/tool/spark-dstore-patch b/tool/spark-dstore-patch new file mode 100755 index 0000000000000000000000000000000000000000..28b4592102de5dd27a886624ae379837a6ecb65f --- /dev/null +++ b/tool/spark-dstore-patch @@ -0,0 +1,124 @@ +#!/bin/bash + +echo "----------------Running Spark DStore Patch----------------" +#!/bin/bash + + +enumAppInfoList() { + appInfoList=() + apps="/opt/apps" + list=$(ls $apps) + for appID in $list; do + appInfoList+=("$appID") + done + echo "${appInfoList[@]}" +} +linkDir() { + ensureTargetDir() { + targetFile=$1 + t=$(dirname "$targetFile") + mkdir -p "$t" + } + + source=$1 + target=$2 + sourceDir=$(dirname "$source") + targetDir=$(dirname "$target") + find "$source" -type f | while read sourceFile; do + targetFile="$targetDir/${sourceFile#$sourceDir/}" + if [ -L "$targetFile" ] && [ "$(readlink "$targetFile")" = "$sourceFile" ]; then + continue + else + rm -f "$targetFile" + fi + + ensureTargetDir "$targetFile" + ln -s "$sourceFile" "$targetFile" + done +} + +linkApp() { + appID=$1 + appEntriesDir="/opt/apps/$appID/entries" + appLibsDir="/opt/apps/$appID/files/lib" + autoStartDir="$appEntriesDir/autostart" + + if [ -d "$autoStartDir" ]; then + linkDir "$autoStartDir" "/etc/xdg/autostart" + fi + + # link application + sysShareDir="/usr/share" + for folder in "$appEntriesDir/applications" "$appEntriesDir/icons" "$appEntriesDir/mime" "$appEntriesDir/glib-2.0" "$appEntriesDir/services" "$appEntriesDir/GConf" "$appEntriesDir/help" "$appEntriesDir/locale" "$appEntriesDir/fcitx"; do + if [ ! -d "$folder" ]; then + continue + fi + if [ "$folder" = "$appEntriesDir/polkit" ]; then + linkDir "$folder" "/usr/share/polkit-1" + elif [ "$folder" = "$appEntriesDir/fonts/conf" ]; then + linkDir "$folder" "/etc/fonts/conf.d" + else + linkDir "$folder" "$sysShareDir/${folder##*/}" + fi + done +} + + +# execute linkApp function for each app and print output +for app in $(enumAppInfoList); do + linkApp "$app" & + + if [ "$1" = "--debug" ]; then + echo "Linking for $app" + fi +# remove broken links in /usr/share +done +wait + +if [ "$1" = "--debug" ]; then + echo "Cleaning links and updating databases and caches..." +fi + + +if [ "$1" = "--debug" ]; then + find /usr/share/applications -xtype l -delete & + find /usr/share/icons -xtype l -delete & + find /usr/share/mime/packages -xtype l -delete & + find /usr/share/glib-2.0 -xtype l -delete & + find /usr/share/dbus-1/services -xtype l -delete & + find /usr/share/fcitx -xtype l -delete & + find /usr/share/help -xtype l -delete & + find /usr/share/locale -xtype l -delete & + find /usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`/fcitx -xtype l -delete & + find /usr/lib/mozilla/plugins -xtype l -delete & + find /usr/share/polkit-1/actions -xtype l -delete & + find /usr/share/fonts -xtype l -delete & + find /etc/fonts/conf.d -xtype l -delete & + update-icon-caches /usr/share/icons/* & + update-desktop-database -q & + update-mime-database -V /usr/share/mime & + glib-compile-schemas /usr/share/glib-2.0/schemas/ & + wait +else + find /usr/share/applications -xtype l -delete > /dev/null 2>&1 & + find /usr/share/icons -xtype l -delete > /dev/null 2>&1 & + find /usr/share/mime/packages -xtype l -delete > /dev/null 2>&1 & + find /usr/share/glib-2.0 -xtype l -delete > /dev/null 2>&1 & + find /usr/share/dbus-1/services -xtype l -delete > /dev/null 2>&1 & + find /usr/share/fcitx -xtype l -delete > /dev/null 2>&1 & + find /usr/share/help -xtype l -delete > /dev/null 2>&1 & + find /usr/share/locale -xtype l -delete > /dev/null 2>&1 & + find /usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`/fcitx -xtype l -delete > /dev/null 2>&1 & + find /usr/lib/mozilla/plugins -xtype l -delete > /dev/null 2>&1 & + find /usr/share/polkit-1/actions -xtype l -delete > /dev/null 2>&1 & + find /usr/share/fonts -xtype l -delete > /dev/null 2>&1 & + find /etc/fonts/conf.d -xtype l -delete > /dev/null 2>&1 & + update-icon-caches /usr/share/icons/* > /dev/null 2>&1 & + update-desktop-database -q > /dev/null 2>&1 & + update-mime-database -V /usr/share/mime > /dev/null 2>&1 & + glib-compile-schemas /usr/share/glib-2.0/schemas/ > /dev/null 2>&1 & +fi + + + +echo "----------------Finished----------------"