From 1b4481df6f656a554e167dcd1a311a2c2a74c1e6 Mon Sep 17 00:00:00 2001 From: Aditya Date: Tue, 10 Jan 2023 10:15:45 +0530 Subject: [PATCH] Add 7.4 - enter chroot environment --- scripts/chapter7/7.4-enter-chroot.sh | 10 ++++++++++ scripts/main.sh | 12 ++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 scripts/chapter7/7.4-enter-chroot.sh diff --git a/scripts/chapter7/7.4-enter-chroot.sh b/scripts/chapter7/7.4-enter-chroot.sh new file mode 100644 index 0000000..6c45294 --- /dev/null +++ b/scripts/chapter7/7.4-enter-chroot.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +chroot "$LFS" /usr/bin/env -i \ + HOME=/root \ + TERM="$TERM" \ + PS1='(lfs chroot) \u:\w\$ ' \ + PATH=/usr/bin:/usr/sbin \ + /bin/bash --login + + diff --git a/scripts/main.sh b/scripts/main.sh index 7d2c780..8e1bfe9 100644 --- a/scripts/main.sh +++ b/scripts/main.sh @@ -420,3 +420,15 @@ then stop_script "chapter7/7.3-prepare-virtual-fs.sh" fi +# Chapter 7.4 +# =========== +echo "Entering the Chroot Environment" +su -c "bash $PWD/chapter7/7.4-enter-chroot.sh" + +# Exit on error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter7/7.4-enter-chroot.sh" +fi +