From b826b4c67ca8b7cc374737a30b87cd463dacea47 Mon Sep 17 00:00:00 2001 From: shenmo Date: Fri, 10 Nov 2023 15:51:10 +0800 Subject: [PATCH] unite-ace-host-integration --- .gitignore | 1 + src/DEBIAN/control | 2 +- .../files/bin/bookworm-init | 15 +++----- .../files/build-container.sh | 23 ++++-------- .../ace-host-integration/DEBIAN/control | 8 ++++ .../ace-host-integration/DEBIAN/postinst | 4 ++ .../ace-host-integration/DEBIAN/triggers | 2 + .../ace-host-integration/ace-host-integration | 37 +++++++++++++++++++ 8 files changed, 67 insertions(+), 25 deletions(-) create mode 100644 .gitignore create mode 100755 src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/flamescion-container-tools/ace-host-integration/DEBIAN/control create mode 100755 src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/flamescion-container-tools/ace-host-integration/DEBIAN/postinst create mode 100644 src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/flamescion-container-tools/ace-host-integration/DEBIAN/triggers create mode 100755 src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/flamescion-container-tools/ace-host-integration/opt/ace-host-integration/ace-host-integration diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c00df13 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.deb diff --git a/src/DEBIAN/control b/src/DEBIAN/control index 8c5f1b4..68e75ae 100755 --- a/src/DEBIAN/control +++ b/src/DEBIAN/control @@ -1,5 +1,5 @@ Package: cn.flamescion.bookworm-compatibility-mode -Version: 12.3.1 +Version: 12.3.2 Section: misc Priority: optional Depends: bubblewrap,flatpak diff --git a/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/bookworm-init b/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/bookworm-init index 2317535..0ad65ca 100755 --- a/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/bookworm-init +++ b/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/bookworm-init @@ -60,7 +60,7 @@ 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 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 +180,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 @@ -191,15 +195,8 @@ 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 apt install ./ace-host-integration_${VERSION_GITEE}_all.deb bookworm-run touch /finish.flag bookworm-run apt clean diff --git a/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/build-container.sh b/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/build-container.sh index 26bb4eb..1ee52d7 100755 --- a/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/build-container.sh +++ b/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/build-container.sh @@ -25,23 +25,16 @@ 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 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 + + diff --git a/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/flamescion-container-tools/ace-host-integration/DEBIAN/control b/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/flamescion-container-tools/ace-host-integration/DEBIAN/control new file mode 100755 index 0000000..66914e9 --- /dev/null +++ b/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/flamescion-container-tools/ace-host-integration/DEBIAN/control @@ -0,0 +1,8 @@ +Package: ace-host-integration +Version: 1.1 +Section: misc +Priority: optional +Depends: bash +Maintainer: shenmo +Architecture: all +Description: ace-host-integration diff --git a/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/flamescion-container-tools/ace-host-integration/DEBIAN/postinst b/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/flamescion-container-tools/ace-host-integration/DEBIAN/postinst new file mode 100755 index 0000000..cd35848 --- /dev/null +++ b/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/flamescion-container-tools/ace-host-integration/DEBIAN/postinst @@ -0,0 +1,4 @@ +#!/bin/bash +if [ "${1}" = "triggered" ];then +/opt/ace-host-integration/ace-host-integration +fi diff --git a/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/flamescion-container-tools/ace-host-integration/DEBIAN/triggers b/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/flamescion-container-tools/ace-host-integration/DEBIAN/triggers new file mode 100644 index 0000000..e1d59c1 --- /dev/null +++ b/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/flamescion-container-tools/ace-host-integration/DEBIAN/triggers @@ -0,0 +1,2 @@ +interest-noawait /opt/apps +interest-noawait /usr/share/applications diff --git a/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/flamescion-container-tools/ace-host-integration/opt/ace-host-integration/ace-host-integration b/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/flamescion-container-tools/ace-host-integration/opt/ace-host-integration/ace-host-integration new file mode 100755 index 0000000..a48b196 --- /dev/null +++ b/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/flamescion-container-tools/ace-host-integration/opt/ace-host-integration/ace-host-integration @@ -0,0 +1,37 @@ +#!/bin/bash +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 /opt/apps/*; do + for file in $app_dir/entries/applications/*.desktop;do + do_integrate $file + done +done + + +for file in /usr/share/applications/*.desktop; do +do_integrate $file +done + +