aboutsummaryrefslogtreecommitdiffstats
path: root/lfs.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lfs.sh')
-rwxr-xr-xlfs.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/lfs.sh b/lfs.sh
index 0203a45..55bdfb6 100755
--- a/lfs.sh
+++ b/lfs.sh
@@ -154,7 +154,45 @@ sudo chroot "${LFS}" /usr/bin/env \
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
NUMPROCS="${NUMPROCS}" \
MAKEFLAGS="${MAKEFLAGS}" \
+ SPINNER="${SPINNER}" \
TESTERUID="$(id -u)" \
/bin/bash --login +h -c "/sources/insidechroot.sh 7"
+retval=$?
+
+printf "%b" "\n${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" "\n${IWHT}======= ${IYLW}Chapter 7 ${IGRN}Cleanup and Backup \
+${IWHT}=======${RST}\n"
+ source "${LFS}"/sources/chapter7/cleanup.sh
+ source "${LFS}"/sources/chapter7/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 8, 9 and 10
+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}" \
+ SPINNER="${SPINNER}" \
+ TESTERUID="$(id -u)" \
+ /bin/bash --login +h -c "/sources/insidechroot.sh 8"
printf "%b" "\n${CYN}EXITED ${RED}CHROOT${CYN} ENVIRONMENT${RST}...\n"