lfs-buildscripts/CHROOT.sh

57 lines
1.5 KiB
Bash
Raw Permalink Normal View History

2024-10-04 02:26:08 +08:00
#!/bin/bash
2024-10-04 16:45:32 +08:00
function myfail {
echo "$1"
exit 1
}
2024-10-04 07:34:28 +08:00
if [ "`whoami`" != "root" ]; then
myfail "Must run this script as r00t"
fi
2024-10-11 05:57:33 +08:00
LFS="/mnt/newlfs"
2024-10-04 02:26:08 +08:00
2024-10-05 04:52:27 +08:00
[ ! -d ${LFS}/sources/CH7Build ] && cp -ar CH7Build ${LFS}/sources/
[ ! -d ${LFS}/sources/CH8Build ] && cp -ar CH8Build ${LFS}/sources/
2024-10-11 05:50:24 +08:00
[ ! -d ${LFS}/sources/CH9Config ] && cp -ar CH9Config ${LFS}/sources/
2024-10-13 09:11:55 +08:00
[ ! -d ${LFS}/sources/KernelBuild ] && cp -ar KernelBuild ${LFS}/sources/
2024-10-05 04:52:27 +08:00
cp versions.sh ${LFS}/sources/CH7Build/
2024-10-04 13:59:46 +08:00
cp versions.sh ${LFS}/sources/CH8Build/
2024-10-13 09:11:55 +08:00
cp versions.sh ${LFS}/sources/KernelBuild/
2024-10-13 10:23:21 +08:00
cp KernelBuild/lts-kernel-config ${LFS}/sources/
# TEMPORARY, REMOVE BEFORE FINAL BUILD
touch ${LFS}/sources/SKIPTESTS
2024-10-04 02:26:08 +08:00
chown --from lfs -R root:root ${LFS}/{usr,lib,var,etc,bin,sbin,tools}
2024-10-04 10:26:07 +08:00
chown --from lfs -R root:root ${LFS}/lib64
2024-10-04 02:26:08 +08:00
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