尝试性加入主目录沙箱--Wine

This commit is contained in:
2025-10-31 21:09:16 +08:00
parent 7b06cf293b
commit 908f3ab9de
5 changed files with 52 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
Package: apm Package: apm
Source: amber-ce Source: amber-ce
Version: 1.1.1 Version: 1.1.2
Architecture: amd64 Architecture: amd64
Maintainer: shenmo <shenmo@spark-app.store> Maintainer: shenmo <shenmo@spark-app.store>
Installed-Size: 48724 Installed-Size: 48724

View File

@@ -5,11 +5,23 @@ systemctl disable apm-daily-update
if [ "$1" = "remove" ] || [ "$1" = "purge" ];then if [ "$1" = "remove" ] ;then
echo "执行卸载操作,您的容器仍然被保留在 /var/lib/apm/ 下。请执行 sudo apt purge apm 以清理"
elif [ "$1" = "purge" ];then
echo "清理卸载残留" echo "清理卸载残留"
rm -rf /var/lib/apm/ rm -rf /var/lib/apm/
for username in $(ls /home)
do
echo /home/$username
if [ -d "/home/$username/.apm/" ]
then
rm -fr "/home/$username/.apm/"
fi
done
else else
echo "非卸载,跳过清理" echo "非卸载,跳过清理"
fi fi

View File

@@ -327,6 +327,14 @@ PACKAGE_NAME="$DPKG_MAINTSCRIPT_PACKAGE"
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
echo "清理卸载残留" echo "清理卸载残留"
rm -rf "/var/lib/apm/$PACKAGE_NAME" rm -rf "/var/lib/apm/$PACKAGE_NAME"
for username in $(ls /home)
do
echo /home/$username
if [ -d "/home/$username/.apm/$PACKAGE_NAME" ]
then
rm -fr "/home/$username/.apm/$PACKAGE_NAME"
fi
done
else else
echo "非卸载,跳过清理" echo "非卸载,跳过清理"
fi fi

View File

@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
VERSION=1.1.1 VERSION=1.1.2
# 获取脚本名称用于帮助信息 # 获取脚本名称用于帮助信息
SCRIPT_NAME=$(basename "$0") SCRIPT_NAME=$(basename "$0")
PATH_PREFIX=/var/lib/apm/apm/files/ace-env/ PATH_PREFIX=/var/lib/apm/apm/files/ace-env/
@@ -301,7 +301,7 @@ case "$1" in
fi fi
coredir=$pkg coredir=$pkg
export APM_PKG_NAME=$pkg
# 检测是否有额外命令参数 # 检测是否有额外命令参数
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then

View File

@@ -1,17 +1,40 @@
#!/bin/bash #!/bin/bash
bash(){ function bash(){
/usr/bin/bash --rcfile <(cat ~/.bashrc; echo "PS1=\"\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@Amber-PM \[\e[36;40m\]\w\[\e[0m\]]\\\$ \"") $@ /usr/bin/bash --rcfile <(cat ~/.bashrc; echo "PS1=\"\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@Amber-PM \[\e[36;40m\]\w\[\e[0m\]]\\\$ \"") $@
} }
export -f bash export -f bash
function ensure_dir() {
local dir="$1"
# 检查目录是否为空
if [ -z "$dir" ]; then
echo "错误: 目录路径不能为空"
return 1
fi
# 检查目录是否存在
if [ ! -d "$dir" ]; then
echo "目录 '$dir' 不存在,正在创建..."
if mkdir -p "$dir"; then
echo "成功创建目录 '$dir'"
return 0
else
echo "错误: 无法创建目录 '$dir'"
return 1
fi
else
echo "目录 '$dir' 已存在"
return 0
fi
}
chrootEnvPath="${chrootEnvPath:-$(pwd)/ace-env}" chrootEnvPath="${chrootEnvPath:-$(pwd)/ace-env}"
APM_PKG_NAME="${APM_PKG_NAME:-apm-general}"
non_root_user=$(who | awk '{print $1}' | head -n 1) non_root_user=$(who | awk '{print $1}' | head -n 1)
uid=$(id -u $non_root_user) uid=$(id -u $non_root_user)
ensure_dir $HOME/.apm/${APM_PKG_NAME}/.deepinwine
#### This part is for args pharm #### This part is for args pharm
if [ "$1" = "" ];then if [ "$1" = "" ];then
@@ -103,6 +126,7 @@ BIND_DIRS=(
"--ro-bind-try /usr/share/fonts /usr/local/share/fonts" "--ro-bind-try /usr/share/fonts /usr/local/share/fonts"
"--dev-bind-try /etc/resolv.conf /etc/resolv.conf" "--dev-bind-try /etc/resolv.conf /etc/resolv.conf"
"--dev-bind-try /home /home" "--dev-bind-try /home /home"
"--dev-bind-try $HOME/.apm/${APM_PKG_NAME}/.deepinwine $HOME/.deepinwine"
) )
EXTRA_ARGS=( EXTRA_ARGS=(
"--cap-add CAP_SYS_ADMIN" "--cap-add CAP_SYS_ADMIN"