From 804db2e623a80533810f5eb5f9caab974da74065 Mon Sep 17 00:00:00 2001 From: shenmo Date: Wed, 17 Apr 2024 16:36:48 +0800 Subject: [PATCH] fix: icon break on v23 --- debian/changelog | 2 ++ tool/spark-dstore-patch | 79 ++++++++++++++++------------------------- 2 files changed, 32 insertions(+), 49 deletions(-) diff --git a/debian/changelog b/debian/changelog index fc39d21..8eca23a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ spark-store (4.2.11) stable; urgency=medium * 修复:判断是否安装状态错误 * 修改:部分组件重构提升清晰度 + * 修复:v23下部分应用图标失效 + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 diff --git a/tool/spark-dstore-patch b/tool/spark-dstore-patch index bd09396..07fd244 100755 --- a/tool/spark-dstore-patch +++ b/tool/spark-dstore-patch @@ -26,15 +26,13 @@ linkDir() { 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" sourceFile=$(realpath --relative-to="$(dirname $targetFile)" "$sourceFile" ) - ln -s "$sourceFile" "$targetFile" + if [ ! -e ${targetFile} ];then + ln -sv "$sourceFile" "$targetFile" + fi done } @@ -70,56 +68,39 @@ linkApp() { 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..." +# Fix v23 broken icon +if [ ! -d "/usr/share/icons/hicolor/scalable/apps" ];then +mkdir -p /usr/share/icons/hicolor/scalable/apps fi +for icon_root_icon_path in $(ls /usr/share/icons/*.png /usr/share/icons/*.svg) +do +target_icon_path=/usr/share/icons/hicolor/scalable/apps/$(basename ${icon_root_icon_path}) +if [ ! -e ${target_icon_path} ];then +ln -sv $(realpath --relative-to=/usr/share/icons/hicolor/scalable/apps ${icon_root_icon_path}) /usr/share/icons/hicolor/scalable/apps +fi +done -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 & +# remove broken links in /usr/share + + find /usr/share/applications -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; & + find /usr/share/icons -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; & + find /usr/share/mime/packages -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; & + find /usr/share/glib-2.0 -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; & + find /usr/share/dbus-1/services -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; & + find /usr/share/fcitx -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; & + find /usr/share/help -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; & + find /usr/share/locale -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; & + find /usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`/fcitx -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; & + find /usr/lib/mozilla/plugins -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; & + find /usr/share/polkit-1/actions -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; & + find /usr/share/fonts -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; & + find /etc/fonts/conf.d -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; & 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----------------" \ No newline at end of file +echo "----------------Finished----------------"