uninstaller

This commit is contained in:
shenmo 2023-11-12 14:58:55 +08:00
parent a3e9fa3fc8
commit 027b521b45
9 changed files with 72 additions and 7 deletions

View File

@ -1,8 +1,8 @@
Package: cn.flamescion.bookworm-compatibility-mode
Version: 12.3.3
Version: 12.3.4
Section: misc
Priority: optional
Depends: bubblewrap,flatpak
Depends: bubblewrap,flatpak,zenity
Maintainer: shenmo <shenmo@spark-app.store>
Architecture: arm64
Description: bwrap wrapper for install and running debs inside a bookworm container

View File

@ -4,4 +4,5 @@ export PACKAGE_NAME="$DPKG_MAINTSCRIPT_PACKAGE"
if [ "$PACKAGE_NAME" = "cn.flamescion.bookworm-compatibility-mode" ];then
ln -sf /opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/bookworm-run /usr/bin/bookworm-run
ln -sf /opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/ace-uninstall-helper /usr/bin/ace-uninstall-helper
ln -sf /opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/ace-uninstall-helper-gui /usr/bin/ace-uninstall-helper-gui
fi

View File

@ -4,6 +4,7 @@ if [ "$1" = "remove" ] || [ "$1" = "purge" ];then
if [ "$PACKAGE_NAME" = "cn.flamescion.bookworm-compatibility-mode" ];then
unlink /usr/bin/bookworm-run
unlink /usr/bin/ace-uninstall-helper
unlink /usr/bin/ace-uninstall-helper-gui
fi
echo "清理卸载残留"

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Version=1.0
Name=ACE Software Uninstaller
Name[zh_CN]=ACE
Comment=ACE
Type=Application
Exec=/home/shenmo-ikun/Desktop/bookworm-compatibility-mode/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/ace-uninstall-helper-gui
Icon=ACE-uninstaller
Categories=AudioVideo
# Generated from the DesktopGenerater component of the z-Tools toolkit

View File

@ -1,9 +1,10 @@
[Desktop Entry]
Categories=utils
Exec=/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/bookworm-run %U
Exec=bookworm-run %U
Icon=cn.flamescion.bookworm-compatibility-mode
Name=Bookworm CM
Name[zh_CN]=
Name=Amber CE
Name[zh_CN]=ACE
Keywords=BCM,ACE,ace,mode
StartupNotify=true
Type=Application
Terminal=true

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

View File

@ -1,7 +1,9 @@
#!/bin/bash
if [ "$UID" != "0" ];then
echo "Need to be run as root."
exit
fi
# 清除先前的变量值
unset ABSOLUTE_PATH IN_CONTAINER_PATH PKGNAME_GUESS DPKG_LIST_FILE ACE_ENV_PATH

View File

@ -0,0 +1,49 @@
#!/bin/bash
if [ "$UID" != "0" ];then
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY $0
exit
fi
# 定义应用列表文件路径
ACE_dir="/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bookworm-env"
# 读取所有.desktop文件并构造应用列表
app_list=()
for file in "$ACE_dir"/usr/share/applications/*.desktop; do
if [ ! -e "$file" ];then ##可能是软链接,对主机来说无用
file=$ACE_dir$(readlink $file)
fi
# 读取应用名称和简介
name_orig=$(grep -m 1 '^Name=' "$file" | cut -d '=' -f 2)
name_i18n=$(grep -m 1 "^Name\[${LANGUAGE}\]\=" "$file" | cut -d '=' -f 2)
if [ -z "$name_i18n" ] ;then
name=$name_orig
else
name=$name_i18n
fi
comment=$(grep -m 1 '^Comment=' "$file" | cut -d '=' -f 2)
# 如果没有简介,则显示"N/A"
[[ -z "$comment" ]] && comment="N/A"
# 添加到应用列表数组
app_list+=("false" "$name" "$comment" "$file")
done
# 使用 Zenity 显示应用列表,并获取用户选择
selected_apps=$(zenity --list --title "应用列表" --column "是否卸载" --column "应用名称" --column "应用介绍" --column "desktop文件位置" --checklist "${app_list[@]}" --print-column=4 --hide-column=4 --separator=" " --width=800 --height=400)
# 检查用户是否做出了选择
if [ -n "$selected_apps" ]; then
# 卸载选中的应用
for app_desktop_path in $selected_apps; do
ace-uninstall-helper "$app_desktop_path"
ret=$?
if [ "$ret" != "0" ];then
zenity --error --width 768 --text "$app_desktop_path 卸载失败,中止操作\n请手动执行\nsudo ace-uninstall-helper $app_desktop_path \n查看报错"
exit 1
fi
done
zenity --info --text "选定应用已卸载"
else
zenity --info --text "未选择任何应用"
fi