2022-12-08 22:55:40 +08:00
|
|
|
#!/bin/bash
|
|
|
|
if [ ` whoami ` != "root" ]; then
|
|
|
|
echo "Only root can run me"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ ! -d "$1" ]; then
|
|
|
|
echo "路径不存在!"
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-12-25 22:28:46 +08:00
|
|
|
programPath=`dirname $0`
|
2022-12-08 22:55:40 +08:00
|
|
|
echo $0
|
|
|
|
echo $1
|
|
|
|
echo $2
|
|
|
|
echo $3
|
|
|
|
# 挂载必备目录
|
|
|
|
cd "$1"
|
|
|
|
# 拷贝 Qemu Static
|
|
|
|
cp -r /usr/bin/qemu-*-static ./usr/bin
|
|
|
|
# 挂载目录
|
2022-12-25 22:28:46 +08:00
|
|
|
# 这里将由 pardus-chroot 处理
|
|
|
|
#mount --bind /dev ./dev
|
2022-12-08 22:55:40 +08:00
|
|
|
#mount --bind /dev/pts ./dev/pts
|
2022-12-25 22:28:46 +08:00
|
|
|
#mount -t proc /proc ./proc
|
|
|
|
#mount --bind /etc/resolv.conf ./etc/resolv.conf
|
|
|
|
#mount -t sysfs /sys ./sys
|
2022-12-08 22:55:40 +08:00
|
|
|
#mount --bind /dev/shm ./dev/shm
|
2022-12-25 22:28:46 +08:00
|
|
|
chmod 777 -R root tmp
|
2022-12-08 22:55:40 +08:00
|
|
|
xhost +
|
|
|
|
|
|
|
|
# 如果参数 3 存在
|
2022-12-25 22:28:46 +08:00
|
|
|
"$programPath/pardus-chroot" . ${@:3}
|