支持在隔离的 Chroot 容器内运行 Wine

This commit is contained in:
2022-12-08 22:55:40 +08:00
parent ddbf0089b4
commit 1e1f451d6c
4 changed files with 264 additions and 221 deletions

29
MountWithoutHome.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/bash
if [ ` whoami ` != "root" ]; then
echo "Only root can run me"
exit 1
fi
if [ ! -d "$1" ]; then
echo "路径不存在!"
exit 1
fi
echo $0
echo $1
echo $2
echo $3
# 挂载必备目录
cd "$1"
# 拷贝 Qemu Static
cp -r /usr/bin/qemu-*-static ./usr/bin
# 挂载目录
mount --bind /dev ./dev
#mount --bind /dev/pts ./dev/pts
mount -t proc /proc ./proc
mount --bind /etc/resolv.conf ./etc/resolv.conf
mount -t sysfs /sys ./sys
#mount --bind /dev/shm ./dev/shm
chmod 777 -R root
xhost +
# 如果参数 3 存在
chroot ${@:3}