mirror of
https://gitee.com/amber-ce/amber-ce-bookworm.git
synced 2025-12-14 02:52:04 +08:00
加入卸载助手
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
if [ "$UID" != "0" ];then
|
||||
echo "Need to be run as root."
|
||||
exit
|
||||
exit 1
|
||||
fi
|
||||
# 清除先前的变量值
|
||||
unset ABSOLUTE_PATH IN_CONTAINER_PATH PKGNAME_GUESS DPKG_LIST_FILE ACE_ENV_PATH
|
||||
|
||||
@@ -12,6 +12,9 @@ for file in "$ACE_dir"/usr/share/applications/*.desktop; do
|
||||
if [ ! -e "$file" ];then ##可能是软链接,对主机来说无用
|
||||
file=$ACE_dir$(readlink $file)
|
||||
fi
|
||||
if [ "$(grep -m 1 '^NoDisplay=' "$file" | cut -d '=' -f 2)" = "true" ] || [ "$(grep -m 1 '^NoDisplay=' "$file" | cut -d '=' -f 2)" = "True" ];then
|
||||
continue
|
||||
fi
|
||||
# 读取应用名称和简介
|
||||
name_orig=$(grep -m 1 '^Name=' "$file" | cut -d '=' -f 2)
|
||||
name_i18n=$(grep -m 1 "^Name\[${LANGUAGE}\]\=" "$file" | cut -d '=' -f 2)
|
||||
@@ -34,15 +37,34 @@ selected_apps=$(zenity --list --title "应用列表" --column "是否卸载" --c
|
||||
# 检查用户是否做出了选择
|
||||
if [ -n "$selected_apps" ]; then
|
||||
# 卸载选中的应用
|
||||
for app_desktop_path in $selected_apps; do
|
||||
(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
|
||||
break
|
||||
fi
|
||||
done
|
||||
zenity --info --text "选定应用已卸载"
|
||||
done ) &
|
||||
|
||||
cmd_pid=$!
|
||||
|
||||
|
||||
(while kill -0 $cmd_pid 2> /dev/null; do
|
||||
echo "# 正在执行..."
|
||||
sleep 1
|
||||
done)| zenity --progress --text="正在执行卸载操作..." --pulsate --auto-close --no-cancel --width 400
|
||||
wait $cmd_pid
|
||||
cmd_status=$?
|
||||
|
||||
if [ "$cmd_status" = "1" ];then
|
||||
zenity --error --width 200 --text "卸载过程出现错误"
|
||||
exit 1
|
||||
else
|
||||
zenity --info --width 200 --text "选定应用已卸载"
|
||||
fi
|
||||
|
||||
|
||||
else
|
||||
zenity --info --text "未选择任何应用"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user