chroot prep

This commit is contained in:
YellowJacketLinux 2024-10-03 11:26:08 -07:00
parent 498d71877e
commit 50f6df220d

40
CH07.01-chroot-prep.sh Normal file
View File

@ -0,0 +1,40 @@
#!/bin/bash
LFS=/mnt/newlfs
#LFS=/home/mpeters/newlfs
cp -ar chrootscripts ${LFS}/sources/
chown --from lfs -R root:root ${LFS}/{usr,lib,var,etc,bin,sbin,tools}
case $(uname -m) in
x86_64) chown --from lfs -R root:root $LFS/lib64 ;;
esac
mkdir -pv ${LFS}/{dev,proc,sys,run}
mount -v --bind /dev ${LFS}/dev
mount -vt devpts devpts -o gid=5,mode=0620 ${LFS}/dev/pts
mount -vt proc proc ${LFS}/proc
mount -vt sysfs sysfs ${LFS}/sys
mount -vt tmpfs tmpfs ${LFS}/run
if [ -h ${LFS}/dev/shm ]; then
install -v -d -m 1777 ${LFS}$(realpath /dev/shm)
else
mount -vt tmpfs -o nosuid,nodev tmpfs ${LFS}/dev/shm
fi
echo "Continue in chroot. Command:"
echo
echo "chroot \"$LFS\" /usr/bin/env -i \\"
echo " HOME=/root \\"
echo " TERM=\"\$TERM\" \\"
echo " PS1='(lfs chroot) \\u:\\w\\\$ ' \\"
echo " PATH=/usr/bin:/usr/sbin \\"
echo " MAKEFLAGS=\"-j\$(nproc)\" \\"
echo " TESTSUITEFLAGS=\"-j\$(nproc)\" \\"
echo " /bin/bash --login"
exit 0