Compare commits

..

14 Commits
12.3 ... 12.3.4

Author SHA1 Message Date
79679e79dc fix:no-icon-uos 2023-11-12 17:58:18 +08:00
259957fb9e fix: UOS package uninstall 2023-11-12 17:43:31 +08:00
666cbf3cc2 Support-UOS-apps 2023-11-12 16:05:16 +08:00
08a160114a 加入卸载助手 2023-11-12 15:39:59 +08:00
027b521b45 uninstaller 2023-11-12 14:58:55 +08:00
a3e9fa3fc8 微调 2023-11-11 20:12:09 +08:00
756c0ac310 feat: ace-uninstall-helper 2023-11-11 20:09:32 +08:00
6d2036b3fe 去除重复安装 2023-11-10 18:39:48 +08:00
9be0fa4fea 把安装软件过程转移到容器制作 2023-11-10 18:38:20 +08:00
518fa2dbd3 修改: .gitignore 2023-11-10 15:57:36 +08:00
b826b4c67c unite-ace-host-integration 2023-11-10 15:51:10 +08:00
d7e4071e6f unionrepo 2023-11-10 15:07:40 +08:00
c2effa5c30 remove submodule 2023-11-10 15:05:42 +08:00
e85ff8e69a 更新bin-override,改版本号重新发版本 2023-11-10 10:22:35 +08:00
26 changed files with 1369 additions and 40 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*.deb
src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bookworm-env.tar.xz

3
.gitmodules vendored
View File

@@ -1,3 +0,0 @@
[submodule "src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/flamescion-container-tools/bin-override"]
path = src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/flamescion-container-tools/bin-override
url = https://gitee.com/amber-compatability-environment/bin-override.git

View File

@@ -1,8 +1,8 @@
Package: cn.flamescion.bookworm-compatibility-mode
Version: 12.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

@@ -3,4 +3,6 @@ export PACKAGE_NAME="$DPKG_MAINTSCRIPT_PACKAGE"
/opt/apps/$PACKAGE_NAME/files/bin/bookworm-init
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

@@ -3,6 +3,8 @@ PACKAGE_NAME="$DPKG_MAINTSCRIPT_PACKAGE"
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

@@ -0,0 +1,85 @@
#!/bin/bash
if [ "$UID" != "0" ];then
echo "Need to be run as root."
exit 1
fi
# 清除先前的变量值
unset ABSOLUTE_PATH IN_CONTAINER_PATH PKGNAME_GUESS DPKG_LIST_FILE ACE_ENV_PATH
# 定义环境路径变量
ACE_ENV_PATH="/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bookworm-env"
# 检查参数个数
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <desktop-file>"
exit 1
fi
# 保存并验证绝对路径
ABSOLUTE_PATH=$1
if [[ $ABSOLUTE_PATH != "$ACE_ENV_PATH"* ]]; then
echo "Error: Invalid path. Must start with $ACE_ENV_PATH"
exit 1
fi
# 验证是否为desktop文件
if [[ ! $ABSOLUTE_PATH == *.desktop ]]; then
echo "Error: The file is not a desktop file."
exit 1
fi
# 截取路径
IN_CONTAINER_PATH=${ABSOLUTE_PATH#"$ACE_ENV_PATH"}
# 截取并保存包名
PKGNAME_GUESS=$(basename "$ABSOLUTE_PATH" .desktop)
# 检查dpkg列表文件
DPKG_INFO_PATH="$ACE_ENV_PATH/var/lib/dpkg/info"
if [ -f "$DPKG_INFO_PATH/$PKGNAME_GUESS.list" ]; then
DPKG_LIST_FILE="$DPKG_INFO_PATH/$PKGNAME_GUESS.list"
elif ls "$DPKG_INFO_PATH/${PKGNAME_GUESS}:*.list" 1> /dev/null 2>&1; then
DPKG_LIST_FILE=$(ls "$DPKG_INFO_PATH/${PKGNAME_GUESS}:*.list" | head -n 1)
else
echo "No dpkg list file found for $PKGNAME_GUESS.desktop,try to scan to search for the package"
fi
# 验证文件并执行操作
if [ -f "$DPKG_LIST_FILE" ]; then
if grep -q "$IN_CONTAINER_PATH" "$DPKG_LIST_FILE" || grep -q "/opt/apps/$PKGNAME_GUESS/entries/applications/$PKGNAME_GUESS.desktop" "$DPKG_LIST_FILE"; then
bookworm-run apt autopurge $PKGNAME_GUESS -y
ret=$?
if [ "$ret" = "0" ];then
echo "Operation succeeded."
else
echo "Operation failed."
exit $ret
fi
else
echo "Error: Path not found in the dpkg list file."
exit 1
fi
else
# 遍历所有list文件
for file in "$DPKG_INFO_PATH"/*.list; do
if grep -q "$IN_CONTAINER_PATH" "$file"; then
PKGNAME_GUESS=$(basename "$file" .list | cut -d':' -f1)
bookworm-run apt autopurge $PKGNAME_GUESS -y
ret=$?
if [ "$ret" = "0" ];then
echo "Operation succeeded."
exit 0
else
echo "Operation failed."
exit $ret
fi
fi
done
echo "Error: No matching package found."
exit 1
fi

View File

@@ -0,0 +1,71 @@
#!/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
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)
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
break
fi
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

View File

@@ -57,10 +57,11 @@ bwrap --dev-bind $chrootEnvPath/ / \
}
bookworm-run apt update
bookworm-run apt install apt-utils bc curl dialog diffutils findutils gnupg2 less libnss-myhostname libvte-2.9*-common libvte-common lsof ncurses-base passwd pinentry-curses procps sudo time util-linux wget libegl1-mesa libgl1-mesa-glx libvulkan1 mesa-vulkan-drivers locales libglib2.0-bin -y
# Move the package init work to build stage
#bookworm-run apt update
#bookworm-run apt install apt-utils bc curl dialog diffutils findutils gnupg2 less libnss-myhostname libvte-2.9*-common libvte-common lsof ncurses-base passwd pinentry-curses procps sudo time util-linux wget libegl1-mesa libgl1-mesa-glx libvulkan1 mesa-vulkan-drivers locales libglib2.0-bin -y
echo "Update the flamescion container tools"
cp -rv `dirname $chrootEnvPath`/flamescion-container-tools/ $chrootEnvPath
cp -r `dirname $chrootEnvPath`/flamescion-container-tools/ $chrootEnvPath
rm -rf $chrootEnvPath/usr/lib/`gcc -dumpmachine`/dri/dri
# 之前错误的多复制了一个,这里删掉
@@ -180,6 +181,10 @@ printf "%s:" "${container_user_name}" | chpasswd -e
unlink /flamescion-container-tools/bin-override/host-spawn
ln -sfv /flamescion-container-tools/bin-override/host-spawn-`arch` /flamescion-container-tools/bin-override/host-spawn
## install host-integration
apt install --reinstall /flamescion-container-tools/ace-host-integration.deb
EOFFFFFF
#####init
@@ -189,18 +194,6 @@ bookworm-run bash /init.sh
bookworm-run rm /init.sh
bookworm-run cp /host/etc/locale.gen /etc/locale.gen && locale-gen
echo "Installing or Upgrading host integration..."
gitee_api_url="https://gitee.com/api/v5/repos/amber-compatability-environment/ace-host-integration/releases/latest"
resp="$(curl -s $gitee_api_url)"
VERSION_GITEE="$(jq -r '.tag_name' <<<$resp | sed "s/.*V\([^_]*\).*/\1/g")"
echo "$VERSION_GITEE"
bookworm-run wget https://gitee.com/amber-compatability-environment/ace-host-integration/releases/download/${VERSION_GITEE}/ace-host-integration_${VERSION_GITEE}_all.deb
bookworm-run apt install ./ace-host-integration_${VERSION_GITEE}_all.deb
bookworm-run rm ./ace-host-integration_${VERSION_GITEE}_all.deb
bookworm-run touch /finish.flag
bookworm-run apt clean
bookworm-run chown -R $(who | awk '{print $1}' | head -n 1) /usr/lib/locale/

View File

@@ -23,25 +23,18 @@ exit 1
fi
cd "`dirname $0`"
sudo debootstrap --arch=${ARCH} bookworm ./bookworm-env https://mirrors.ustc.edu.cn/debian/
pushd bookworm-env
gitee_api_url="https://gitee.com/api/v5/repos/amber-compatability-environment/ace-host-integration/releases/latest"
resp="$(curl -s $gitee_api_url)"
VERSION_GITEE="$(jq -r '.tag_name' <<<$resp | sed "s/.*V\([^_]*\).*/\1/g")"
echo "$VERSION_GITEE"
sudo wget https://gitee.com/amber-compatability-environment/ace-host-integration/releases/download/${VERSION_GITEE}/ace-host-integration_${VERSION_GITEE}_all.deb
popd
sudo systemd-nspawn -D bookworm-env apt install /ace-host-integration_${VERSION_GITEE}_all.deb -y
sudo rm bookworm-env/ace-host-integration_${VERSION_GITEE}_all.deb
sudo debootstrap --include=apt-utils,bc,curl,dialog,diffutils,findutils,gnupg2,less,libnss-myhostname,libvte-common,lsof,ncurses-base,passwd,pinentry-curses,procps,sudo,time,util-linux,wget,libegl1-mesa,libgl1-mesa-glx,libvulkan1,mesa-vulkan-drivers,locales,libglib2.0-bin --arch=${ARCH} bookworm ./bookworm-env https://mirrors.ustc.edu.cn/debian/
sudo rm -rf bookworm-env/var/cache/apt/archives/*.deb
sudo tar -I 'xz -T0' -cvf bookworm-env.tar.xz bookworm-env/*
sudo rm -rf bookworm-env
pushd flamescion-container-tools/ace-host-integration
dpkg-deb -Z xz -b . ../ace-host-integration.deb
popd

View File

@@ -0,0 +1,8 @@
Package: ace-host-integration
Version: 1.2
Section: misc
Priority: optional
Depends: bash
Maintainer: shenmo <shenmo@spark-app.store>
Architecture: all
Description: ace-host-integration

View File

@@ -0,0 +1,4 @@
#!/bin/bash
if [ "${1}" = "triggered" ];then
/opt/ace-host-integration/ace-host-integration
fi

View File

@@ -0,0 +1,2 @@
interest-noawait /opt/apps
interest-noawait /usr/share/applications

View File

@@ -0,0 +1,66 @@
#!/bin/bash
ACE_dir="/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bookworm-env"
function 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/}"
if [ -L "$targetFile" ] && [ "$(readlink "$targetFile")" = "$sourceFile" ]; then
continue
else
rm -f "$targetFile"
fi
ensureTargetDir "$targetFile"
ln -s "$sourceFile" "$targetFile"
done
}
function do_integrate(){
local file=$1
if [ -f "$file" ]; then
exec_line=$(grep "^Exec=" "$file")
# 检查是否是bookworm-run
if [[ $exec_line != Exec=bookworm-run* ]]; then
echo "$file is detected. Processing host system integration..."
sed -i 's|^Exec=\(.*\)|Exec=bookworm-run \1|' "$file"
sed -i '/^TryExec=/d' "$file"
sed -i '/^Name=/ s/$/ (ACE-Integration)/' "$file"
sed -i "/^Name\[${LANGUAGE}\]=/ s/\$/ (ACE-Integration)/" "$file"
icon_line=$(grep "^Icon=" "$file")
if [[ "$icon_line" == "Icon=/"* ]]; then
# 如果Icon=后面接的是/,则添加前缀
sed -i 's|^Icon=/|Icon=/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bookworm-env/|' "$file"
fi
fi
fi
}
for app_dir in $(ls /opt/apps/); do
for file in /opt/apps/$app_dir/entries/applications/*.desktop;do
do_integrate $file
DESKTOP_FILE_NAME=$(basename $file)
ln -sf "../../../opt/apps/$app_dir/entries/applications/$DESKTOP_FILE_NAME" "/usr/share/applications/"
linkDir "../../../opt/apps/$app_dir/entries/icons" "/usr/share/icons/"
done
done
for file in /usr/share/applications/*.desktop; do
do_integrate $file
done
find "/usr/share/applications/" -xtype l -delete

View File

@@ -0,0 +1,3 @@
#!/bin/bash
### We do not want users to install ACE in ACE. Run inside this container instead
${@}

View File

@@ -0,0 +1,6 @@
#!/bin/bash
if [ "$1" = "open" ];then
xdg-open ${@:2}
else
/usr/bin/gio $@
fi

View File

@@ -0,0 +1,6 @@
#!/bin/bash
if [ "$UID" = "0" ];then
pkexec $@
else
host-spawn pkexec bookworm-run $@
fi

View File

@@ -0,0 +1,6 @@
#!/bin/bash
if [ "$UID" = "0" ];then
/usr/bin/sudo $@
else
host-spawn sudo bookworm-run $@
fi