unite-ace-host-integration

This commit is contained in:
2023-11-10 15:51:10 +08:00
parent d7e4071e6f
commit b826b4c67c
8 changed files with 67 additions and 25 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.deb

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,8 @@
Package: ace-host-integration
Version: 1.1
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,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