diff options
Diffstat (limited to 'lfs.sh')
-rwxr-xr-x | lfs.sh | 41 |
1 files changed, 36 insertions, 5 deletions
@@ -99,14 +99,14 @@ for package in m4 ncurses bash coreutils diffutils file findutils gawk grep gzip fi done -#source chapter6/cleanup.sh -#source chapter6/backup.sh +source chapter6/cleanup.sh +source chapter6/backup.sh chmod ugo+x preparechroot.sh chmod ugo+x insidechroot.sh -printf "%b" "${CYN}PREPARING CHROOT ENVIRONMENT...${RST}\n" +printf "%b" "${CYN}PREPARING ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n" sudo ./preparechroot.sh "${LFS}" -printf "%b" "${CYN}ENTERING CHROOT ENVIRONMENT...${RST}\n" +printf "%b" "${CYN}ENTERING ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n" sleep 3 sudo chroot "${LFS}" /usr/bin/env \ @@ -116,4 +116,35 @@ sudo chroot "${LFS}" /usr/bin/env \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ NUMPROCS="${NUMPROCS}" \ MAKEFLAGS="${MAKEFLAGS}" \ - /bin/bash --login +h -c "/sources/insidechroot.sh" + /bin/bash --login +h -c "/sources/insidechroot.sh 7" +retval=$? + +printf "%b" "${CYN}EXITED ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n" +# Cleanup and Backup if chapter 7 successfully finished +if [ "$retval" -eq 7 ]; then + printf "%b" "${GRN}Unmounting Virtual Kernel Filesystems...\n" + sudo umount "${LFS}"/dev/pts + sudo umount "${LFS}"/dev/ + sudo umount "${LFS}"/run + sudo umount "${LFS}"/sys + sudo umount "${LFS}"/proc + + printf "%b" "${GRN}Cleaning and backing up before starting Chapter 8.\n" + source "${LFS}"/sources/chapter7/cleanup.sh + source "${LFS}"/sources/chapter7/backup.sh +else + exit "$retval" +fi + +source mountvirtfs.sh + +sudo chroot "${LFS}" /usr/bin/env \ + HOME=/root \ + TERM="${TERM}" \ + PS1='(lfs chroot) \u:\w\$ ' \ + PATH=/bin:/usr/bin:/sbin:/usr/sbin \ + NUMPROCS="${NUMPROCS}" \ + MAKEFLAGS="${MAKEFLAGS}" \ + /bin/bash --login +h -c "/sources/insidechroot.sh 8" + +printf "%b" "${CYN}EXITED ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n" |