Compare commits
55 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 | |||
| 79679e79dc | |||
| 259957fb9e | |||
| 666cbf3cc2 | |||
| 08a160114a | |||
| 027b521b45 | |||
| a3e9fa3fc8 | |||
| 756c0ac310 | |||
| 6d2036b3fe | |||
| 9be0fa4fea | |||
| 518fa2dbd3 | |||
| b826b4c67c | |||
| d7e4071e6f | |||
| c2effa5c30 | |||
| e85ff8e69a |
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*.deb
|
||||
src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bookworm-env.tar.xz
|
||||
3
.gitmodules
vendored
@@ -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
|
||||
@@ -1,8 +1,8 @@
|
||||
Package: cn.flamescion.bookworm-compatibility-mode
|
||||
Version: 12.3
|
||||
Version: 12.4.7
|
||||
Section: misc
|
||||
Priority: optional
|
||||
Depends: bubblewrap,flatpak
|
||||
Depends: bubblewrap,flatpak,zenity,policykit-1,gcc
|
||||
Maintainer: shenmo <shenmo@spark-app.store>
|
||||
Architecture: arm64
|
||||
Architecture: amd64
|
||||
Description: bwrap wrapper for install and running debs inside a bookworm container
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#!/bin/bash
|
||||
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
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#!/bin/bash
|
||||
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
|
||||
fi
|
||||
|
||||
echo "清理卸载残留"
|
||||
|
||||
rm -rf /opt/apps/$PACKAGE_NAME
|
||||
|
||||
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
|
||||
@@ -1,9 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Categories=utils
|
||||
Exec=/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/bookworm-run %U
|
||||
Icon=cn.flamescion.bookworm-compatibility-mode
|
||||
Name=Bookworm CM
|
||||
Name[zh_CN]=书虫兼容模式
|
||||
StartupNotify=true
|
||||
Type=Application
|
||||
Terminal=true
|
||||
@@ -0,0 +1,86 @@
|
||||
#!/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 "Warn: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."
|
||||
exit
|
||||
else
|
||||
echo "Operation failed."
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
else
|
||||
echo "Warn: Path not found in the dpkg list file,try to scan to search for the package"
|
||||
fi
|
||||
fi
|
||||
# 遍历所有list文件 As fallback
|
||||
for file in "$DPKG_INFO_PATH"/*.list; do
|
||||
if grep -q "$IN_CONTAINER_PATH" "$file"; then
|
||||
PKGNAME_GUESS=$(basename "$file" .list | cut -d':' -f1)
|
||||
echo "Get pkgname $PKGNAME_GUESS, uninstalling..."
|
||||
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
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
if [ "$UID" != "0" ];then
|
||||
pkexec $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_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"
|
||||
[[ -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
|
||||
|
||||
@@ -36,9 +36,10 @@ bwrap --dev-bind $chrootEnvPath/ / \
|
||||
--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 /media /media \
|
||||
--dev-bind /tmp /tmp \
|
||||
--dev-bind-try /media /media \
|
||||
--dev-bind-try /tmp /tmp \
|
||||
--dev /dev \
|
||||
--dev-bind-try /dev/dri /dev/dri \
|
||||
--proc /proc \
|
||||
@@ -49,18 +50,19 @@ bwrap --dev-bind $chrootEnvPath/ / \
|
||||
--bind-try /usr/share/themes /usr/local/share/themes \
|
||||
--bind-try /usr/share/icons /usr/local/share/icons \
|
||||
--bind-try /usr/share/fonts /usr/local/share/fonts \
|
||||
--hostname bookworm-compatibility-mode \
|
||||
--hostname Amber-CE-Bookworm \
|
||||
--unshare-uts \
|
||||
--dev-bind /etc/resolv.conf /etc/resolv.conf \
|
||||
--dev-bind /home /home \
|
||||
--dev-bind-try /etc/resolv.conf /etc/resolv.conf \
|
||||
--dev-bind-try /home /home \
|
||||
$@
|
||||
|
||||
|
||||
}
|
||||
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
|
||||
# 之前错误的多复制了一个,这里删掉
|
||||
@@ -176,9 +178,137 @@ printf "%s:%s" "${container_user_name}" "${temporary_password}" | chpasswd -e
|
||||
printf "%s:" "root" | 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
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
@@ -189,18 +319,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/
|
||||
@@ -215,9 +333,10 @@ sudo -u $(who | awk '{print $1}' | head -n 1) bwrap --dev-bind $chrootEnvPath/ /
|
||||
--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 /media /media \
|
||||
--dev-bind /tmp /tmp \
|
||||
--dev-bind-try /media /media \
|
||||
--dev-bind-try /tmp /tmp \
|
||||
--dev /dev \
|
||||
--dev-bind-try /dev/dri /dev/dri \
|
||||
--proc /proc \
|
||||
@@ -225,13 +344,13 @@ sudo -u $(who | awk '{print $1}' | head -n 1) bwrap --dev-bind $chrootEnvPath/ /
|
||||
--dev-bind /run /run \
|
||||
--dev-bind-try /run/user/$uid/pulse /run/user/$uid/pulse \
|
||||
--dev-bind / /host \
|
||||
--ro-bind /usr/share/themes /usr/local/share/themes \
|
||||
--ro-bind /usr/share/icons /usr/local/share/icons \
|
||||
--ro-bind /usr/share/fonts /usr/local/share/fonts \
|
||||
--hostname bookworm-compatibility-mode \
|
||||
--bind-try /usr/share/themes /usr/local/share/themes \
|
||||
--bind-try /usr/share/icons /usr/local/share/icons \
|
||||
--bind-try /usr/share/fonts /usr/local/share/fonts \
|
||||
--hostname Amber-CE-Bookworm \
|
||||
--unshare-uts \
|
||||
--dev-bind /etc/resolv.conf /etc/resolv.conf \
|
||||
--dev-bind /home /home \
|
||||
--dev-bind-try /etc/resolv.conf /etc/resolv.conf \
|
||||
--dev-bind-try /home /home \
|
||||
locale-gen
|
||||
|
||||
chown -R root $chrootEnvPath
|
||||
|
||||
@@ -54,24 +54,25 @@ bwrap --dev-bind / / \
|
||||
--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 /media /media \
|
||||
--dev-bind /tmp /tmp \
|
||||
--dev-bind-try /media /media \
|
||||
--dev-bind-try /tmp /tmp \
|
||||
--dev /dev \
|
||||
--dev-bind /dev/dri /dev/dri \
|
||||
--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 /usr/share/themes /usr/local/share/themes \
|
||||
--ro-bind /usr/share/icons /usr/share/icons \
|
||||
--ro-bind /usr/share/fonts /usr/local/share/fonts \
|
||||
--hostname bookworm-compatibility-mode \
|
||||
--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 /etc/resolv.conf /etc/resolv.conf \
|
||||
--dev-bind-try /etc/resolv.conf /etc/resolv.conf \
|
||||
--cap-add CAP_SYS_ADMIN \
|
||||
--dev-bind /home /home \
|
||||
--dev-bind-try /home /home \
|
||||
bash -c "${container_command}"
|
||||
|
||||
|
||||
|
||||
@@ -53,24 +53,25 @@ bwrap --dev-bind / / \
|
||||
--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 /media /media \
|
||||
--dev-bind /tmp /tmp \
|
||||
--dev-bind-try /media /media \
|
||||
--dev-bind-try /tmp /tmp \
|
||||
--dev /dev \
|
||||
--dev-bind /dev/dri /dev/dri \
|
||||
--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 /usr/share/themes /usr/local/share/themes \
|
||||
--ro-bind /usr/share/icons /usr/local/share/icons \
|
||||
--ro-bind /usr/share/fonts /usr/local/share/fonts \
|
||||
--hostname bookworm-compatibility-mode \
|
||||
--bind-try /usr/share/themes /usr/local/share/themes \
|
||||
--bind-try /usr/share/icons /usr/local/share/icons \
|
||||
--bind-try /usr/share/fonts /usr/local/share/fonts \
|
||||
--hostname Amber-CE-Bookworm \
|
||||
--unshare-uts \
|
||||
--dev-bind /etc/resolv.conf /etc/resolv.conf \
|
||||
--dev-bind-try /etc/resolv.conf /etc/resolv.conf \
|
||||
--cap-add CAP_SYS_ADMIN \
|
||||
--dev-bind /home /home \
|
||||
--dev-bind-try /home /home \
|
||||
bash -c "${container_command}"
|
||||
|
||||
|
||||
|
||||
@@ -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,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 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
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
Package: ace-host-integration
|
||||
Version: 1.2.1
|
||||
Section: misc
|
||||
Priority: optional
|
||||
Depends: bash
|
||||
Maintainer: shenmo <shenmo@spark-app.store>
|
||||
Architecture: all
|
||||
Description: ace-host-integration
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
if [ "${1}" = "triggered" ];then
|
||||
/opt/ace-host-integration/ace-host-integration
|
||||
fi
|
||||
@@ -0,0 +1,2 @@
|
||||
interest-noawait /opt/apps
|
||||
interest-noawait /usr/share/applications
|
||||
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
ACE_dir="/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bookworm-env"
|
||||
|
||||
|
||||
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
|
||||
chmod +x $file
|
||||
}
|
||||
|
||||
|
||||
|
||||
for app_dir in $(ls /opt/apps/); do
|
||||
for file in /opt/apps/$app_dir/entries/applications/*.desktop;do
|
||||
do_integrate $file
|
||||
|
||||
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
for file in /usr/share/applications/*.desktop; do
|
||||
do_integrate $file
|
||||
done
|
||||
find "/usr/share/applications/" -xtype l -delete
|
||||
|
||||
1
src/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/flamescion-container-tools/bin-override
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
### We do not want users to install ACE in ACE. Run inside this container instead
|
||||
${@}
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
if [ "$1" = "open" ];then
|
||||
xdg-open ${@:2}
|
||||
else
|
||||
/usr/bin/gio $@
|
||||
fi
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
if [ "$UID" = "0" ];then
|
||||
$@
|
||||
else
|
||||
host-spawn pkexec bookworm-run $@
|
||||
fi
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
if [ "$UID" = "0" ];then
|
||||
/usr/bin/sudo $@
|
||||
else
|
||||
host-spawn sudo bookworm-run $@
|
||||
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-init
Symbolic link
@@ -0,0 +1 @@
|
||||
../../opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/bookworm-init
|
||||
1
src/usr/bin/bookworm-run
Symbolic link
@@ -0,0 +1 @@
|
||||
../../opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/bookworm-run
|
||||
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
|
||||
|
||||
11
src/usr/share/applications/ACE-uninstaller.desktop
Normal file
@@ -0,0 +1,11 @@
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Name=ACE Software Uninstaller
|
||||
Name[zh_CN]=ACE软件卸载器
|
||||
Comment=用于卸载ACE容器的应用
|
||||
Type=Application
|
||||
Exec=/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/ace-uninstall-helper-gui
|
||||
Icon=ACE-uninstaller
|
||||
Categories=System
|
||||
|
||||
# Generated from the DesktopGenerater component of the z-Tools toolkit
|
||||
@@ -0,0 +1,11 @@
|
||||
[Desktop Entry]
|
||||
Categories=utils
|
||||
Exec=bookworm-run %U
|
||||
Icon=cn.flamescion.bookworm-compatibility-mode
|
||||
Name=Amber CE
|
||||
Name[zh_CN]=ACE兼容环境
|
||||
Keywords=BCM,ACE,ace,mode
|
||||
StartupNotify=true
|
||||
Type=Application
|
||||
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 |
BIN
src/usr/share/icons/ACE-uninstaller-orig.png
Normal file
|
After Width: | Height: | Size: 118 KiB |
BIN
src/usr/share/icons/ACE-uninstaller.png
Normal file
|
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 /usr/share/doc
|
||||
|
||||
#apt install ace-integration in init
|
||||
#tools只保留gio hostspawn和xdg-open
|
||||