aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Harrington <kb0iic@berzerkula.org>2021-04-08 10:01:34 -0500
committerWilliam Harrington <kb0iic@berzerkula.org>2021-04-08 10:01:34 -0500
commit9ee68f93a3665922091afcd0706ce0f00b4d4a33 (patch)
tree5cd9e81fdb97dca19a64b7b1b0a997da9d0806a1
parentf915ae2960d95eaa39e9c6fb170e7f3382cda9d5 (diff)
Fix/Add chroot commands. Add cleanup and backup for chapter 8.
-rwxr-xr-xlfs.sh47
1 files changed, 43 insertions, 4 deletions
diff --git a/lfs.sh b/lfs.sh
index 37ae8a2..4d13d2a 100755
--- a/lfs.sh
+++ b/lfs.sh
@@ -151,7 +151,9 @@ sleep 3
# Create chapter7 log directory as non root user
mkdir -p "${LFS}"/sources/log/chapter7
-sudo chroot "${LFS}" /usr/bin/env \
+
+# Enter CHROOT for chapter 7
+sudo chroot "${LFS}" /usr/bin/env -i \
HOME=/root \
TERM="${TERM}" \
PS1='(lfs chroot) \u:\w\$ ' \
@@ -182,8 +184,11 @@ 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 \
+# 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}" \
PS1='(lfs chroot) \u:\w\$ ' \
@@ -193,5 +198,39 @@ sudo chroot "${LFS}" /usr/bin/env \
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"
+ source "${LFS}"/sources/chapter8/cleanup.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"