adjust:v23 does not this patch anymore

Signed-off-by: shenmo <jifengshenmo@outlook.com>
This commit is contained in:
2024-06-25 07:43:14 +00:00
committed by Gitee
parent 8777d9d3c4
commit 883476827b

View File

@@ -1,5 +1,9 @@
#!/bin/bash #!/bin/bash
enumAppInfoList() { enumAppInfoList() {
appInfoList=() appInfoList=()
apps="/opt/apps" apps="/opt/apps"
@@ -9,7 +13,6 @@ enumAppInfoList() {
done done
echo "${appInfoList[@]}" echo "${appInfoList[@]}"
} }
linkDir() { linkDir() {
ensureTargetDir() { ensureTargetDir() {
targetFile=$1 targetFile=$1
@@ -23,14 +26,17 @@ 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/}"
ensureTargetDir "$targetFile" ensureTargetDir "$targetFile"
sourceFile=$(realpath --relative-to="$(dirname $targetFile)" "$sourceFile" ) sourceFile=$(realpath --relative-to="$(dirname $targetFile)" "$sourceFile" )
if [ ! -e ${targetFile} ];then if [ ! -e ${targetFile} ];then
ln -sv "$sourceFile" "$targetFile" ln -sv "$sourceFile" "$targetFile"
fi fi
done done
} }
linkApp() { linkApp() {
appID=$1 appID=$1
appEntriesDir="/opt/apps/$appID/entries" appEntriesDir="/opt/apps/$appID/entries"
@@ -57,29 +63,33 @@ linkApp() {
done done
} }
function exec_uos_package_link() { function exec_uos_package_link(){
for app in $(enumAppInfoList); do
linkApp "$app" & for app in $(enumAppInfoList); do
done linkApp "$app" &
wait
done
wait
} }
function exec_v23_icon_link(){ function exec_v23_icon_link(){
# Fix v23 broken icon # Fix v23 broken icon
if [ ! -d "/usr/share/icons/hicolor/scalable/apps" ]; then if [ ! -d "/usr/share/icons/hicolor/scalable/apps" ];then
mkdir -p /usr/share/icons/hicolor/scalable/apps 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 /usr/share/icons/*.xpm 2>/dev/null); do for icon_root_icon_path in $(ls /usr/share/icons/*.png /usr/share/icons/*.svg 2>/dev/null)
target_icon_path=/usr/share/icons/hicolor/scalable/apps/$(basename ${icon_root_icon_path}) do
if [ ! -e ${target_icon_path} ]; then target_icon_path=/usr/share/icons/hicolor/scalable/apps/$(basename ${icon_root_icon_path})
ln -sv $(realpath --relative-to=/usr/share/icons/hicolor/scalable/apps ${icon_root_icon_path}) /usr/share/icons/hicolor/scalable/apps if [ ! -e ${target_icon_path} ];then
fi ln -sv $(realpath --relative-to=/usr/share/icons/hicolor/scalable/apps ${icon_root_icon_path}) /usr/share/icons/hicolor/scalable/apps
done fi
done
} }
function exec_link_clean(){ function exec_link_clean(){
# remove broken links in /usr/share # remove broken links in /usr/share
find /usr/share/applications -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & find /usr/share/applications -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
find /usr/share/icons -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & find /usr/share/icons -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
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/mime/packages -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
@@ -93,24 +103,26 @@ function exec_link_clean(){
find /usr/share/polkit-1/actions -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 -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
find /usr/share/fonts -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & find /usr/share/fonts -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
find /etc/fonts/conf.d -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & find /etc/fonts/conf.d -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
}
function exec_uos_package_update() {
}
function exec_uos_package_update(){
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----------------" echo "----------------Running Spark DStore Patch----------------"
if [ ! -e /usr/bin/deepin-app-store-tool ]; then if [ ! -e /usr/bin/deepin-app-store-tool ];then
# execute linkApp function for each app and print output # execute linkApp function for each app and print output
exec_uos_package_link exec_uos_package_link
fi
exec_v23_icon_link fi
exec_link_clean #exec_v23_icon_link
#exec_link_clean
wait wait
exec_uos_package_update exec_uos_package_update
echo "----------------Finished----------------" echo "----------------Finished----------------"