diff --git a/apm-dummy/DEBIAN/control b/apm-dummy/DEBIAN/control new file mode 100755 index 0000000..ff65d26 --- /dev/null +++ b/apm-dummy/DEBIAN/control @@ -0,0 +1,9 @@ +Package: apm +Version: 1.0 +Maintainer: shenmo +Priority: optional +Section: utils +Installed-Size: 36 +Description: A empty package to satisfy depends +Architecture: all +Homepage: https://shenmo7192.gitee.io/ diff --git a/apm-dummy/DEBIAN/postinst b/apm-dummy/DEBIAN/postinst new file mode 100755 index 0000000..c244b97 --- /dev/null +++ b/apm-dummy/DEBIAN/postinst @@ -0,0 +1,15 @@ +#!/bin/bash +export PACKAGE_NAME="$DPKG_MAINTSCRIPT_PACKAGE" + + +case "$1" in + triggered) + amber-pm-dstore-patch + + ;; +esac + + + + +true diff --git a/apm-dummy/DEBIAN/triggers b/apm-dummy/DEBIAN/triggers new file mode 100755 index 0000000..85f66a8 --- /dev/null +++ b/apm-dummy/DEBIAN/triggers @@ -0,0 +1 @@ +interest-noawait /var/lib/apm diff --git a/apm-dummy/usr/bin/amber-pm-dstore-patch b/apm-dummy/usr/bin/amber-pm-dstore-patch new file mode 100755 index 0000000..b13eee6 --- /dev/null +++ b/apm-dummy/usr/bin/amber-pm-dstore-patch @@ -0,0 +1,128 @@ +#!/bin/bash + + + + + +enumAppInfoList() { + appInfoList=() + apps="/var/lib/apm" + list=$(ls $apps 2>/dev/null) + 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/}" + + + ensureTargetDir "$targetFile" + sourceFile=$(realpath --relative-to="$(dirname $targetFile)" "$sourceFile" ) + if [ ! -e ${targetFile} ];then + ln -sv "$sourceFile" "$targetFile" + fi + done +} + + +linkApp() { + appID=$1 + appEntriesDir="/var/lib/apm/$appID/entries" + appLibsDir="/var/lib/apm/$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 +} + +function exec_uos_package_link(){ + +for app in $(enumAppInfoList); do + linkApp "$app" & + +done +wait +} + +function exec_v23_icon_link(){ +# 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 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 +} + +function exec_link_clean(){ +# 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/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/glib-2.0 -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 -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & + find /usr/share/fcitx -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & + find /usr/share/help -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & + find /usr/share/locale -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 -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & + find /usr/lib/mozilla/plugins -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 /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(){ + 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 & + +} + +######################################################################################### +echo "----------------Running APM 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 +#exec_v23_icon_link +exec_link_clean +wait +exec_uos_package_update +echo "----------------Finished----------------" diff --git a/tips.md b/tips.md index 270ffb8..0f8533d 100644 --- a/tips.md +++ b/tips.md @@ -1,6 +1,9 @@ apm run 会优先尝试独立环境内启动,失败后会在主机环境尝试启动 +apm 会添加一个钩子(deb only即可),在安装到 /var/lib/apm 下的应用存在ace-env时,进行configure nvidia操作;若存在entries,则进行链接到/usr/share/applications操作 + apm 内置 ubuntu rootfs的修改如下 * 使用支持apm源的aptss,使用独立的sources.list.d(暂未实现) -* 安装一个空的apm包,填充依赖 +* 安装xz-utils +* 安装一个空的apm包,用于填充依赖,附带 amber-pm-dstore-patch