Properly mount and unmount directories for chroot

This commit is contained in:
Kron4ek 2021-05-28 15:14:00 +05:00 committed by GitHub
parent 334dffaa6c
commit 3e5f47f298
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,16 +27,23 @@ mount_chroot () {
mount --bind "${bootstrap}" "${bootstrap}"
mount -t proc /proc "${bootstrap}"/proc
mount --make-rslave --rbind /sys "${bootstrap}"/sys
mount --make-rslave --rbind /dev "${bootstrap}"/dev
mount --make-rslave --rbind /run "${bootstrap}"/run
mount --rbind /sys "${bootstrap}"/sys
mount --make-rslave "${bootstrap}"/sys
mount --rbind /dev "${bootstrap}"/dev
mount --make-rslave "${bootstrap}"/dev
mount --rbind /run "${bootstrap}"/run
mount --make-rslave "${bootstrap}"/run
rm -f "${bootstrap}"/etc/resolv.conf
cp /etc/resolv.conf "${bootstrap}"/etc/resolv.conf
}
unmount_chroot () {
umount -Rl "${bootstrap}"
umount -f "${bootstrap}"/proc
umount -f "${bootstrap}"/sys
umount -f "${bootstrap}"/dev
umount -f "${bootstrap}"/run
umount -f "${bootstrap}"
}
run_in_chroot () {