maplelinux-bootstrap/chroot-bootstrap.sh
Alexander Hill c971eb2f31 Built a version of cargo and rustc that won't crash
Co-authored-by: Alexander Hill <ahill@breadpudding.dev>
Co-authored-by: Nicholas McDaniel <nickmcdaniel00@gmail.com>
2025-05-06 23:37:40 -04:00

41 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
MAPLE=$(pwd)/maple
run_chroot() {
SHELL=/bin/sh
if [ -e $MAPLE/bin/zsh ]; then
SHELL=/bin/zsh
fi
chroot $MAPLE $SHELL
}
if mount --rbind /dev $MAPLE/dev && mount --make-rslave $MAPLE/dev; then
if mount -t proc /proc $MAPLE/proc; then
if mount --rbind /sys $MAPLE/sys && mount --make-rslave $MAPLE/sys; then
if mount --rbind /tmp $MAPLE/tmp; then
if mount --bind /run $MAPLE/run; then
if [ -d $MAPLE/maple/sources ]; then
if mount --bind ./sources $MAPLE/maple/sources; then
if [ -d $MAPLE/maple/patches ]; then
if mount --bind ./patches $MAPLE/maple/patches; then
run_chroot
umount $MAPLE/maple/patches
fi
else
run_chroot
fi
umount $MAPLE/maple/sources
fi
else
run_chroot
fi
umount $MAPLE/run
fi
umount $MAPLE/tmp
fi
umount -R $MAPLE/sys
fi
umount $MAPLE/proc
fi
umount -R $MAPLE/dev
fi