Compare commits
66 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e9c9f488f5 | |||
| 02a70eb0e7 | |||
| 8d5a07277a | |||
| 12a2c435be | |||
| 798554ab22 | |||
| a284695f80 | |||
| fe19bf6efc | |||
| 4c19bf865a | |||
| af5594cdcb | |||
| 130ff44a29 | |||
| dba6361d29 | |||
| b5f45bbecf | |||
| f3be1f48f6 | |||
| af04000b02 | |||
| a9988f37f3 | |||
| 130839b368 | |||
| 574da47849 | |||
| 081203e0d4 | |||
| 57e9b966e0 | |||
| 667b83e52b | |||
| d2cf07bd01 | |||
| 5e74ed9b91 | |||
|
|
65dfa5291c | ||
|
|
2ad0ea3f42 | ||
|
|
aedcb5c1ed | ||
| 7f33d2fff7 | |||
| b93199bb05 | |||
| 6b0942d2d5 | |||
| de2d84e13a | |||
| 8fca595000 | |||
| ceb863717f | |||
| f489876185 | |||
| 1e47004eef | |||
|
|
4afbfab976 | ||
| 866a866d5b | |||
| 2bdfe5c177 | |||
| 6b27103c18 | |||
| 00c2772152 | |||
| a8463e9152 | |||
| 0f293864b6 | |||
| 6c853b2bec | |||
| 8ce2c31380 | |||
|
|
f57e80c61a | ||
|
|
8140e49602 | ||
| bc1d029e64 | |||
| 4d51bd9dc4 | |||
| 5e41a8f9e7 | |||
| 2949a3df3f | |||
| c1030dd35b | |||
| 8d95934a7d | |||
| 0f4ae31462 | |||
| c04007eccd | |||
| 98575a442c | |||
| ddabb804d0 | |||
| caadd5d785 | |||
| f89f92533f | |||
| a1593ea635 | |||
| d06eaed9e3 | |||
| 00a12285d9 | |||
|
|
c26bf5aa06 | ||
|
|
fb8752e0ba | ||
| e2769c15d2 | |||
|
|
1e88351964 | ||
| 6322718144 | |||
| 60ef6a9893 | |||
| 722efa9726 |
44
README.md
@@ -1,21 +1,10 @@
|
|||||||
# 书虫兼容模式
|
|
||||||
书虫兼容模式,是`琥珀兼容环境(ACE)`的一部分
|
|
||||||
|
|
||||||
琥珀兼容环境是一款基于bubblewrap的容器化应用打包和分发方案。
|
|
||||||
|
|
||||||
书虫兼容模式用极为轻量的容器方案让你可以在几乎任何的Linux发行版上运行一个`Debian 12`容器。在`Appimage`应用无法启动或者打包的时候,使用书虫兼容模式来打包可以让你在使用最新的环境的同时在更多的发行版上运行,是一个很好的选择
|
|
||||||
|
|
||||||
书虫兼容模式让你可以在deepin或UOS上使用Debian 12的应用,为你带来更好的使用体验!
|
|
||||||
|
|
||||||
请使用 `git clone --recurse-submodules` 来获取
|
|
||||||
|
|
||||||
## 构建指南
|
|
||||||
|
|
||||||
先构建容器再打包,容器位置在`src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files`
|
|
||||||
|
|
||||||
|
|
||||||
# Bookworm compatibility mode
|
# Bookworm compatibility mode
|
||||||
|
|
||||||
|
# [中文](README.zh.md)
|
||||||
|
|
||||||
Bookworm compatibility mode is a part of `Amber Compatability Environment(ACE)`
|
Bookworm compatibility mode is a part of `Amber Compatability Environment(ACE)`
|
||||||
|
|
||||||
Amber Compatability Environment is a container app packaging and distributing solution.
|
Amber Compatability Environment is a container app packaging and distributing solution.
|
||||||
@@ -26,6 +15,35 @@ Bookworm compatibility mode allows you to use Debian 12 applications on deepin o
|
|||||||
|
|
||||||
Please use `git clone --recurse-submodules` to obtain the env
|
Please use `git clone --recurse-submodules` to obtain the env
|
||||||
|
|
||||||
|
|
||||||
|
## Install Guide
|
||||||
|
|
||||||
|
|
||||||
|
### Quick Install (Debian)
|
||||||
|
|
||||||
|
https://bbs.spark-app.store/d/1668-xing-huo-ying-yong-shang-dian-on-ace
|
||||||
|
|
||||||
|
### Manual Install(Debian/Fedora/Arch)
|
||||||
|
|
||||||
|
https://share.shenmo.tech:23333/index.php?share/folder&user=1&sid=kr8z6Fqf
|
||||||
|
|
||||||
## Build Guide
|
## Build Guide
|
||||||
|
|
||||||
|
### Debian
|
||||||
|
|
||||||
Build the container first then build the package. Container at `src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files`
|
Build the container first then build the package. Container at `src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files`
|
||||||
|
Here are the details:
|
||||||
|
1. Install dependencies: sudo apt-get install arch-test debootstrap libnss-mymachines systemd-container
|
||||||
|
2. Enter the terminal at `src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files` and execute `./build-container.sh amd64`.[for amd,other arch please change]
|
||||||
|
3. Wait for the container to complete.
|
||||||
|
4.Get in to `bookworm-compatibility-mode` dir,run`fakeroot dpkg-deb -b src .`
|
||||||
|
5.Wating for complete.
|
||||||
|
|
||||||
|
|
||||||
|
### Fedora
|
||||||
|
|
||||||
|
See https://gitee.com/amber-compatability-environment/ace-rpm
|
||||||
|
|
||||||
|
### Arch
|
||||||
|
|
||||||
|
`yay -S cn.flamescion.bookworm-compatibility-mode`
|
||||||
|
|||||||
46
README.zh.md
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
# 书虫兼容模式
|
||||||
|
|
||||||
|
# [English](README.md)
|
||||||
|
|
||||||
|
|
||||||
|
琥珀兼容环境是一款基于bubblewrap的容器化应用打包和分发方案。
|
||||||
|
|
||||||
|
书虫兼容模式用极为轻量的容器方案让你可以在几乎任何的Linux发行版上运行一个`Debian 12`容器。在`Appimage`应用无法启动或者打包的时候,使用书虫兼容模式来打包可以让你在使用最新的环境的同时在更多的发行版上运行,是一个很好的选择
|
||||||
|
|
||||||
|
书虫兼容模式让你可以在deepin或UOS上使用Debian 12的应用,为你带来更好的使用体验!
|
||||||
|
|
||||||
|
请使用 `git clone --recurse-submodules` 来获取
|
||||||
|
|
||||||
|
## 安装指南
|
||||||
|
|
||||||
|
### 快捷安装 (Debian)
|
||||||
|
|
||||||
|
https://bbs.spark-app.store/d/1668-xing-huo-ying-yong-shang-dian-on-ace
|
||||||
|
|
||||||
|
### 手动安装(Debian/Fedora/Arch)
|
||||||
|
|
||||||
|
https://share.shenmo.tech:23333/index.php?share/folder&user=1&sid=kr8z6Fqf
|
||||||
|
|
||||||
|
## 构建指南
|
||||||
|
|
||||||
|
### Debian
|
||||||
|
|
||||||
|
先构建容器再打包,容器位置在`src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files`
|
||||||
|
|
||||||
|
下面是详细步骤:
|
||||||
|
|
||||||
|
1. 安装依赖:sudo apt-get install arch-test debootstrap libnss-mymachines systemd-container
|
||||||
|
2. 在`src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files`位置进入终端,执行`./build-container.sh amd64`[amd架构,其他架构同理]`
|
||||||
|
3. 等待容器打包完成
|
||||||
|
4. 进入`bookworm-compatibility-mode`目录,执行`fakeroot dpkg-deb -b src .`
|
||||||
|
5. 等待打包完成
|
||||||
|
|
||||||
|
### Fedora
|
||||||
|
|
||||||
|
请前往 https://gitee.com/amber-compatability-environment/ace-rpm
|
||||||
|
|
||||||
|
### Arch
|
||||||
|
|
||||||
|
`yay -S cn.flamescion.bookworm-compatibility-mode`
|
||||||
|
|
||||||
|
---
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
Package: cn.flamescion.bookworm-compatibility-mode
|
Package: cn.flamescion.bookworm-compatibility-mode
|
||||||
Version: 12.3.4
|
Version: 12.4.9
|
||||||
Section: misc
|
Section: misc
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Depends: bubblewrap,flatpak,zenity
|
Depends: bubblewrap,flatpak,zenity,policykit-1,gcc,systemd
|
||||||
Maintainer: shenmo <shenmo@spark-app.store>
|
Maintainer: shenmo <shenmo@spark-app.store>
|
||||||
Architecture: arm64
|
Architecture: amd64
|
||||||
Description: bwrap wrapper for install and running debs inside a bookworm container
|
Description: bwrap wrapper for install and running debs inside a bookworm container
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export PACKAGE_NAME="$DPKG_MAINTSCRIPT_PACKAGE"
|
export PACKAGE_NAME="$DPKG_MAINTSCRIPT_PACKAGE"
|
||||||
/opt/apps/$PACKAGE_NAME/files/bin/bookworm-init
|
/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
|
if [ "${PACKAGE_NAME}" = "cn.flamescion.bookworm-compatibility-mode" ];then
|
||||||
ln -sf /opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/ace-uninstall-helper /usr/bin/ace-uninstall-helper
|
systemctl daemon-reload
|
||||||
ln -sf /opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/ace-uninstall-helper-gui /usr/bin/ace-uninstall-helper-gui
|
systemctl enable ace-auto-upgrade
|
||||||
|
systemctl start ace-auto-upgrade
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
PACKAGE_NAME="$DPKG_MAINTSCRIPT_PACKAGE"
|
PACKAGE_NAME="$DPKG_MAINTSCRIPT_PACKAGE"
|
||||||
if [ "$1" = "remove" ] || [ "$1" = "purge" ];then
|
|
||||||
if [ "$PACKAGE_NAME" = "cn.flamescion.bookworm-compatibility-mode" ];then
|
if [ "${PACKAGE_NAME}" = "cn.flamescion.bookworm-compatibility-mode" ];then
|
||||||
unlink /usr/bin/bookworm-run
|
systemctl stop ace-auto-upgrade
|
||||||
unlink /usr/bin/ace-uninstall-helper
|
systemctl disable ace-auto-upgrade
|
||||||
unlink /usr/bin/ace-uninstall-helper-gui
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$1" = "remove" ] || [ "$1" = "purge" ];then
|
||||||
|
|
||||||
echo "清理卸载残留"
|
echo "清理卸载残留"
|
||||||
|
|
||||||
rm -rf /opt/apps/$PACKAGE_NAME
|
rm -rf /opt/apps/$PACKAGE_NAME
|
||||||
@@ -13,3 +17,5 @@ else
|
|||||||
echo "非卸载,跳过清理"
|
echo "非卸载,跳过清理"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
17
src/etc/X11/Xsession.d/20ACE-Bookworm
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Ensure base distro defaults xdg path are set if nothing filed up some
|
||||||
|
# defaults yet.
|
||||||
|
if [ -z "$XDG_DATA_DIRS" ]; then
|
||||||
|
export XDG_DATA_DIRS="/usr/local/share:/usr/share"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Desktop files (used by desktop environments within both X11 and Wayland) are
|
||||||
|
# looked for in XDG_DATA_DIRS; make sure it includes the relevant directory for ACE
|
||||||
|
ACE_path="/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bookworm-env/usr/share/"
|
||||||
|
if [ -n "${XDG_DATA_DIRS##*${ACE_path}}" ] && [ -n "${XDG_DATA_DIRS##*${ACE_path}:*}" ]; then
|
||||||
|
export XDG_DATA_DIRS="${ACE_path}:${XDG_DATA_DIRS}"
|
||||||
|
fi
|
||||||
|
|
||||||
16
src/etc/profile.d/ACE-Bookworm.sh
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Ensure base distro defaults xdg path are set if nothing filed up some
|
||||||
|
# defaults yet.
|
||||||
|
if [ -z "$XDG_DATA_DIRS" ]; then
|
||||||
|
export XDG_DATA_DIRS="/usr/local/share:/usr/share"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Desktop files (used by desktop environments within both X11 and Wayland) are
|
||||||
|
# looked for in XDG_DATA_DIRS; make sure it includes the relevant directory for ACE
|
||||||
|
ACE_path="/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bookworm-env/usr/share/"
|
||||||
|
if [ -n "${XDG_DATA_DIRS##*${ACE_path}}" ] && [ -n "${XDG_DATA_DIRS##*${ACE_path}:*}" ]; then
|
||||||
|
export XDG_DATA_DIRS="${ACE_path}:${XDG_DATA_DIRS}"
|
||||||
|
fi
|
||||||
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
export XDG_DATA_DIRS
|
|
||||||
APP_ROOT="/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bookworm-env/usr/share"
|
|
||||||
XDG_DATA_DIRS="${APP_ROOT}:/usr/local/share:/usr/share"
|
|
||||||
export APP_ROOT
|
|
||||||
@@ -42,7 +42,7 @@ if [ -f "$DPKG_INFO_PATH/$PKGNAME_GUESS.list" ]; then
|
|||||||
elif ls "$DPKG_INFO_PATH/${PKGNAME_GUESS}:*.list" 1> /dev/null 2>&1; then
|
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)
|
DPKG_LIST_FILE=$(ls "$DPKG_INFO_PATH/${PKGNAME_GUESS}:*.list" | head -n 1)
|
||||||
else
|
else
|
||||||
echo "No dpkg list file found for $PKGNAME_GUESS.desktop,try to scan to search for the package"
|
echo "Warn:No dpkg list file found for $PKGNAME_GUESS.desktop,try to scan to search for the package"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 验证文件并执行操作
|
# 验证文件并执行操作
|
||||||
@@ -53,20 +53,21 @@ if [ -f "$DPKG_LIST_FILE" ]; then
|
|||||||
ret=$?
|
ret=$?
|
||||||
if [ "$ret" = "0" ];then
|
if [ "$ret" = "0" ];then
|
||||||
echo "Operation succeeded."
|
echo "Operation succeeded."
|
||||||
|
exit
|
||||||
else
|
else
|
||||||
echo "Operation failed."
|
echo "Operation failed."
|
||||||
exit $ret
|
exit $ret
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "Error: Path not found in the dpkg list file."
|
echo "Warn: Path not found in the dpkg list file,try to scan to search for the package"
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
else
|
fi
|
||||||
# 遍历所有list文件
|
# 遍历所有list文件 As fallback
|
||||||
for file in "$DPKG_INFO_PATH"/*.list; do
|
for file in "$DPKG_INFO_PATH"/*.list; do
|
||||||
if grep -q "$IN_CONTAINER_PATH" "$file"; then
|
if grep -q "$IN_CONTAINER_PATH" "$file"; then
|
||||||
PKGNAME_GUESS=$(basename "$file" .list | cut -d':' -f1)
|
PKGNAME_GUESS=$(basename "$file" .list | cut -d':' -f1)
|
||||||
|
echo "Get pkgname $PKGNAME_GUESS, uninstalling..."
|
||||||
bookworm-run apt autopurge $PKGNAME_GUESS -y
|
bookworm-run apt autopurge $PKGNAME_GUESS -y
|
||||||
ret=$?
|
ret=$?
|
||||||
if [ "$ret" = "0" ];then
|
if [ "$ret" = "0" ];then
|
||||||
@@ -81,5 +82,5 @@ else
|
|||||||
done
|
done
|
||||||
echo "Error: No matching package found."
|
echo "Error: No matching package found."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
if [ "$UID" != "0" ];then
|
if [ "$UID" != "0" ];then
|
||||||
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY $0
|
pkexec $0
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
# 定义应用列表文件路径
|
# 定义应用列表文件路径
|
||||||
@@ -23,7 +23,13 @@ for file in "$ACE_dir"/usr/share/applications/*.desktop; do
|
|||||||
else
|
else
|
||||||
name=$name_i18n
|
name=$name_i18n
|
||||||
fi
|
fi
|
||||||
comment=$(grep -m 1 '^Comment=' "$file" | cut -d '=' -f 2)
|
comment_orig=$(grep -m 1 '^Comment=' "$file" | cut -d '=' -f 2)
|
||||||
|
comment_i18n=$(grep -m 1 "^Comment\[${LANGUAGE}\]\=" "$file" | cut -d '=' -f 2)
|
||||||
|
if [ -z "$comment_i18n" ] ;then
|
||||||
|
comment=$comment_orig
|
||||||
|
else
|
||||||
|
comment=$comment_i18n
|
||||||
|
fi
|
||||||
# 如果没有简介,则显示"N/A"
|
# 如果没有简介,则显示"N/A"
|
||||||
[[ -z "$comment" ]] && comment="N/A"
|
[[ -z "$comment" ]] && comment="N/A"
|
||||||
# 添加到应用列表数组
|
# 添加到应用列表数组
|
||||||
|
|||||||
@@ -36,9 +36,10 @@ bwrap --dev-bind $chrootEnvPath/ / \
|
|||||||
--setenv LC_ALL "$LC_ALL" \
|
--setenv LC_ALL "$LC_ALL" \
|
||||||
--setenv PULSE_SERVER /run/user/$uid/pulse/native \
|
--setenv PULSE_SERVER /run/user/$uid/pulse/native \
|
||||||
--setenv PATH /flamescion-container-tools/bin-override:$PATH \
|
--setenv PATH /flamescion-container-tools/bin-override:$PATH \
|
||||||
|
--setenv IS_ACE_ENV "1" \
|
||||||
--dev-bind $chrootEnvPath/ / \
|
--dev-bind $chrootEnvPath/ / \
|
||||||
--dev-bind /media /media \
|
--dev-bind-try /media /media \
|
||||||
--dev-bind /tmp /tmp \
|
--dev-bind-try /tmp /tmp \
|
||||||
--dev /dev \
|
--dev /dev \
|
||||||
--dev-bind-try /dev/dri /dev/dri \
|
--dev-bind-try /dev/dri /dev/dri \
|
||||||
--proc /proc \
|
--proc /proc \
|
||||||
@@ -49,10 +50,10 @@ bwrap --dev-bind $chrootEnvPath/ / \
|
|||||||
--bind-try /usr/share/themes /usr/local/share/themes \
|
--bind-try /usr/share/themes /usr/local/share/themes \
|
||||||
--bind-try /usr/share/icons /usr/local/share/icons \
|
--bind-try /usr/share/icons /usr/local/share/icons \
|
||||||
--bind-try /usr/share/fonts /usr/local/share/fonts \
|
--bind-try /usr/share/fonts /usr/local/share/fonts \
|
||||||
--hostname bookworm-compatibility-mode \
|
--hostname Amber-CE-Bookworm \
|
||||||
--unshare-uts \
|
--unshare-uts \
|
||||||
--dev-bind /etc/resolv.conf /etc/resolv.conf \
|
--dev-bind-try /etc/resolv.conf /etc/resolv.conf \
|
||||||
--dev-bind /home /home \
|
--dev-bind-try /home /home \
|
||||||
$@
|
$@
|
||||||
|
|
||||||
|
|
||||||
@@ -177,14 +178,138 @@ printf "%s:%s" "${container_user_name}" "${temporary_password}" | chpasswd -e
|
|||||||
printf "%s:" "root" | chpasswd -e
|
printf "%s:" "root" | chpasswd -e
|
||||||
printf "%s:" "${container_user_name}" | chpasswd -e
|
printf "%s:" "${container_user_name}" | chpasswd -e
|
||||||
|
|
||||||
|
mkdir -p /usr/share/fonts
|
||||||
|
mkdir -p /usr/share/icons
|
||||||
|
mkdir -p /usr/share/themes
|
||||||
|
|
||||||
## init host-spawn
|
## init host-spawn
|
||||||
unlink /flamescion-container-tools/bin-override/host-spawn
|
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
|
ln -sfv /flamescion-container-tools/bin-override/host-spawn-$(uname -m) /flamescion-container-tools/bin-override/host-spawn
|
||||||
|
|
||||||
## install host-integration
|
## install host-integration
|
||||||
|
|
||||||
apt install --reinstall /flamescion-container-tools/ace-host-integration.deb
|
apt install --reinstall /flamescion-container-tools/ace-host-integration.deb
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Do NVIDIA Integration
|
||||||
|
|
||||||
|
echo "ACE: NVIDIA Integration"
|
||||||
|
|
||||||
|
ensureTargetDir() {
|
||||||
|
targetFile=$1
|
||||||
|
t=$(dirname "$targetFile")
|
||||||
|
mkdir -p "$t"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
lib32_dir="/usr/lib/"
|
||||||
|
lib64_dir="/usr/lib/"
|
||||||
|
if [ -e "/usr/lib/x86_64-linux-gnu" ]; then
|
||||||
|
lib64_dir="/usr/lib/x86_64-linux-gnu/"
|
||||||
|
elif [ -e "/usr/lib64" ]; then
|
||||||
|
lib64_dir="/usr/lib64/"
|
||||||
|
fi
|
||||||
|
if [ -e "/usr/lib/i386-linux-gnu" ]; then
|
||||||
|
lib32_dir="/usr/lib/i386-linux-gnu/"
|
||||||
|
elif [ -e "/usr/lib32" ]; then
|
||||||
|
lib32_dir="/usr/lib32/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# First we find all non-lib files we need, this includes
|
||||||
|
# - binaries
|
||||||
|
# - confs
|
||||||
|
# - egl files
|
||||||
|
# - icd files
|
||||||
|
# Excluding here the libs, we will threat them later specifically
|
||||||
|
NVIDIA_FILES="$(find /host/etc/ /host/usr/ \
|
||||||
|
-path "/host/usr/lib/i386-linux-gnu/*" -prune -o \
|
||||||
|
-path "/host/usr/lib/x86_64-linux-gnu/*" -prune -o \
|
||||||
|
-path "/host/usr/lib32/*" -prune -o \
|
||||||
|
-path "/host/usr/lib64/*" -prune -o \
|
||||||
|
-iname "*nvidia*" -not -type d -print 2> /dev/null || :)"
|
||||||
|
for nvidia_file in ${NVIDIA_FILES}; do
|
||||||
|
dest_file="$(printf "%s" "${nvidia_file}" | sed 's|/host||g')"
|
||||||
|
ensureTargetDir ${dest_file}
|
||||||
|
cp -r "${nvidia_file}" "${dest_file}"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Then we find all directories with nvidia in the name and just mount them
|
||||||
|
NVIDIA_DIRS="$(find /host/etc /host/usr -iname "*nvidia*" -type d 2> /dev/null || :)"
|
||||||
|
for nvidia_dir in ${NVIDIA_DIRS}; do
|
||||||
|
# /usr/lib64 is common in Arch or RPM based distros, while /usr/lib/x86_64-linux-gnu is
|
||||||
|
# common on Debian derivatives, so we need to adapt between the two nomenclatures.
|
||||||
|
if printf "%s" "${nvidia_dir}" | grep -Eq "lib32|lib64|x86_64-linux-gnu|i386-linux-gnu"; then
|
||||||
|
|
||||||
|
# Remove origin so we plug our own
|
||||||
|
dest_dir="$(printf "%s" "${nvidia_dir}" |
|
||||||
|
sed "s|/host/usr/lib/x86_64-linux-gnu/|${lib64_dir}|g" |
|
||||||
|
sed "s|/host/usr/lib/i386-linux-gnu/|${lib32_dir}|g" |
|
||||||
|
sed "s|/host/usr/lib64/|${lib64_dir}|g" |
|
||||||
|
sed "s|/host/usr/lib32/|${lib32_dir}|g")"
|
||||||
|
else
|
||||||
|
dest_dir="$(printf "%s" "${nvidia_dir}" | sed 's|/host||g')"
|
||||||
|
fi
|
||||||
|
ensureTargetDir ${dest_file}
|
||||||
|
cp -r "${nvidia_dir}" "${dest_file}"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Then we find all the ".so" libraries, there are searched separately
|
||||||
|
# because we need to extract the relative path to mount them in the
|
||||||
|
# correct path based on the guest's setup
|
||||||
|
#
|
||||||
|
# /usr/lib64 is common in Arch or RPM based distros, while /usr/lib/x86_64-linux-gnu is
|
||||||
|
# common on Debian derivatives, so we need to adapt between the two nomenclatures.
|
||||||
|
NVIDIA_LIBS="$(find \
|
||||||
|
/host/usr/lib/i386-linux-gnu/ \
|
||||||
|
/host/usr/lib/x86_64-linux-gnu/ \
|
||||||
|
/host/usr/lib32/ \
|
||||||
|
/host/usr/lib64/ \
|
||||||
|
-iname "*nvidia*.so*" \
|
||||||
|
-o -iname "libcuda*.so*" \
|
||||||
|
-o -iname "libnvcuvid*.so*" \
|
||||||
|
-o -iname "libnvoptix*.so*" 2> /dev/null || :)"
|
||||||
|
for nvidia_lib in ${NVIDIA_LIBS}; do
|
||||||
|
dest_file="$(printf "%s" "${nvidia_lib}" |
|
||||||
|
sed "s|/host/usr/lib/x86_64-linux-gnu/|${lib64_dir}|g" |
|
||||||
|
sed "s|/host/usr/lib/i386-linux-gnu/|${lib32_dir}|g" |
|
||||||
|
sed "s|/host/usr/lib64/|${lib64_dir}|g" |
|
||||||
|
sed "s|/host/usr/lib32/|${lib32_dir}|g")"
|
||||||
|
|
||||||
|
# If file exists, just continue
|
||||||
|
# this may happen for directories like /usr/lib/nvidia/xorg/foo.so
|
||||||
|
# where the directory is already bind mounted (ro) and we don't need
|
||||||
|
# to mount further files in it.
|
||||||
|
if [ -e "${dest_file}" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
type="file"
|
||||||
|
if [ -L "${nvidia_lib}" ]; then
|
||||||
|
type="link"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${type}" = "link" ]; then
|
||||||
|
mkdir -p "$(dirname "${dest_file}")"
|
||||||
|
cp -d "${nvidia_lib}" "${dest_file}"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
ensureTargetDir ${dest_file}
|
||||||
|
cp -r "${nvidia_lib}" "${dest_file}"
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
# Refresh ldconfig cache, also detect if there are empty files remaining
|
||||||
|
# and clean them.
|
||||||
|
# This could happen when upgrading drivers and changing versions.
|
||||||
|
empty_libs="$(ldconfig 2>&1 | grep -Eo "File.*is empty" | cut -d' ' -f2)"
|
||||||
|
if [ -n "${empty_libs}" ]; then
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
find ${empty_libs} -delete 2> /dev/null || :
|
||||||
|
find /usr/ /etc/ -empty -iname "*nvidia*" -delete 2> /dev/null || :
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
EOFFFFFF
|
EOFFFFFF
|
||||||
|
|
||||||
#####init
|
#####init
|
||||||
@@ -208,9 +333,10 @@ sudo -u $(who | awk '{print $1}' | head -n 1) bwrap --dev-bind $chrootEnvPath/ /
|
|||||||
--setenv LC_ALL "$LC_ALL" \
|
--setenv LC_ALL "$LC_ALL" \
|
||||||
--setenv PULSE_SERVER /run/user/$uid/pulse/native \
|
--setenv PULSE_SERVER /run/user/$uid/pulse/native \
|
||||||
--setenv PATH /flamescion-container-tools/bin-override:$PATH \
|
--setenv PATH /flamescion-container-tools/bin-override:$PATH \
|
||||||
|
--setenv IS_ACE_ENV "1" \
|
||||||
--dev-bind $chrootEnvPath/ / \
|
--dev-bind $chrootEnvPath/ / \
|
||||||
--dev-bind /media /media \
|
--dev-bind-try /media /media \
|
||||||
--dev-bind /tmp /tmp \
|
--dev-bind-try /tmp /tmp \
|
||||||
--dev /dev \
|
--dev /dev \
|
||||||
--dev-bind-try /dev/dri /dev/dri \
|
--dev-bind-try /dev/dri /dev/dri \
|
||||||
--proc /proc \
|
--proc /proc \
|
||||||
@@ -218,13 +344,13 @@ sudo -u $(who | awk '{print $1}' | head -n 1) bwrap --dev-bind $chrootEnvPath/ /
|
|||||||
--dev-bind /run /run \
|
--dev-bind /run /run \
|
||||||
--dev-bind-try /run/user/$uid/pulse /run/user/$uid/pulse \
|
--dev-bind-try /run/user/$uid/pulse /run/user/$uid/pulse \
|
||||||
--dev-bind / /host \
|
--dev-bind / /host \
|
||||||
--ro-bind /usr/share/themes /usr/local/share/themes \
|
--bind-try /usr/share/themes /usr/local/share/themes \
|
||||||
--ro-bind /usr/share/icons /usr/local/share/icons \
|
--bind-try /usr/share/icons /usr/local/share/icons \
|
||||||
--ro-bind /usr/share/fonts /usr/local/share/fonts \
|
--bind-try /usr/share/fonts /usr/local/share/fonts \
|
||||||
--hostname bookworm-compatibility-mode \
|
--hostname Amber-CE-Bookworm \
|
||||||
--unshare-uts \
|
--unshare-uts \
|
||||||
--dev-bind /etc/resolv.conf /etc/resolv.conf \
|
--dev-bind-try /etc/resolv.conf /etc/resolv.conf \
|
||||||
--dev-bind /home /home \
|
--dev-bind-try /home /home \
|
||||||
locale-gen
|
locale-gen
|
||||||
|
|
||||||
chown -R root $chrootEnvPath
|
chown -R root $chrootEnvPath
|
||||||
|
|||||||
@@ -54,24 +54,25 @@ bwrap --dev-bind / / \
|
|||||||
--setenv LC_ALL "$LC_ALL" \
|
--setenv LC_ALL "$LC_ALL" \
|
||||||
--setenv PULSE_SERVER /run/user/$uid/pulse/native \
|
--setenv PULSE_SERVER /run/user/$uid/pulse/native \
|
||||||
--setenv PATH /flamescion-container-tools/bin-override:$PATH \
|
--setenv PATH /flamescion-container-tools/bin-override:$PATH \
|
||||||
|
--setenv IS_ACE_ENV "1" \
|
||||||
--dev-bind $chrootEnvPath/ / \
|
--dev-bind $chrootEnvPath/ / \
|
||||||
--dev-bind /media /media \
|
--dev-bind-try /media /media \
|
||||||
--dev-bind /tmp /tmp \
|
--dev-bind-try /tmp /tmp \
|
||||||
--dev /dev \
|
--dev /dev \
|
||||||
--dev-bind /dev/dri /dev/dri \
|
--dev-bind-try /dev/dri /dev/dri \
|
||||||
--proc /proc \
|
--proc /proc \
|
||||||
--dev-bind /sys /sys \
|
--dev-bind /sys /sys \
|
||||||
--dev-bind /run /run \
|
--dev-bind /run /run \
|
||||||
--dev-bind-try /run/user/$uid/pulse /run/user/$uid/pulse \
|
--dev-bind-try /run/user/$uid/pulse /run/user/$uid/pulse \
|
||||||
--dev-bind / /host \
|
--dev-bind / /host \
|
||||||
--ro-bind /usr/share/themes /usr/local/share/themes \
|
--ro-bind-try /usr/share/themes /usr/local/share/themes \
|
||||||
--ro-bind /usr/share/icons /usr/share/icons \
|
--ro-bind-try /usr/share/icons /usr/local/share/icons \
|
||||||
--ro-bind /usr/share/fonts /usr/local/share/fonts \
|
--ro-bind-try /usr/share/fonts /usr/local/share/fonts \
|
||||||
--hostname bookworm-compatibility-mode \
|
--hostname Amber-CE-Bookworm \
|
||||||
--unshare-uts \
|
--unshare-uts \
|
||||||
--dev-bind /etc/resolv.conf /etc/resolv.conf \
|
--dev-bind-try /etc/resolv.conf /etc/resolv.conf \
|
||||||
--cap-add CAP_SYS_ADMIN \
|
--cap-add CAP_SYS_ADMIN \
|
||||||
--dev-bind /home /home \
|
--dev-bind-try /home /home \
|
||||||
bash -c "${container_command}"
|
bash -c "${container_command}"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
curdir=`realpath $0`
|
||||||
|
parent_dir=`dirname $curdir`
|
||||||
|
pparent_dir=`dirname $parent_dir`
|
||||||
|
ppparent_dir=`dirname $pparent_dir`
|
||||||
|
PKGNAME=`basename $ppparent_dir`
|
||||||
|
export PACKAGE_NAME=$PKGNAME
|
||||||
|
chrootEnvPath=/opt/apps/$PKGNAME/files/bookworm-env
|
||||||
|
|
||||||
|
|
||||||
|
if [ ! -e $chrootEnvPath/finish.flag ];then
|
||||||
|
|
||||||
|
if [ "$(id -u)" = "0" ]; then
|
||||||
|
`dirname $chrootEnvPath`/bin/bookworm-init
|
||||||
|
else
|
||||||
|
pkexec `dirname $chrootEnvPath`/bin/bookworm-init
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
non_root_user=$(who | awk '{print $1}' | head -n 1)
|
||||||
|
uid=$(id -u $non_root_user)
|
||||||
|
|
||||||
|
|
||||||
|
bwrap --dev-bind / / \
|
||||||
|
bwrap \
|
||||||
|
--setenv LANG "$LANG" \
|
||||||
|
--setenv LC_COLLATE "$LC_COLLATE" \
|
||||||
|
--setenv LC_CTYPE "$LC_CTYPE" \
|
||||||
|
--setenv LC_MONETARY "$LC_MONETARY" \
|
||||||
|
--setenv LC_MESSAGES "$LC_MESSAGES" \
|
||||||
|
--setenv LC_NUMERIC "$LC_NUMERIC" \
|
||||||
|
--setenv LC_TIME "$LC_TIME" \
|
||||||
|
--setenv LC_ALL "$LC_ALL" \
|
||||||
|
--setenv PULSE_SERVER /run/user/$uid/pulse/native \
|
||||||
|
--setenv PATH /flamescion-container-tools/bin-override:$PATH \
|
||||||
|
--setenv IS_ACE_ENV "1" \
|
||||||
|
--dev-bind $chrootEnvPath/ / \
|
||||||
|
--dev-bind-try /media /media \
|
||||||
|
--dev-bind-try /tmp /tmp \
|
||||||
|
--dev /dev \
|
||||||
|
--dev-bind-try /dev/dri /dev/dri \
|
||||||
|
--proc /proc \
|
||||||
|
--dev-bind /sys /sys \
|
||||||
|
--dev-bind /run /run \
|
||||||
|
--dev-bind-try /run/user/$uid/pulse /run/user/$uid/pulse \
|
||||||
|
--dev-bind / /host \
|
||||||
|
--ro-bind-try /usr/share/themes /usr/local/share/themes \
|
||||||
|
--ro-bind-try /usr/share/icons /usr/local/share/icons \
|
||||||
|
--ro-bind-try /usr/share/fonts /usr/local/share/fonts \
|
||||||
|
--hostname Amber-CE-Bookworm \
|
||||||
|
--unshare-uts \
|
||||||
|
--dev-bind-try /etc/resolv.conf /etc/resolv.conf \
|
||||||
|
--dev-bind-try /home /home \
|
||||||
|
/usr/bin/bwrap "$@"
|
||||||
|
|
||||||
|
|
||||||
@@ -53,24 +53,25 @@ bwrap --dev-bind / / \
|
|||||||
--setenv LC_ALL "$LC_ALL" \
|
--setenv LC_ALL "$LC_ALL" \
|
||||||
--setenv PULSE_SERVER /run/user/$uid/pulse/native \
|
--setenv PULSE_SERVER /run/user/$uid/pulse/native \
|
||||||
--setenv PATH /flamescion-container-tools/bin-override:$PATH \
|
--setenv PATH /flamescion-container-tools/bin-override:$PATH \
|
||||||
|
--setenv IS_ACE_ENV "1" \
|
||||||
--dev-bind $chrootEnvPath/ / \
|
--dev-bind $chrootEnvPath/ / \
|
||||||
--dev-bind /media /media \
|
--dev-bind-try /media /media \
|
||||||
--dev-bind /tmp /tmp \
|
--dev-bind-try /tmp /tmp \
|
||||||
--dev /dev \
|
--dev /dev \
|
||||||
--dev-bind /dev/dri /dev/dri \
|
--dev-bind-try /dev/dri /dev/dri \
|
||||||
--proc /proc \
|
--proc /proc \
|
||||||
--dev-bind /sys /sys \
|
--dev-bind /sys /sys \
|
||||||
--dev-bind /run /run \
|
--dev-bind /run /run \
|
||||||
--dev-bind-try /run/user/$uid/pulse /run/user/$uid/pulse \
|
--dev-bind-try /run/user/$uid/pulse /run/user/$uid/pulse \
|
||||||
--dev-bind / /host \
|
--dev-bind / /host \
|
||||||
--ro-bind /usr/share/themes /usr/local/share/themes \
|
--bind-try /usr/share/themes /usr/local/share/themes \
|
||||||
--ro-bind /usr/share/icons /usr/local/share/icons \
|
--bind-try /usr/share/icons /usr/local/share/icons \
|
||||||
--ro-bind /usr/share/fonts /usr/local/share/fonts \
|
--bind-try /usr/share/fonts /usr/local/share/fonts \
|
||||||
--hostname bookworm-compatibility-mode \
|
--hostname Amber-CE-Bookworm \
|
||||||
--unshare-uts \
|
--unshare-uts \
|
||||||
--dev-bind /etc/resolv.conf /etc/resolv.conf \
|
--dev-bind-try /etc/resolv.conf /etc/resolv.conf \
|
||||||
--cap-add CAP_SYS_ADMIN \
|
--cap-add CAP_SYS_ADMIN \
|
||||||
--dev-bind /home /home \
|
--dev-bind-try /home /home \
|
||||||
bash -c "${container_command}"
|
bash -c "${container_command}"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ exit 1
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cd "`dirname $0`"
|
cd "`dirname $0`"
|
||||||
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 debootstrap --include=libnotify-bin,apt-utils,bash-completion,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 rm -rf bookworm-env/var/cache/apt/archives/*.deb
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
Package: ace-host-integration
|
Package: ace-host-integration
|
||||||
Version: 1.2
|
Version: 1.2.1
|
||||||
Section: misc
|
Section: misc
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Depends: bash
|
Depends: bash
|
||||||
|
|||||||
@@ -1,29 +1,45 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
ACE_dir="/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bookworm-env"
|
# ===== Log =====
|
||||||
function linkDir() {
|
# log.info xxx
|
||||||
ensureTargetDir() {
|
# log.warn xxx
|
||||||
targetFile=$1
|
# log.info xxx
|
||||||
t=$(dirname "$targetFile")
|
# log.debug xxx
|
||||||
mkdir -p "$t"
|
# 带颜色的echo
|
||||||
}
|
function log.color_output() {
|
||||||
|
local color=$1
|
||||||
|
shift 1
|
||||||
|
|
||||||
source=$1
|
echo >&2 -e "\033[${color}m$@\033[0m"
|
||||||
target=$2
|
return 0
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Log is named without prefix "utils." for convenience
|
||||||
|
# Usage: log.log <level> ...content
|
||||||
|
function log.log() {
|
||||||
|
if [[ $# < 2 ]]; then
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local level=$1
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
case $level in
|
||||||
|
error) log.color_output "0;31" "[ERROR] $@" ;;
|
||||||
|
warn) log.color_output "1;33" "[WARN] $@" ;;
|
||||||
|
info) log.color_output "1;37" "[INFO] $@" ;;
|
||||||
|
debug) log.color_output "1;30" "[DEBUG] $@" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function log.error() { log.log "error" "$@"; }
|
||||||
|
function log.warn() { log.log "warn" $@; }
|
||||||
|
function log.info() { log.log "info" $@; }
|
||||||
|
function log.debug() { log.log "debug" $@; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function do_integrate(){
|
function do_integrate(){
|
||||||
local file=$1
|
local file=$1
|
||||||
if [ -f "$file" ]; then
|
if [ -f "$file" ]; then
|
||||||
@@ -44,23 +60,28 @@ local file=$1
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
chmod +x $file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [ "${IS_ACE_ENV}" != "" ];then
|
||||||
|
if [ -e /opt/apps/ ];then
|
||||||
|
for app_dir in $(ls /opt/apps/); do
|
||||||
|
for file in /opt/apps/$app_dir/entries/applications/*.desktop;do
|
||||||
|
do_integrate $file
|
||||||
|
|
||||||
|
|
||||||
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
|
done
|
||||||
done
|
else
|
||||||
|
log.warn "No /opt/apps directory. Skip..."
|
||||||
|
fi
|
||||||
|
|
||||||
for file in /usr/share/applications/*.desktop; do
|
for file in /usr/share/applications/*.desktop; do
|
||||||
do_integrate $file
|
do_integrate $file
|
||||||
done
|
done
|
||||||
find "/usr/share/applications/" -xtype l -delete
|
find "/usr/share/applications/" -xtype l -delete
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
log.error "DO NOT run me on host OS"
|
||||||
|
fi
|
||||||
|
|||||||
@@ -0,0 +1,175 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
LANGUAGE=en_US
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#############################################################
|
||||||
|
# ===== Log =====
|
||||||
|
# log.info xxx
|
||||||
|
# log.warn xxx
|
||||||
|
# log.info xxx
|
||||||
|
# log.debug xxx
|
||||||
|
# 带颜色的echo
|
||||||
|
function log.color_output() {
|
||||||
|
local color=$1
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
echo >&2 -e "\033[${color}m$@\033[0m"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Log is named without prefix "utils." for convenience
|
||||||
|
# Usage: log.log <level> ...content
|
||||||
|
function log.log() {
|
||||||
|
if [[ $# < 2 ]]; then
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local level=$1
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
case $level in
|
||||||
|
error) log.color_output "0;31" "[ERROR] $@" ;;
|
||||||
|
warn) log.color_output "1;33" "[WARN] $@" ;;
|
||||||
|
info) log.color_output "1;37" "[INFO] $@" ;;
|
||||||
|
debug) log.color_output "1;30" "[DEBUG] $@" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function log.error() { log.log "error" "$@"; }
|
||||||
|
function log.warn() { log.log "warn" $@; }
|
||||||
|
function log.info() { log.log "info" $@; }
|
||||||
|
function log.debug() { log.log "debug" $@; }
|
||||||
|
|
||||||
|
|
||||||
|
# 发送通知
|
||||||
|
function notify-send() {
|
||||||
|
|
||||||
|
|
||||||
|
# Detect user using the display
|
||||||
|
local user=$(who | awk '{print $1}' | head -n 1)
|
||||||
|
|
||||||
|
# Detect uid of the user
|
||||||
|
local uid=$(id -u $user)
|
||||||
|
log.debug "User is $user and the uid of it is $uid"
|
||||||
|
sudo -u $user DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${uid}/bus notify-send $@
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# 检测网络链接畅通
|
||||||
|
function network-check()
|
||||||
|
{
|
||||||
|
# 超时时间
|
||||||
|
local timeout=15
|
||||||
|
|
||||||
|
# 目标网站
|
||||||
|
local target=www.baidu.com
|
||||||
|
|
||||||
|
# 获取响应状态码
|
||||||
|
local ret_code=`curl -I -s --connect-timeout ${timeout} ${target} -w %{http_code} | tail -n1`
|
||||||
|
|
||||||
|
if [ "x$ret_code" = "x200" ] ; then
|
||||||
|
# 网络畅通
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
# 网络不畅通
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
###############################################################
|
||||||
|
|
||||||
|
if [ "$(id -u)" != "0" ]; then
|
||||||
|
log.error "Nope we need root to run"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
network-check
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
log.error "NETWORK_FAIL"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# The code above is modified from https://blog.csdn.net/yaxuan88521/article/details/120516298
|
||||||
|
|
||||||
|
if [ $(which aptss) ];then
|
||||||
|
APT_COMMAND=aptss
|
||||||
|
/usr/bin/apt update
|
||||||
|
log.info "Using aptss to operate the upgrade process since we detect it."
|
||||||
|
elif [ -e /usr/bin/apt ];then
|
||||||
|
APT_COMMAND=/usr/bin/apt
|
||||||
|
log.info "Using apt to operate the upgrade process."
|
||||||
|
else
|
||||||
|
log.error "Nope we support debian only now"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
${APT_COMMAND} clean
|
||||||
|
${APT_COMMAND} update
|
||||||
|
|
||||||
|
updatetext=`${APT_COMMAND} update 2>&1`
|
||||||
|
|
||||||
|
until [ "`echo $updatetext | grep E: `" = "" ];do
|
||||||
|
log.info "UPDATE_ERROR_AND_WAIT_15_SEC"
|
||||||
|
sleep 15
|
||||||
|
updatetext=`${APT_COMMAND} update 2>&1`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
isupdate=`echo ${updatetext: -5}`
|
||||||
|
if [ "$isupdate" = "date." ] ; then
|
||||||
|
log.info "No need to upgrade. exit"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
## 从这里开始,只有检测到了更新才会进行
|
||||||
|
update_app_number=`echo ${updatetext%package*} #从右向左截取第一个 src 后的字符串`
|
||||||
|
update_app_number=`echo ${update_app_number##*information...}`
|
||||||
|
|
||||||
|
# 获取用户选择的要更新的应用
|
||||||
|
PKG_LIST="$(env LANGUAGE=en_US /usr/bin/apt list --upgradable | awk NR\>1)"
|
||||||
|
# 指定分隔符为 \n
|
||||||
|
IFS_OLD="$IFS"
|
||||||
|
IFS=$'\n'
|
||||||
|
|
||||||
|
for line in $PKG_LIST ; do
|
||||||
|
PKG_NAME=$(echo $line | awk -F ' ' '{print $1}')
|
||||||
|
PKG_NEW_VER=$(echo $line | awk -F ' ' '{print $2}')
|
||||||
|
PKG_CUR_VER=$(echo $line | awk -F ' ' '{print $3}')
|
||||||
|
|
||||||
|
dpkg --compare-versions $PKG_NEW_VER le $PKG_CUR_VER
|
||||||
|
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
let update_app_number=$update_app_number-1
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
## 检测是否是 hold 状态
|
||||||
|
PKG_STA=$(dpkg-query -W -f='${db:Status-Want}' $PKG_NAME)
|
||||||
|
if [ "$PKG_STA" = "hold" ] ; then
|
||||||
|
let update_app_number=$update_app_number-1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# 还原分隔符
|
||||||
|
IFS="$IFS_OLD"
|
||||||
|
if [ $update_app_number -le 0 ] ; then
|
||||||
|
log.info "No package need to upgrade after ignoring those holded ones. exit"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
## 如果都是hold或者版本一致的那就直接退出,否则把剩余的给提醒了
|
||||||
|
|
||||||
|
|
||||||
|
user=$(who | awk '{print $1}' | head -n 1)
|
||||||
|
|
||||||
|
log.info "ACE环境中有 $update_app_number 个软件包可升级,正在自动升级"
|
||||||
|
notify-send -a cn.flamescion.bookworm-compatibility-mode "ACE兼容环境" "ACE环境中有${update_app_number}个软件包可升级,执行自动升级..."
|
||||||
|
|
||||||
|
${APT_COMMAND} clean
|
||||||
|
${APT_COMMAND} full-upgrade -y
|
||||||
|
${APT_COMMAND} clean
|
||||||
|
notify-send -a cn.flamescion.bookworm-compatibility-mode "ACE兼容环境" "自动升级结束"
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
host-spawn /opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/bookworm-run-bwrap $@
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
if [ "$UID" = "0" ];then
|
if [ "$UID" = "0" ];then
|
||||||
pkexec $@
|
$@
|
||||||
else
|
else
|
||||||
host-spawn pkexec bookworm-run $@
|
host-spawn pkexec bookworm-run $@
|
||||||
fi
|
fi
|
||||||
|
|||||||
1
src/usr/bin/ace-uninstall-helper
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/ace-uninstall-helper
|
||||||
1
src/usr/bin/ace-uninstall-helper-gui
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/ace-uninstall-helper-gui
|
||||||
1
src/usr/bin/bookworm-run
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/bookworm-run
|
||||||
14
src/usr/lib/systemd/system/ace-auto-upgrade.service
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Amber CE Auto upgrade
|
||||||
|
After=apt-daily.service network.target network-online.target systemd-networkd.service NetworkManager.service connman.service
|
||||||
|
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=bookworm-run /flamescion-container-tools/ace-upgrader/ace-upgrader
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=10
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
17
src/usr/lib/systemd/user-environment-generators/60-ACE-Bookworm
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Ensure base distro defaults xdg path are set if nothing filed up some
|
||||||
|
# defaults yet.
|
||||||
|
if [ -z "$XDG_DATA_DIRS" ]; then
|
||||||
|
export XDG_DATA_DIRS="/usr/local/share:/usr/share"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Desktop files (used by desktop environments within both X11 and Wayland) are
|
||||||
|
# looked for in XDG_DATA_DIRS; make sure it includes the relevant directory for ACE
|
||||||
|
ACE_path="/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bookworm-env/usr/share/"
|
||||||
|
if [ -n "${XDG_DATA_DIRS##*${ACE_path}}" ] && [ -n "${XDG_DATA_DIRS##*${ACE_path}:*}" ]; then
|
||||||
|
export XDG_DATA_DIRS="${ACE_path}:${XDG_DATA_DIRS}"
|
||||||
|
fi
|
||||||
|
|
||||||
@@ -4,8 +4,8 @@ Name=ACE Software Uninstaller
|
|||||||
Name[zh_CN]=ACE软件卸载器
|
Name[zh_CN]=ACE软件卸载器
|
||||||
Comment=用于卸载ACE容器的应用
|
Comment=用于卸载ACE容器的应用
|
||||||
Type=Application
|
Type=Application
|
||||||
Exec=/home/shenmo-ikun/Desktop/bookworm-compatibility-mode/src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/ace-uninstall-helper-gui
|
Exec=/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/ace-uninstall-helper-gui
|
||||||
Icon=ACE-uninstaller
|
Icon=ACE-uninstaller
|
||||||
Categories=AudioVideo
|
Categories=System
|
||||||
|
|
||||||
# Generated from the DesktopGenerater component of the z-Tools toolkit
|
# Generated from the DesktopGenerater component of the z-Tools toolkit
|
||||||
@@ -8,3 +8,4 @@ Keywords=BCM,ACE,ace,mode
|
|||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
Type=Application
|
Type=Application
|
||||||
Terminal=true
|
Terminal=true
|
||||||
|
Categories=System
|
||||||
|
Before Width: | Height: | Size: 196 KiB After Width: | Height: | Size: 196 KiB |
|
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 134 KiB |
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 118 KiB |
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 118 KiB |
|
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 134 KiB |
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||||
|
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||||
|
<policyconfig>
|
||||||
|
<vendor>cn.flamescion.ace-uninstaller</vendor>
|
||||||
|
<icon_name>x-package-repository</icon_name>
|
||||||
|
<action id="cn.flamescion.ace-uninstaller">
|
||||||
|
<description>运行cn.flamescion.ace-uninstaller需要权限</description>
|
||||||
|
<message>要使用cn.flamescion.ace-uninstaller需要权限</message>
|
||||||
|
<defaults>
|
||||||
|
<allow_any>yes</allow_any>
|
||||||
|
<allow_inactive>yes</allow_inactive>
|
||||||
|
<allow_active>yes</allow_active>
|
||||||
|
</defaults>
|
||||||
|
<annotate key="org.freedesktop.policykit.exec.path">/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/ace-uninstall-helper-gui</annotate>
|
||||||
|
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||||
|
</action>
|
||||||
|
</policyconfig>
|
||||||
|
|
||||||
@@ -8,3 +8,5 @@ rm -rf /var/cache/apt/
|
|||||||
rm -rf /var/lib/aptss/lists/*
|
rm -rf /var/lib/aptss/lists/*
|
||||||
rm -rf /usr/share/doc
|
rm -rf /usr/share/doc
|
||||||
|
|
||||||
|
#apt install ace-integration in init
|
||||||
|
#tools只保留gio hostspawn和xdg-open
|
||||||