diff --git a/Mount.sh b/Mount.sh index a50e06a..3a353a9 100755 --- a/Mount.sh +++ b/Mount.sh @@ -43,5 +43,12 @@ else fi # 挂载此内容以可以跨架构运行程序 mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc +# 判断是否有 Root 权限 +cat etc/sudoers | grep "$2" +if [[ $? != 0 ]]; then + echo "$2 ALL=(ALL:ALL) ALL" >> etc/sudoers +fi +# 写入 DNS +cat /etc/resolv.conf > etc/resolv.conf # 如果参数 3 存在 "$programPath/pardus-chroot" "--userspec=$2:$2" . env "HOME=/home/$2" ${@:3} diff --git a/pardus-chroot b/pardus-chroot index c04d4e5..2289e55 100755 --- a/pardus-chroot +++ b/pardus-chroot @@ -27,10 +27,11 @@ fi #cat /etc/resolv.conf > $DESTDIR/etc/resolv.conf SHELL=/bin/bash unshare --fork --pid chroot "$DESTDIR" "$@" exit -if [[ -d /sys/firmware/efi/ ]] ; then - while umount "$DESTDIR/sys/firmware/efi/efivars" 2>/dev/null ; do : ;done -fi -for dir in dev/pts dev/shm dev sys proc run media ; do - while umount "$DESTDIR/$dir" 2>/dev/null; do : ;done -done +# 下面的因为有问题,不使用 +#if [[ -d /sys/firmware/efi/ ]] ; then +# while umount "$DESTDIR/sys/firmware/efi/efivars" 2>/dev/null ; do : ;done +#fi +#for dir in dev/pts dev/shm dev sys proc run media ; do +# while umount "$DESTDIR/$dir" 2>/dev/null; do : ;done +#done #umount -lf "$DESTDIR" 2>/dev/null