From 7f1851b5cc355ae760c09243b349a3db52565dc9 Mon Sep 17 00:00:00 2001 From: shenmo Date: Wed, 22 Oct 2025 12:29:16 +0800 Subject: [PATCH] =?UTF-8?q?1.0.7=20=E4=BF=AE=E5=A4=8D=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E5=9C=A8=E4=B8=BB=E6=9C=BA=E6=97=B6=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=89=BE=E5=88=B0=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apm-dummy/DEBIAN/control | 2 +- apm-dummy/usr/bin/amber-pm-dstore-patch | 47 +++++++++++++++++++++++++ src/DEBIAN/control | 4 +-- src/usr/bin/amber-pm-dstore-patch | 46 ++++++++++++++++++++++++ src/usr/bin/apm | 11 +++++- 5 files changed, 106 insertions(+), 4 deletions(-) diff --git a/apm-dummy/DEBIAN/control b/apm-dummy/DEBIAN/control index ff65d26..f1502dd 100755 --- a/apm-dummy/DEBIAN/control +++ b/apm-dummy/DEBIAN/control @@ -1,5 +1,5 @@ Package: apm -Version: 1.0 +Version: 1.1 Maintainer: shenmo Priority: optional Section: utils diff --git a/apm-dummy/usr/bin/amber-pm-dstore-patch b/apm-dummy/usr/bin/amber-pm-dstore-patch index f7ebd1a..2ff0082 100755 --- a/apm-dummy/usr/bin/amber-pm-dstore-patch +++ b/apm-dummy/usr/bin/amber-pm-dstore-patch @@ -114,9 +114,52 @@ function exec_uos_package_update(){ } +function exec_debian_compatibile_links(){ +# 源目录和目标目录定义 +local SOURCE_DIR="/var/lib/apm" +local TARGET_DIR="/var/lib/apm/apm/files/ace-env/var/lib/apm" + +# 检查目标目录是否存在 +if [[ ! -d "$TARGET_DIR" ]]; then + mkdir -p $TARGET_DIR +fi + +# 第一部分:为缺失的目录创建软链接 +echo "检查并创建缺失的软链接..." +for dir in "$SOURCE_DIR"/*/; do + # 获取目录名(去掉路径和尾部斜杠) + dirname=$(basename "$dir") + + # 跳过 apm 目录 + if [[ "$dirname" == "apm" ]]; then + continue + fi + + # 检查目标目录中是否已存在对应的软链接或目录 + target_link="$TARGET_DIR/$dirname" + if [[ ! -e "$target_link" ]]; then + echo "创建软链接: $target_link -> $dir" + ln -sv "$dir" "$target_link" + fi +done + +# 第二部分:清理无效的软链接 +echo "清理无效的软链接..." +for link in "$TARGET_DIR"/*; do + # 检查是否为软链接 + if [[ -L "$link" ]]; then + # 检查软链接是否有效(指向的目标是否存在) + if [[ ! -e "$link" ]]; then + echo "删除无效软链接: $link" + rm "$link" + fi + fi +done +} ######################################################################################### echo "----------------Running APM Dstore Patch----------------" +# execute linkApp function for each app and print output exec_uos_package_link @@ -124,4 +167,8 @@ exec_uos_package_link exec_link_clean wait exec_uos_package_update +if [[ "${IS_APM_ENV}" = "" ]];then +exec_debian_compatibile_links +fi + echo "----------------Finished----------------" diff --git a/src/DEBIAN/control b/src/DEBIAN/control index 0faa6e2..538194f 100755 --- a/src/DEBIAN/control +++ b/src/DEBIAN/control @@ -1,9 +1,9 @@ Package: apm Source: amber-ce -Version: 1.0.6 +Version: 1.0.7 Architecture: amd64 Maintainer: shenmo -Installed-Size: 48540 +Installed-Size: 49036 Depends: bubblewrap, flatpak, policykit-1 | pkexec | polkit-1 | polkit, systemd, procps,coreutils,fuse-overlayfs Section: misc Conflicts: ace-host-integration diff --git a/src/usr/bin/amber-pm-dstore-patch b/src/usr/bin/amber-pm-dstore-patch index fe1f532..2ff0082 100755 --- a/src/usr/bin/amber-pm-dstore-patch +++ b/src/usr/bin/amber-pm-dstore-patch @@ -114,6 +114,48 @@ function exec_uos_package_update(){ } +function exec_debian_compatibile_links(){ +# 源目录和目标目录定义 +local SOURCE_DIR="/var/lib/apm" +local TARGET_DIR="/var/lib/apm/apm/files/ace-env/var/lib/apm" + +# 检查目标目录是否存在 +if [[ ! -d "$TARGET_DIR" ]]; then + mkdir -p $TARGET_DIR +fi + +# 第一部分:为缺失的目录创建软链接 +echo "检查并创建缺失的软链接..." +for dir in "$SOURCE_DIR"/*/; do + # 获取目录名(去掉路径和尾部斜杠) + dirname=$(basename "$dir") + + # 跳过 apm 目录 + if [[ "$dirname" == "apm" ]]; then + continue + fi + + # 检查目标目录中是否已存在对应的软链接或目录 + target_link="$TARGET_DIR/$dirname" + if [[ ! -e "$target_link" ]]; then + echo "创建软链接: $target_link -> $dir" + ln -sv "$dir" "$target_link" + fi +done + +# 第二部分:清理无效的软链接 +echo "清理无效的软链接..." +for link in "$TARGET_DIR"/*; do + # 检查是否为软链接 + if [[ -L "$link" ]]; then + # 检查软链接是否有效(指向的目标是否存在) + if [[ ! -e "$link" ]]; then + echo "删除无效软链接: $link" + rm "$link" + fi + fi +done +} ######################################################################################### echo "----------------Running APM Dstore Patch----------------" @@ -125,4 +167,8 @@ exec_uos_package_link exec_link_clean wait exec_uos_package_update +if [[ "${IS_APM_ENV}" = "" ]];then +exec_debian_compatibile_links +fi + echo "----------------Finished----------------" diff --git a/src/usr/bin/apm b/src/usr/bin/apm index 7d972f8..7cea672 100755 --- a/src/usr/bin/apm +++ b/src/usr/bin/apm @@ -21,6 +21,7 @@ Commands: install 安装软件包 remove 卸载软件包 update 更新软件包信息 + download 下载包 clean 清除缓存软件包 autoremove 自动移除不需要的包 full-upgrade 完全升级软件包 @@ -110,13 +111,21 @@ case "$1" in command=$1 shift amber-pm-debug aptss "$command" "$@" + amber-pm-debug amber-pm-dstore-patch apm-nvidia-toggle ;; - remove|autoremove|search|policy|list|update|purge|autopurge|clean) + download|search|policy|list|update|clean) + command=$1 + shift + amber-pm-debug aptss "$command" "$@" + ;; + + remove|autoremove|purge|autopurge) # 特殊APT命令:移除第一个参数后传递其余参数 command=$1 shift amber-pm-debug aptss "$command" "$@" + amber-pm-debug amber-pm-dstore-patch ;; run) # 运行包命令:第二个参数必须是包名