mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-10-09 11:52:21 +08:00
update tool/spark-dstore-patch.
Signed-off-by: shenmo <jifengshenmo@outlook.com>
This commit is contained in:
parent
2d8fd466dd
commit
7b1b1739a3
@ -1,13 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo "----------------Running Spark DStore Patch----------------"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
enumAppInfoList() {
|
enumAppInfoList() {
|
||||||
appInfoList=()
|
appInfoList=()
|
||||||
apps="/opt/apps"
|
apps="/opt/apps"
|
||||||
list=$(ls $apps)
|
list=$(ls $apps 2>/dev/null)
|
||||||
for appID in $list; do
|
for appID in $list; do
|
||||||
appInfoList+=("$appID")
|
appInfoList+=("$appID")
|
||||||
done
|
done
|
||||||
@ -26,15 +26,13 @@ linkDir() {
|
|||||||
targetDir=$(dirname "$target")
|
targetDir=$(dirname "$target")
|
||||||
find "$source" -type f | while read sourceFile; do
|
find "$source" -type f | while read sourceFile; do
|
||||||
targetFile="$targetDir/${sourceFile#$sourceDir/}"
|
targetFile="$targetDir/${sourceFile#$sourceDir/}"
|
||||||
if [ -L "$targetFile" ] && [ "$(readlink "$targetFile")" = "$sourceFile" ]; then
|
|
||||||
continue
|
|
||||||
else
|
|
||||||
rm -f "$targetFile"
|
|
||||||
fi
|
|
||||||
|
|
||||||
ensureTargetDir "$targetFile"
|
ensureTargetDir "$targetFile"
|
||||||
sourceFile=$(realpath --relative-to="$(dirname $targetFile)" "$sourceFile" )
|
sourceFile=$(realpath --relative-to="$(dirname $targetFile)" "$sourceFile" )
|
||||||
ln -s "$sourceFile" "$targetFile"
|
if [ ! -e ${targetFile} ];then
|
||||||
|
ln -sv "$sourceFile" "$targetFile"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,61 +63,66 @@ linkApp() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function exec_uos_package_link(){
|
||||||
|
|
||||||
# execute linkApp function for each app and print output
|
|
||||||
for app in $(enumAppInfoList); do
|
for app in $(enumAppInfoList); do
|
||||||
linkApp "$app" &
|
linkApp "$app" &
|
||||||
|
|
||||||
if [ "$1" = "--debug" ]; then
|
|
||||||
echo "Linking for $app"
|
|
||||||
fi
|
|
||||||
# remove broken links in /usr/share
|
|
||||||
done
|
done
|
||||||
wait
|
wait
|
||||||
|
}
|
||||||
|
|
||||||
if [ "$1" = "--debug" ]; then
|
function exec_v23_icon_link(){
|
||||||
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
|
fi
|
||||||
|
|
||||||
|
for icon_root_icon_path in $(ls /usr/share/icons/*.png /usr/share/icons/*.svg 2>/dev/null)
|
||||||
|
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
|
function exec_link_clean(){
|
||||||
find /usr/share/applications -xtype l -delete &
|
# remove broken links in /usr/share
|
||||||
find /usr/share/icons -xtype l -delete &
|
|
||||||
find /usr/share/mime/packages -xtype l -delete &
|
find /usr/share/applications -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
find /usr/share/glib-2.0 -xtype l -delete &
|
find /usr/share/icons -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
find /usr/share/dbus-1/services -xtype l -delete &
|
find /usr/share/mime/packages -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
find /usr/share/fcitx -xtype l -delete &
|
find /usr/share/glib-2.0 -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
find /usr/share/help -xtype l -delete &
|
find /usr/share/dbus-1/services -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
find /usr/share/locale -xtype l -delete &
|
find /usr/share/fcitx -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
find /usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`/fcitx -xtype l -delete &
|
find /usr/share/help -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
find /usr/lib/mozilla/plugins -xtype l -delete &
|
find /usr/share/locale -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
find /usr/share/polkit-1/actions -xtype l -delete &
|
find /usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`/fcitx -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
find /usr/share/fonts -xtype l -delete &
|
find /usr/lib/mozilla/plugins -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
find /etc/fonts/conf.d -xtype l -delete &
|
find /usr/share/polkit-1/actions -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
update-icon-caches /usr/share/icons/* &
|
find /usr/share/fonts -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
update-desktop-database -q &
|
find /etc/fonts/conf.d -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
update-mime-database -V /usr/share/mime &
|
|
||||||
glib-compile-schemas /usr/share/glib-2.0/schemas/ &
|
|
||||||
wait
|
}
|
||||||
else
|
function exec_uos_package_update(){
|
||||||
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-icon-caches /usr/share/icons/* > /dev/null 2>&1 &
|
||||||
update-desktop-database -q > /dev/null 2>&1 &
|
update-desktop-database -q > /dev/null 2>&1 &
|
||||||
update-mime-database -V /usr/share/mime > /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 &
|
glib-compile-schemas /usr/share/glib-2.0/schemas/ > /dev/null 2>&1 &
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#########################################################################################
|
||||||
|
echo "----------------Running Spark DStore Patch----------------"
|
||||||
|
if [ ! -e /usr/bin/deepin-app-store-tool ];then
|
||||||
|
# execute linkApp function for each app and print output
|
||||||
|
exec_uos_package_link
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
exec_v23_icon_link
|
||||||
|
exec_link_clean
|
||||||
|
wait
|
||||||
|
exec_uos_package_update
|
||||||
echo "----------------Finished----------------"
|
echo "----------------Finished----------------"
|
Loading…
x
Reference in New Issue
Block a user