diff options
Diffstat (limited to 'lfs.sh')
-rwxr-xr-x | lfs.sh | 65 |
1 files changed, 53 insertions, 12 deletions
@@ -71,15 +71,15 @@ fi # Create limited directory layout if [[ ! -f "${LFS}"/sources/limited ]]; then - mkdir -p "${LFS}"/sources - mkdir -p "${LFS}"/tools - mkdir -p "${LFS}"/bin - mkdir -p "${LFS}"/etc - mkdir -p "${LFS}"/lib - mkdir -p "${LFS}"/sbin - mkdir -p "${LFS}"/usr - mkdir -p "${LFS}"/var - touch "${LFS}"/sources/limited + mkdir -p "${LFS}"/sources + mkdir -p "${LFS}"/tools + mkdir -p "${LFS}"/bin + mkdir -p "${LFS}"/etc + mkdir -p "${LFS}"/lib + mkdir -p "${LFS}"/sbin + mkdir -p "${LFS}"/usr + mkdir -p "${LFS}"/var + touch "${LFS}"/sources/limited fi case $(uname -m) in @@ -145,7 +145,7 @@ chmod ugo+x preparechroot.sh chmod ugo+x insidechroot.sh printf "%b" "\n${CYN}PREPARING ${RED}CHROOT${CYN} ENVIRONMENT${RST}...\n" -source preparechroot.sh "${LFS}" +source preparechroot.sh "${LFS}" source createdirs.sh source essential.sh @@ -163,6 +163,7 @@ sudo chroot "${LFS}" /usr/bin/env -i \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ NUMPROCS="${NUMPROCS}" \ MAKEFLAGS="${MAKEFLAGS}" \ + NINJAJOBS="${MAKEFLAGS}" \ SPINNER="${SPINNER}" \ /bin/bash --login +h -c "/sources/insidechroot.sh 7" retval=$? @@ -188,7 +189,10 @@ source mountvirtfs.sh printf "%b" "\n${CYN}ENTERING ${RED}CHROOT${CYN} ENVIRONMENT...${RST}\n" sleep 3 -# Enter CHROOT for chapter 8, 9 and 10 +# Create chapter8 log directory as non root user +mkdir -p "${LFS}"/sources/log/chapter8 + +# Enter CHROOT for chapter 8 sudo chroot "${LFS}" /usr/bin/env -i \ HOME=/root \ TERM="${TERM}" \ @@ -196,7 +200,44 @@ sudo chroot "${LFS}" /usr/bin/env -i \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ NUMPROCS="${NUMPROCS}" \ MAKEFLAGS="${MAKEFLAGS}" \ + NINJAJOBS="${NINJAJOBS}" \ SPINNER="${SPINNER}" \ /bin/bash --login +h -c "/sources/insidechroot.sh 8" +retval=$? + +printf "%b" "\n${CYN}EXITED ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n" +# Cleanup and Backup if chapter 8 successfully finished +if [[ "$retval" -eq 0 ]]; then + source umountvirtfs.sh + + printf "%b" "\n${IWHT}======= ${IYLW}Chapter 8 ${IGRN}Cleanup and Backup \ +${IWHT}=======${RST}\n" + # shellcheck source=chapter8/cleanup.sh + source "${LFS}"/sources/chapter8/cleanup.sh + # shellcheck source=chapter8/backup.sh + source "${LFS}"/sources/chapter8/backup.sh +else + exit "$retval" +fi + +# Mount virtual kernel filesystems after cleanup and backup +source mountvirtfs.sh + +printf "%b" "\n${CYN}ENTERING ${RED}CHROOT${CYN} ENVIRONMENT...${RST}\n" +sleep 3 + +# Enter CHROOT for chapter 9,10 +sudo chroot "${LFS}" /usr/bin/env -i \ + HOME=/root \ + TERM="${TERM}" \ + PS1='(lfs chroot) \u:\w\$ ' \ + PATH=/bin:/usr/bin:/sbin:/usr/sbin \ + NUMPROCS="${NUMPROCS}" \ + MAKEFLAGS="${MAKEFLAGS}" \ + NINJAJOBS="${NINJAJOBS}" \ + SPINNER="${SPINNER}" \ + /bin/bash --login +h -c "/sources/insidechroot.sh 9" +retval=$? + +printf "%b" "\n${CYN}EXITED ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n" -printf "%b" "\n${CYN}EXITED ${RED}CHROOT${CYN} ENVIRONMENT${RST}...\n" |