Dynamically manage mounts in chroot

This commit is contained in:
Salt 2020-12-04 02:40:56 -06:00
parent aad2417c11
commit cb8c7537c0
1 changed files with 9 additions and 5 deletions

View File

@ -195,11 +195,15 @@ build-gentoo() {
popd
log "Pivoting to container for more setup"
cp "$0" "$_optdest/gentoostrap.sh"
mount --types proc /proc "$_optdest/proc"
mount --rbind /sys "$_optdest/sys"
mount --make-rslave "$_optdest/sys"
mount --rbind /dev "$_optdest/dev"
mount --make-rslave "$_optdest/dev"
if ! grep -qs "$_optdest/proc " /proc/mounts; then
mount --types proc /proc "$_optdest/proc"
fi
for dir in sys dev; do
if ! grep -qs "$_optdest/$mount " /proc/mounts; then
mount --rbind /$mount "$_optdest/$mount"
mount --make-rslave "$_optdest/$mount"
fi
done
chroot "$_optdest" /gentoostrap.sh -c
chroot "$_optdest" /gentoostrap.sh -d
log "Configuration complete! You should be good to reboot now."