From 9d68d5da4115353816ab4f6b1c7a4f5db43576f9 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Mon, 22 Mar 2021 19:48:11 -0500
Subject: Prepare chapter 7 build scripts.

---
 chapter7/bison.sh      |   3 +
 chapter7/gettext.sh    |   5 ++
 chapter7/libstdc++.sh  |  12 ++++
 chapter7/perl.sh       |  11 ++++
 chapter7/python.sh     |   5 ++
 chapter7/texinfo.sh    |   3 +
 chapter7/util-linux.sh |  15 +++++
 insidechroot.sh        | 153 ++++++++++++++++++++++++++++++++++++++++++++++++-
 8 files changed, 206 insertions(+), 1 deletion(-)
 create mode 100644 chapter7/bison.sh
 create mode 100644 chapter7/gettext.sh
 create mode 100644 chapter7/libstdc++.sh
 create mode 100644 chapter7/perl.sh
 create mode 100644 chapter7/python.sh
 create mode 100644 chapter7/texinfo.sh
 create mode 100644 chapter7/util-linux.sh

diff --git a/chapter7/bison.sh b/chapter7/bison.sh
new file mode 100644
index 0000000..a2344a6
--- /dev/null
+++ b/chapter7/bison.sh
@@ -0,0 +1,3 @@
+./configure --prefix=/usr --docdir=/usr/share/doc/bison-3.7.5 &&
+make &&
+make -j1 install
diff --git a/chapter7/gettext.sh b/chapter7/gettext.sh
new file mode 100644
index 0000000..85bc7f4
--- /dev/null
+++ b/chapter7/gettext.sh
@@ -0,0 +1,5 @@
+./configure --disable-shared
+make &&
+cp -v gettext-tools/src/msgfmt /usr/bin
+cp -v gettext-tools/src/msgmerge /usr/bin
+cp -v gettext-tools/src/xgettext /usr/bin
diff --git a/chapter7/libstdc++.sh b/chapter7/libstdc++.sh
new file mode 100644
index 0000000..5e81693
--- /dev/null
+++ b/chapter7/libstdc++.sh
@@ -0,0 +1,12 @@
+ln -s gthr-posix.h libgcc/gthr-default.h
+mkdir build
+cd build
+../libstdc++-v3/configure \
+    CXXFLAGS="-g -O2 -D_GNU_SOURCE" \
+    --prefix=/usr \
+    --disable-multilib \
+    --disable-nls \
+    --host=$(uname -m)-lfs-linux-gnu \
+    --disable-libstdcxx-pch &&
+make &&
+make -j1 install
diff --git a/chapter7/perl.sh b/chapter7/perl.sh
new file mode 100644
index 0000000..2cb5245
--- /dev/null
+++ b/chapter7/perl.sh
@@ -0,0 +1,11 @@
+sh Configure -des \
+             -Dprefix=/usr \
+             -Dvendorprefix=/usr \
+             -Dprivlib=/usr/lib/perl5/5.32/core_perl \
+             -Darchlib=/usr/lib/perl5/5.32/core_perl \
+             -Dsitelib=/usr/lib/perl5/5.32/site_perl \
+             -Dsitearch=/usr/lib/perl5/5.32/site_perl \
+             -Dvendorlib=/usr/lib/perl5/5.32/vendor_perl \
+             -Dvendorarch=/usr/lib/perl5/5.32/vendor_perl &&
+make &&
+make -j1 install
diff --git a/chapter7/python.sh b/chapter7/python.sh
new file mode 100644
index 0000000..7d158b1
--- /dev/null
+++ b/chapter7/python.sh
@@ -0,0 +1,5 @@
+./configure --prefix=/usr \
+            --enable-shared \
+            --without-ensurepip &&
+make &&
+make -j1 install
diff --git a/chapter7/texinfo.sh b/chapter7/texinfo.sh
new file mode 100644
index 0000000..7f133fe
--- /dev/null
+++ b/chapter7/texinfo.sh
@@ -0,0 +1,3 @@
+./configure --prefix=/usr &&
+make &&
+make -j1 install
diff --git a/chapter7/util-linux.sh b/chapter7/util-linux.sh
new file mode 100644
index 0000000..170e3f5
--- /dev/null
+++ b/chapter7/util-linux.sh
@@ -0,0 +1,15 @@
+mkdir -p /var/lib/hwclock &&
+./configure ADJTIME_PATH=/var/lib/hwclock/adjtime    \
+            --docdir=/usr/share/doc/util-linux-2.36.2 \
+            --disable-chfn-chsh \
+            --disable-login \
+            --disable-nologin \
+            --disable-su \
+            --disable-setpriv \
+            --disable-runuser \
+            --disable-pylibmount \
+            --disable-static \
+            --without-python \
+            runstatedir=/run &&
+make &&
+make -j1 install
diff --git a/insidechroot.sh b/insidechroot.sh
index 3c262e9..529fb1e 100644
--- a/insidechroot.sh
+++ b/insidechroot.sh
@@ -1,5 +1,156 @@
 #!/bin/bash
 
 source /sources/colors.sh
+source /sources/spinner.sh
 
-echo -e "${GRN}Successfully entered ${RED}CHROOT${RST}!"
+echo -e "${GRN}Successfully entered ${RED}CHROOT${RST}!\n"
+
+echo -e "${GRN}Creating directories...${RST}"
+if [ -f /sources/createdirs ]; then
+	echo -e "${GRN}  Directories already created.${RST}"
+else
+	mkdir -p /boot
+	mkdir -p /home
+	mkdir -p /mnt
+	mkdir -p /opt
+	mkdir -p /srv
+
+	mkdir -p /etc/opt
+	mkdir -p /etc/opt/sysconfig
+	mkdir -p /lib/firmware
+	mkdir -p /media/floppy
+	mkdir -p /media/cdrom
+	mkdir -p /usr/bin
+	mkdir -p /usr/include
+	mkdir -p /usr/lib
+	mkdir -p /usr/sbin
+	mkdir -p /usr/src
+	mkdir -p /usr/local/bin
+	mkdir -p /usr/local/include
+	mkdir -p /usr/local/lib
+	mkdir -p /usr/local/sbin
+	mkdir -p /usr/local/src
+	mkdir -p /usr/share/color
+	mkdir -p /usr/share/dict
+	mkdir -p /usr/share/doc
+	mkdir -p /usr/share/info
+	mkdir -p /usr/share/locale
+	mkdir -p /usr/share/man
+	mkdir -p /usr/share/man/man1
+	mkdir -p /usr/share/man/man2
+	mkdir -p /usr/share/man/man3
+	mkdir -p /usr/share/man/man4
+	mkdir -p /usr/share/man/man5
+	mkdir -p /usr/share/man/man6
+	mkdir -p /usr/share/man/man7
+	mkdir -p /usr/share/man/man8
+	mkdir -p /usr/share/misc
+	mkdir -p /usr/share/terminfo
+	mkdir -p /usr/share/zoneinfo
+	mkdir -p /usr/local/share/color
+	mkdir -p /usr/local/share/dict
+	mkdir -p /usr/local/share/doc
+	mkdir -p /usr/local/share/info
+	mkdir -p /usr/local/share/locale
+	mkdir -p /usr/local/share/man
+	mkdir -p /usr/local/share/man/man1
+	mkdir -p /usr/local/share/man/man2
+	mkdir -p /usr/local/share/man/man3
+	mkdir -p /usr/local/share/man/man4
+	mkdir -p /usr/local/share/man/man5
+	mkdir -p /usr/local/share/man/man6
+	mkdir -p /usr/local/share/man/man7
+	mkdir -p /usr/local/share/man/man8
+	mkdir -p /usr/local/share/misc
+	mkdir -p /usr/local/share/terminfo
+	mkdir -p /usr/local/share/zoneinfo
+	mkdir -p /var/cache
+	mkdir -p /var/local
+	mkdir -p /var/log
+	mkdir -p /var/mail
+	mkdir -p /var/opt
+	mkdir -p /var/spool
+	mkdir -p /var/lib/color
+	mkdir -p /var/lib/misc
+	mkdir -p /var/lib/locate
+
+	ln -sf /run /var/run
+	ln -sf /run/lock /var/lock
+
+	install -d -m 0750 /root
+	install -d -m 1777 /tmp /var/tmp
+
+	echo -e "  ${GRN}Directories created${RST}"
+	touch /sources/createdirs
+fi
+
+echo -e "${GRN}Creating essential files and symbolic links... ${RST}"
+if [ -f "/sources/symfiles" ]; then
+	echo -e "  ${GRN}Files and symbolic links already created.${RST}"
+else
+	ln -sf /proc/self/mounts /etc/mtab
+	echo "127.0.0.1 localhost $(hostname)" > /etc/hosts
+
+	cat > /etc/passwd << "EOF"
+root:x:0:0:root:/root:/bin/bash
+bin:x:1:1:bin:/dev/null:/bin/false
+daemon:x:6:6:Daemon User:/dev/null:/bin/false
+messagebus:x:18:18:D-Bus Message Daemon User:/run/dbus:/bin/false
+uuidd:x:80:80:UUID Generation Daemon User:/dev/null:/bin/false
+nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
+EOF
+
+	cat > /etc/group << "EOF"
+root:x:0:
+bin:x:1:daemon
+sys:x:2:
+kmem:x:3:
+tape:x:4:
+tty:x:5:
+daemon:x:6:
+floppy:x:7:
+disk:x:8:
+lp:x:9:
+dialout:x:10:
+audio:x:11:
+video:x:12:
+utmp:x:13:
+usb:x:14:
+cdrom:x:15:
+adm:x:16:
+messagebus:x:18:
+input:x:24:
+mail:x:34:
+kvm:x:61:
+uuidd:x:80:
+wheel:x:97:
+nogroup:x:99:
+users:x:999:
+EOF
+
+	echo "tester:x:$(ls -n $(tty) | cut -d" " -f3):101::/home/tester:/bin/bash" >> /etc/passwd
+	echo "tester:x:101:" >> /etc/group
+	install -o tester -d /home/tester
+
+	touch /var/log/btmp
+	touch /var/log/lastlog
+	touch /var/log/faillog
+	touch /var/log/tmp
+	chgrp utmp /var/log/lastlog
+	chmod 664  /var/log/lastlog
+	chmod 600  /var/log/btmp
+
+	echo -e "  ${GRN}Files and symlinks created.${RST}"
+	touch /sources/symfiles
+fi
+
+cd /sources
+
+# Chapter 7
+for package in libstdc++ gettext bison perl python texinfo util-linux; do
+	source packageinstall.sh 7 $package
+    retval=$?
+    if [ "$retval" -ne 0 ]; then
+        exit 1
+    fi
+done
-- 
cgit v1.2.3-54-g00ecf


From b738a9419e20009e9eede93974c35e47b6f847e8 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Tue, 23 Mar 2021 14:14:56 -0500
Subject: Use printf and do some minor cleanup.

---
 insidechroot.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/insidechroot.sh b/insidechroot.sh
index 529fb1e..7cbee29 100644
--- a/insidechroot.sh
+++ b/insidechroot.sh
@@ -3,11 +3,11 @@
 source /sources/colors.sh
 source /sources/spinner.sh
 
-echo -e "${GRN}Successfully entered ${RED}CHROOT${RST}!\n"
+printf "%b" "${GRN}Successfully entered ${RED}CHROOT${RST}!\n"
 
-echo -e "${GRN}Creating directories...${RST}"
+printf "%b" "${GRN}Creating directories...${RST}\n"
 if [ -f /sources/createdirs ]; then
-	echo -e "${GRN}  Directories already created.${RST}"
+	printf "%b" "${GRN}  Directories already created.${RST}\n"
 else
 	mkdir -p /boot
 	mkdir -p /home
@@ -80,13 +80,13 @@ else
 	install -d -m 0750 /root
 	install -d -m 1777 /tmp /var/tmp
 
-	echo -e "  ${GRN}Directories created${RST}"
+	printf "%b" "  ${GRN}Directories created${RST}\n"
 	touch /sources/createdirs
 fi
 
-echo -e "${GRN}Creating essential files and symbolic links... ${RST}"
+printf "%b" "${GRN}Creating essential files and symbolic links... ${RST}\n"
 if [ -f "/sources/symfiles" ]; then
-	echo -e "  ${GRN}Files and symbolic links already created.${RST}"
+	printf "%b" "  ${GRN}Files and symbolic links already created.${RST}\n"
 else
 	ln -sf /proc/self/mounts /etc/mtab
 	echo "127.0.0.1 localhost $(hostname)" > /etc/hosts
@@ -128,7 +128,7 @@ nogroup:x:99:
 users:x:999:
 EOF
 
-	echo "tester:x:$(ls -n $(tty) | cut -d" " -f3):101::/home/tester:/bin/bash" >> /etc/passwd
+	echo "tester:x:$(ls -n "$(tty)" | cut -d" " -f3):101::/home/tester:/bin/bash" >> /etc/passwd
 	echo "tester:x:101:" >> /etc/group
 	install -o tester -d /home/tester
 
@@ -144,7 +144,7 @@ EOF
 	touch /sources/symfiles
 fi
 
-cd /sources
+cd /sources || exit 1
 
 # Chapter 7
 for package in libstdc++ gettext bison perl python texinfo util-linux; do
-- 
cgit v1.2.3-54-g00ecf


From fb88c0e7e323a761054e5fa95befc87dcefa4564 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Tue, 23 Mar 2021 15:22:53 -0500
Subject: Change message when entering CHROOT.

---
 insidechroot.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/insidechroot.sh b/insidechroot.sh
index 7cbee29..784a40e 100644
--- a/insidechroot.sh
+++ b/insidechroot.sh
@@ -3,7 +3,7 @@
 source /sources/colors.sh
 source /sources/spinner.sh
 
-printf "%b" "${GRN}Successfully entered ${RED}CHROOT${RST}!\n"
+printf "%b" "${CYN}SUCCESSFULLY ENTERED ${RED}CHROOT${RST}!\n"
 
 printf "%b" "${GRN}Creating directories...${RST}\n"
 if [ -f /sources/createdirs ]; then
-- 
cgit v1.2.3-54-g00ecf


From 933166af85d74989308aeda39361f16785bb4c3f Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Wed, 24 Mar 2021 09:46:25 -0500
Subject: Adjust indention.

---
 chapter6/backup.sh | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/chapter6/backup.sh b/chapter6/backup.sh
index 6ffe768..0f77869 100644
--- a/chapter6/backup.sh
+++ b/chapter6/backup.sh
@@ -9,16 +9,16 @@ else
 
 	echo -ne "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${FILE}${RST}... "
 	pushd "${LFS}" > /dev/null || exit 1
-	sudo XZ_OPTS="-T${NUMPROCS} -e" tar cJpf "${HOME}"/"${FILE}" "${DIRS[@]}" & pid=$!
-	  spinner "$pid"
-	  retval=$?
-	  if [ "$retval" -ne 0 ]; then
-		  echo -e "${RED}Backup FAILED!${RST}"
-		  exit 1
-	  else
-		  sudo chown "${USER}" /home/"${USER}"/"${FILE}"
-		  echo -e "${GRN}OK${RST}"
-	  fi
+		sudo XZ_OPTS="-T${NUMPROCS} -e" tar cJpf "${HOME}"/"${FILE}" "${DIRS[@]}" & pid=$!
+		spinner "$pid"
+		retval=$?
+		if [ "$retval" -ne 0 ]; then
+			echo -e "${RED}Backup FAILED!${RST}"
+			exit 1
+		else
+			sudo chown "${USER}" /home/"${USER}"/"${FILE}"
+			echo -e "${GRN}OK${RST}"
+		fi
 	popd > /dev/null || exit 1
 
 	touch "${LFS}/sources/chapter6/backup"
-- 
cgit v1.2.3-54-g00ecf


From 483f5b37f796bf217572768f241081ffc9a19cd8 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Wed, 24 Mar 2021 09:49:07 -0500
Subject: Adjust from chapter6 back for chapter7  backup. Add additional
 directories.

---
 chapter7/backup.sh | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 chapter7/backup.sh

diff --git a/chapter7/backup.sh b/chapter7/backup.sh
new file mode 100644
index 0000000..a32aeb4
--- /dev/null
+++ b/chapter7/backup.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+FILE="${LFS_VER}-ch7-backup.tar.xz"
+DIRS=(bin dev etc lib lib64 proc run sbin sources sys tools usr var)
+
+if [ -f "${LFS}/sources/chapter7/backup" ]; then
+	echo -e "${GRN}Backup found. Remove manually to backup again.${RST}"
+else
+
+	echo -ne "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${FILE}${RST}... "
+	pushd "${LFS}" > /dev/null || exit 1
+		sudo XZ_OPTS="-T${NUMPROCS} -e" tar cJpf "${HOME}"/"${FILE}" "${DIRS[@]}" & pid=$!
+		spinner "$pid"
+		retval=$?
+		if [ "$retval" -ne 0 ]; then
+			echo -e "${RED}Backup FAILED!${RST}"
+		else
+			sudo chown "${USER}" /home/"${USER}"/"${FILE}"
+			echo -e "${GRN}OK${RST}"
+		fi
+	popd > /dev/null || exit 1
+
+	touch "${LFS}/sources/chapter7/backup"
+fi
+
-- 
cgit v1.2.3-54-g00ecf


From d2610e90370dd558d1e7c870e312557eb988ae28 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Wed, 24 Mar 2021 11:04:53 -0500
Subject: Adjust some text and use printf.

---
 chapter6/backup.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/chapter6/backup.sh b/chapter6/backup.sh
index 0f77869..842ed27 100644
--- a/chapter6/backup.sh
+++ b/chapter6/backup.sh
@@ -4,7 +4,7 @@ FILE="${LFS_VER}-ch6-backup.tar.xz"
 DIRS=(bin etc lib lib64 sbin tools usr var)
 
 if [ -f "${LFS}/sources/chapter6/backup" ]; then
-	echo -e "${GRN}Backup found. Remove manually to backup again.${RST}"
+	printf "%b" "${YLW}Chapter 6 ${GRN}Backup found. Remove manually to backup again.${RST}"
 else
 
 	echo -ne "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${FILE}${RST}... "
@@ -13,11 +13,11 @@ else
 		spinner "$pid"
 		retval=$?
 		if [ "$retval" -ne 0 ]; then
-			echo -e "${RED}Backup FAILED!${RST}"
+			printf "%b" "${RED}Backup FAILED!${RST}\n"
 			exit 1
 		else
 			sudo chown "${USER}" /home/"${USER}"/"${FILE}"
-			echo -e "${GRN}OK${RST}"
+			printf "%b" "${GRN}OK${RST}\n"
 		fi
 	popd > /dev/null || exit 1
 
-- 
cgit v1.2.3-54-g00ecf


From 3d764cd1e8f5f8efe6eb4f32f67867daa2def2e9 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Wed, 24 Mar 2021 11:06:04 -0500
Subject: Extract virt fs mount commands to a separate script.

---
 mountvirtfs.sh   | 32 ++++++++++++++++++++++++++++++++
 preparechroot.sh | 36 +++++++-----------------------------
 2 files changed, 39 insertions(+), 29 deletions(-)
 create mode 100644 mountvirtfs.sh

diff --git a/mountvirtfs.sh b/mountvirtfs.sh
new file mode 100644
index 0000000..7eea548
--- /dev/null
+++ b/mountvirtfs.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+printf "%b" "${GRN}Mounting virtual kernel filesystems...${RST}\n"
+if ! mountpoint "${LFS}"/dev >/dev/null 2>&1; then
+	sudo mount -v --bind /dev "${LFS}"/dev
+else
+	printf "%b" "  ${YLW}${LFS}/dev${GRN} is already mounted${RST}\n"
+fi
+if ! mountpoint "${LFS}"/dev/pts >/dev/null 2>&1; then
+	sudo mount -v --bind /dev/pts "${LFS}"/dev/pts
+else
+	printf "%b" "  ${YLW}${LFS}/dev/pts${GRN} is already mounted${RST}\n"
+fi
+if ! mountpoint "${LFS}"/proc >/dev/null 2>&1; then
+	sudo mount -v --bind /proc "${LFS}"/proc
+else
+	printf "%b" "  ${YLW}${LFS}/proc${GRN} is already mounted${RST}\n"
+fi
+if ! mountpoint "${LFS}"/sys >/dev/null 2>&1; then
+	sudo mount -v --bind /sys "${LFS}"/sys
+else
+	printf "%b" "  ${YLW}${LFS}/sys${GRN} is already mounted${RST}\n"
+fi
+if ! mountpoint "${LFS}"/run >/dev/null 2>&1; then
+	sudo mount -v --bind /run "${LFS}"/run
+else
+	printf "%b" "  ${YLW}${LFS}/run${GRN} is already mounted${RST}\n"
+fi
+
+if [ -h "${LFS}"/dev/shm ]; then
+	sudo mkdir -pv "${LFS}"/"$(readlink "${LFS}"/dev/shm)"
+fi
diff --git a/preparechroot.sh b/preparechroot.sh
index b460175..1d05e72 100644
--- a/preparechroot.sh
+++ b/preparechroot.sh
@@ -4,6 +4,11 @@ source colors.sh
 
 export LFS="$1"
 
+if [ -f chrootprepared ]; then
+	printf "%b" "${RED}CHROOT ${GRN}already prepared...\n${RST}"
+	exit 0
+fi
+
 if [ -z "${LFS}" ]; then
 	printf "%b" "${RED}Require first argument as path to LFS build!${RST}\n"
 	exit 1
@@ -33,36 +38,9 @@ if [ "${USER}" == "root" ]; then
 	mknod -m 600 "${LFS}"/dev/console c 5 1 >/dev/null 2>&1
 	mknod -m 666 "${LFS}"/dev/null c 1 3 >/dev/null 2>&1
 	
-	printf "%b" "${GRN}Mounting virtual kernel filesystems...${RST}\n"
-	if ! mountpoint "${LFS}"/dev >/dev/null 2>&1; then
-		mount -v --bind /dev "${LFS}"/dev
-	else
-		printf "%b" "  ${YLW}${LFS}/dev${GRN} is already mounted${RST}\n"
-	fi
-	if ! mountpoint "${LFS}"/dev/pts >/dev/null 2>&1; then
-		mount -v --bind /dev/pts "${LFS}"/dev/pts
-	else
-		printf "%b" "  ${YLW}${LFS}/dev/pts${GRN} is already mounted${RST}\n"
-	fi
-	if ! mountpoint "${LFS}"/proc >/dev/null 2>&1; then
-		mount -v --bind /proc "${LFS}"/proc
-	else
-		printf "%b" "  ${YLW}${LFS}/proc${GRN} is already mounted${RST}\n"
-	fi
-	if ! mountpoint "${LFS}"/sys >/dev/null 2>&1; then
-		mount -v --bind /sys "${LFS}"/sys
-	else
-		printf "%b" "  ${YLW}${LFS}/sys${GRN} is already mounted${RST}\n"
-	fi
-	if ! mountpoint "${LFS}"/run >/dev/null 2>&1; then
-		mount -v --bind /run "${LFS}"/run
-	else
-		printf "%b" "  ${YLW}${LFS}/run${GRN} is already mounted${RST}\n"
-	fi
+	source mountvirtfs.sh
 
-	if [ -h "${LFS}"/dev/shm ]; then
-		mkdir -pv "${LFS}"/"$(readlink "${LFS}"/dev/shm)"
-	fi
+	touch chrootprepared
 
 else
 	printf "%b" "${RED}preparechroot.sh must be ran as ${YLW}root${RED} user!${RST}\n"
-- 
cgit v1.2.3-54-g00ecf


From 3c627ee8dd4f714b402b19eb577313951147a91d Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Wed, 24 Mar 2021 11:07:41 -0500
Subject: Adjust backup script for chapter 7

---
 chapter7/backup.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/chapter7/backup.sh b/chapter7/backup.sh
index a32aeb4..71ad3a0 100644
--- a/chapter7/backup.sh
+++ b/chapter7/backup.sh
@@ -4,7 +4,7 @@ FILE="${LFS_VER}-ch7-backup.tar.xz"
 DIRS=(bin dev etc lib lib64 proc run sbin sources sys tools usr var)
 
 if [ -f "${LFS}/sources/chapter7/backup" ]; then
-	echo -e "${GRN}Backup found. Remove manually to backup again.${RST}"
+	echo -e "${YLW}Chapter 7 ${GRN}Backup found. Remove manually to backup again.${RST}"
 else
 
 	echo -ne "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${FILE}${RST}... "
@@ -15,7 +15,6 @@ else
 		if [ "$retval" -ne 0 ]; then
 			echo -e "${RED}Backup FAILED!${RST}"
 		else
-			sudo chown "${USER}" /home/"${USER}"/"${FILE}"
 			echo -e "${GRN}OK${RST}"
 		fi
 	popd > /dev/null || exit 1
-- 
cgit v1.2.3-54-g00ecf


From 48c0449eca92fdfb2ebb980fef779642effc28cd Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Wed, 24 Mar 2021 11:08:02 -0500
Subject: Add clean up script for chapter 7

---
 chapter7/cleanup.sh | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 chapter7/cleanup.sh

diff --git a/chapter7/cleanup.sh b/chapter7/cleanup.sh
new file mode 100644
index 0000000..b300e7e
--- /dev/null
+++ b/chapter7/cleanup.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+if [ -f "${LFS}/sources/chapter7/cleanup" ]; then
+	echo -e "${YLW}Chapter 7 ${GRN}cleanup already performed.${RST}"
+else
+
+	echo -ne "${GRN}Cleaning up ${YLW}${LFS}${RST}... "
+
+	sudo find "${LFS}"/usr/lib -name \*.la -delete >/dev/null 2>&1
+	sudo find "${LFS}"/usr/libexec -name \*.la -delete >/dev/null 2>&1
+
+	sudo rm -rf "${LFS}"/usr/share/doc >/dev/null 2>&1
+	sudo rm -rf "${LFS}"/usr/share/info >/dev/null 2>&1
+	sudo rm -rf "${LFS}"/usr/share/man >/dev/null 2>&1
+
+	sudo strip --strip-debug "${LFS}"/usr/lib/* >/dev/null 2>&1
+	sudo strip --strip-unneeded "${LFS}"/usr/bin/* >/dev/null 2>&1
+	sudo strip --strip-unneeded "${LFS}"/usr/sbin/* >/dev/null 2>&1
+	sudo strip --strip-unneeded "${LFS}"/tools/bin/* >/dev/null 2>&1
+
+	echo -e "${GRN}OK${RST}"
+	touch "${LFS}"/sources/chapter7/cleanup >/dev/null 2>&1
+fi
-- 
cgit v1.2.3-54-g00ecf


From 4e2baae45edab2b18b29f0732ac46ca56bf9e96b Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Wed, 24 Mar 2021 11:09:13 -0500
Subject: Call inside root with an argument. 7 for chapter 7. Chapter 7
 commands exit with status 7.

---
 insidechroot.sh | 225 +++++++++++++++++++++++++++++---------------------------
 1 file changed, 117 insertions(+), 108 deletions(-)

diff --git a/insidechroot.sh b/insidechroot.sh
index 784a40e..1863531 100644
--- a/insidechroot.sh
+++ b/insidechroot.sh
@@ -1,97 +1,100 @@
 #!/bin/bash
 
+CHAPTER="$1"
+
 source /sources/colors.sh
 source /sources/spinner.sh
 
 printf "%b" "${CYN}SUCCESSFULLY ENTERED ${RED}CHROOT${RST}!\n"
 
-printf "%b" "${GRN}Creating directories...${RST}\n"
-if [ -f /sources/createdirs ]; then
-	printf "%b" "${GRN}  Directories already created.${RST}\n"
-else
-	mkdir -p /boot
-	mkdir -p /home
-	mkdir -p /mnt
-	mkdir -p /opt
-	mkdir -p /srv
-
-	mkdir -p /etc/opt
-	mkdir -p /etc/opt/sysconfig
-	mkdir -p /lib/firmware
-	mkdir -p /media/floppy
-	mkdir -p /media/cdrom
-	mkdir -p /usr/bin
-	mkdir -p /usr/include
-	mkdir -p /usr/lib
-	mkdir -p /usr/sbin
-	mkdir -p /usr/src
-	mkdir -p /usr/local/bin
-	mkdir -p /usr/local/include
-	mkdir -p /usr/local/lib
-	mkdir -p /usr/local/sbin
-	mkdir -p /usr/local/src
-	mkdir -p /usr/share/color
-	mkdir -p /usr/share/dict
-	mkdir -p /usr/share/doc
-	mkdir -p /usr/share/info
-	mkdir -p /usr/share/locale
-	mkdir -p /usr/share/man
-	mkdir -p /usr/share/man/man1
-	mkdir -p /usr/share/man/man2
-	mkdir -p /usr/share/man/man3
-	mkdir -p /usr/share/man/man4
-	mkdir -p /usr/share/man/man5
-	mkdir -p /usr/share/man/man6
-	mkdir -p /usr/share/man/man7
-	mkdir -p /usr/share/man/man8
-	mkdir -p /usr/share/misc
-	mkdir -p /usr/share/terminfo
-	mkdir -p /usr/share/zoneinfo
-	mkdir -p /usr/local/share/color
-	mkdir -p /usr/local/share/dict
-	mkdir -p /usr/local/share/doc
-	mkdir -p /usr/local/share/info
-	mkdir -p /usr/local/share/locale
-	mkdir -p /usr/local/share/man
-	mkdir -p /usr/local/share/man/man1
-	mkdir -p /usr/local/share/man/man2
-	mkdir -p /usr/local/share/man/man3
-	mkdir -p /usr/local/share/man/man4
-	mkdir -p /usr/local/share/man/man5
-	mkdir -p /usr/local/share/man/man6
-	mkdir -p /usr/local/share/man/man7
-	mkdir -p /usr/local/share/man/man8
-	mkdir -p /usr/local/share/misc
-	mkdir -p /usr/local/share/terminfo
-	mkdir -p /usr/local/share/zoneinfo
-	mkdir -p /var/cache
-	mkdir -p /var/local
-	mkdir -p /var/log
-	mkdir -p /var/mail
-	mkdir -p /var/opt
-	mkdir -p /var/spool
-	mkdir -p /var/lib/color
-	mkdir -p /var/lib/misc
-	mkdir -p /var/lib/locate
-
-	ln -sf /run /var/run
-	ln -sf /run/lock /var/lock
-
-	install -d -m 0750 /root
-	install -d -m 1777 /tmp /var/tmp
-
-	printf "%b" "  ${GRN}Directories created${RST}\n"
-	touch /sources/createdirs
-fi
+if [ "${CHAPTER}" -eq 7 ]; then
+	printf "%b" "${GRN}Creating directories...${RST}\n"
+	if [ -f /sources/createdirs ]; then
+		printf "%b" "${GRN}  Directories already created.${RST}\n"
+	else
+		mkdir -p /boot
+		mkdir -p /home
+		mkdir -p /mnt
+		mkdir -p /opt
+		mkdir -p /srv
 
-printf "%b" "${GRN}Creating essential files and symbolic links... ${RST}\n"
-if [ -f "/sources/symfiles" ]; then
-	printf "%b" "  ${GRN}Files and symbolic links already created.${RST}\n"
-else
-	ln -sf /proc/self/mounts /etc/mtab
-	echo "127.0.0.1 localhost $(hostname)" > /etc/hosts
+		mkdir -p /etc/opt
+		mkdir -p /etc/opt/sysconfig
+		mkdir -p /lib/firmware
+		mkdir -p /media/floppy
+		mkdir -p /media/cdrom
+		mkdir -p /usr/bin
+		mkdir -p /usr/include
+		mkdir -p /usr/lib
+		mkdir -p /usr/sbin
+		mkdir -p /usr/src
+		mkdir -p /usr/local/bin
+		mkdir -p /usr/local/include
+		mkdir -p /usr/local/lib
+		mkdir -p /usr/local/sbin
+		mkdir -p /usr/local/src
+		mkdir -p /usr/share/color
+		mkdir -p /usr/share/dict
+		mkdir -p /usr/share/doc
+		mkdir -p /usr/share/info
+		mkdir -p /usr/share/locale
+		mkdir -p /usr/share/man
+		mkdir -p /usr/share/man/man1
+		mkdir -p /usr/share/man/man2
+		mkdir -p /usr/share/man/man3
+		mkdir -p /usr/share/man/man4
+		mkdir -p /usr/share/man/man5
+		mkdir -p /usr/share/man/man6
+		mkdir -p /usr/share/man/man7
+		mkdir -p /usr/share/man/man8
+		mkdir -p /usr/share/misc
+		mkdir -p /usr/share/terminfo
+		mkdir -p /usr/share/zoneinfo
+		mkdir -p /usr/local/share/color
+		mkdir -p /usr/local/share/dict
+		mkdir -p /usr/local/share/doc
+		mkdir -p /usr/local/share/info
+		mkdir -p /usr/local/share/locale
+		mkdir -p /usr/local/share/man
+		mkdir -p /usr/local/share/man/man1
+		mkdir -p /usr/local/share/man/man2
+		mkdir -p /usr/local/share/man/man3
+		mkdir -p /usr/local/share/man/man4
+		mkdir -p /usr/local/share/man/man5
+		mkdir -p /usr/local/share/man/man6
+		mkdir -p /usr/local/share/man/man7
+		mkdir -p /usr/local/share/man/man8
+		mkdir -p /usr/local/share/misc
+		mkdir -p /usr/local/share/terminfo
+		mkdir -p /usr/local/share/zoneinfo
+		mkdir -p /var/cache
+		mkdir -p /var/local
+		mkdir -p /var/log
+		mkdir -p /var/mail
+		mkdir -p /var/opt
+		mkdir -p /var/spool
+		mkdir -p /var/lib/color
+		mkdir -p /var/lib/misc
+		mkdir -p /var/lib/locate
+
+		ln -sf /run /var/run
+		ln -sf /run/lock /var/lock
+
+		install -d -m 0750 /root
+		install -d -m 1777 /tmp /var/tmp
+
+		printf "%b" "  ${GRN}Directories created${RST}\n"
+		touch /sources/createdirs
+	fi
 
-	cat > /etc/passwd << "EOF"
+	printf "%b" "${GRN}Creating essential files and symbolic links... ${RST}\n"
+	if [ -f "/sources/symfiles" ]; then
+		printf "%b" "  ${GRN}Files and symbolic links already created.${RST}\n"
+	else
+		ln -sf /proc/self/mounts /etc/mtab
+		echo "127.0.0.1 localhost $(hostname)" > /etc/hosts
+
+		cat > /etc/passwd << "EOF"
 root:x:0:0:root:/root:/bin/bash
 bin:x:1:1:bin:/dev/null:/bin/false
 daemon:x:6:6:Daemon User:/dev/null:/bin/false
@@ -100,7 +103,7 @@ uuidd:x:80:80:UUID Generation Daemon User:/dev/null:/bin/false
 nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
 EOF
 
-	cat > /etc/group << "EOF"
+		cat > /etc/group << "EOF"
 root:x:0:
 bin:x:1:daemon
 sys:x:2:
@@ -128,29 +131,35 @@ nogroup:x:99:
 users:x:999:
 EOF
 
-	echo "tester:x:$(ls -n "$(tty)" | cut -d" " -f3):101::/home/tester:/bin/bash" >> /etc/passwd
-	echo "tester:x:101:" >> /etc/group
-	install -o tester -d /home/tester
+		echo "tester:x:$(ls -n "$(tty)" | cut -d" " -f3):101::/home/tester:/bin/bash" >> /etc/passwd
+		echo "tester:x:101:" >> /etc/group
+		install -o tester -d /home/tester
 
-	touch /var/log/btmp
-	touch /var/log/lastlog
-	touch /var/log/faillog
-	touch /var/log/tmp
-	chgrp utmp /var/log/lastlog
-	chmod 664  /var/log/lastlog
-	chmod 600  /var/log/btmp
+		touch /var/log/btmp
+		touch /var/log/lastlog
+		touch /var/log/faillog
+		touch /var/log/tmp
+		chgrp utmp /var/log/lastlog
+		chmod 664  /var/log/lastlog
+		chmod 600  /var/log/btmp
 
-	echo -e "  ${GRN}Files and symlinks created.${RST}"
-	touch /sources/symfiles
-fi
+		echo -e "  ${GRN}Files and symlinks created.${RST}"
+		touch /sources/symfiles
+	fi
+
+	cd /sources || exit 1
 
-cd /sources || exit 1
+	# Chapter 7
+	for package in libstdc++ gettext bison perl python texinfo util-linux; do
+		source packageinstall.sh 7 $package
+		retval=$?
+		if [ "$retval" -ne 0 ]; then
+			exit 1
+		fi
+	done
+
+	exit 7
+else
+	printf "%b" "Do Chapter 8, 9 and 10 stuff here.\n"
+fi
 
-# Chapter 7
-for package in libstdc++ gettext bison perl python texinfo util-linux; do
-	source packageinstall.sh 7 $package
-    retval=$?
-    if [ "$retval" -ne 0 ]; then
-        exit 1
-    fi
-done
-- 
cgit v1.2.3-54-g00ecf


From fa43dec5de9704ebf4b33aa079e636a5b4463a87 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Wed, 24 Mar 2021 11:10:04 -0500
Subject: Adjust CHROOT printf's and add chapter 7 blocks.

---
 lfs.sh | 41 ++++++++++++++++++++++++++++++++++++-----
 1 file changed, 36 insertions(+), 5 deletions(-)

diff --git a/lfs.sh b/lfs.sh
index c154c19..84da9b6 100755
--- a/lfs.sh
+++ b/lfs.sh
@@ -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"
-- 
cgit v1.2.3-54-g00ecf


From 64dc5f16ece5051bf4c2aa74cfeeff8172d71ed0 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Wed, 24 Mar 2021 11:20:20 -0500
Subject: Use HOME variable when changing ownership of backup archive.

---
 chapter6/backup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chapter6/backup.sh b/chapter6/backup.sh
index 842ed27..c763d8c 100644
--- a/chapter6/backup.sh
+++ b/chapter6/backup.sh
@@ -16,7 +16,7 @@ else
 			printf "%b" "${RED}Backup FAILED!${RST}\n"
 			exit 1
 		else
-			sudo chown "${USER}" /home/"${USER}"/"${FILE}"
+			sudo chown "${USER}" "${HOME}"/"${FILE}"
 			printf "%b" "${GRN}OK${RST}\n"
 		fi
 	popd > /dev/null || exit 1
-- 
cgit v1.2.3-54-g00ecf


From a77136fab286d5c6f44132c310e223ebbcee8540 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Wed, 24 Mar 2021 11:26:06 -0500
Subject: Add some comments.

---
 lfs.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lfs.sh b/lfs.sh
index 84da9b6..991e7fe 100755
--- a/lfs.sh
+++ b/lfs.sh
@@ -136,8 +136,10 @@ else
 	exit "$retval"
 fi
 
+# Mount virtual kernel filesystems after cleanup and backup
 source mountvirtfs.sh
 
+# Enter CHROOT for chapter 8, 9 and 10
 sudo chroot "${LFS}" /usr/bin/env \
 	HOME=/root \
 	TERM="${TERM}" \
-- 
cgit v1.2.3-54-g00ecf


From 5ac98c46ca6b78745bb3a9dd59d60f83f776feda Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Wed, 24 Mar 2021 11:28:18 -0500
Subject: Fix indentation.

---
 download.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/download.sh b/download.sh
index 9446d82..3726b84 100644
--- a/download.sh
+++ b/download.sh
@@ -26,7 +26,7 @@ cat packages.csv patches.csv | while read -r line; do
         printf "%b" "${PRP}Downloading ${YLW}${CACHEFILE}${RST}... "
 	#wget -nc ${URL} -O ${LFS}/sources/${CACHEFILE} --progress=dot -q --show-progress 2>&1 | awk 'NF>2 && $(NF-2) ~ /%/{printf "\r \t\t\t\t\t\t%s",$(NF-2)} END{print "\r    "}'
 	download "${URL}"
-	if ! echo "${MD5SUM} ${LFS}/sources/${CACHEFILE}" | md5sum -c > /dev/null 2>&1; then
+		if ! echo "${MD5SUM} ${LFS}/sources/${CACHEFILE}" | md5sum -c > /dev/null 2>&1; then
             rm -f "${LFS}/sources/${CACHEFILE}"
             printf "%b" "\n${GRN}Verification of ${YLW}${CACHEFILE} ${RED}failed! MD5 mismatch!${RST}\n"
             exit 1
-- 
cgit v1.2.3-54-g00ecf


From 083c06ea231f56982a64fc81f445464119968411 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Wed, 24 Mar 2021 11:36:26 -0500
Subject: Adjust indention again.

---
 download.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/download.sh b/download.sh
index 3726b84..d816394 100644
--- a/download.sh
+++ b/download.sh
@@ -25,7 +25,7 @@ cat packages.csv patches.csv | while read -r line; do
 
         printf "%b" "${PRP}Downloading ${YLW}${CACHEFILE}${RST}... "
 	#wget -nc ${URL} -O ${LFS}/sources/${CACHEFILE} --progress=dot -q --show-progress 2>&1 | awk 'NF>2 && $(NF-2) ~ /%/{printf "\r \t\t\t\t\t\t%s",$(NF-2)} END{print "\r    "}'
-	download "${URL}"
+		download "${URL}"
 		if ! echo "${MD5SUM} ${LFS}/sources/${CACHEFILE}" | md5sum -c > /dev/null 2>&1; then
             rm -f "${LFS}/sources/${CACHEFILE}"
             printf "%b" "\n${GRN}Verification of ${YLW}${CACHEFILE} ${RED}failed! MD5 mismatch!${RST}\n"
-- 
cgit v1.2.3-54-g00ecf


From 3129e0fd3f2928862974902fb06e7258ec122b5e Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Wed, 24 Mar 2021 13:02:10 -0500
Subject: Make Building message when first starting the build to have the
 target LFS location and target disk/partition as high intensity white.

---
 lfs.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lfs.sh b/lfs.sh
index 991e7fe..145faeb 100755
--- a/lfs.sh
+++ b/lfs.sh
@@ -18,7 +18,7 @@ source spinner.sh
 #source versioncheck.sh
 
 printf "%b" "\n\n\n${CYN}BUILDING ${YLW}${LFS_VER} $(uname -m)${CYN} at \
-${PRP}${LFS}${CYN} on ${PRP}${LFS_DISK}${LFS_PART}${RST}\n\n\n"
+${IWHT}${LFS}${CYN} on ${IWHT}${LFS_DISK}${LFS_PART}${RST}\n\n\n"
 
 # Continue or Abort
 printf "%b" "${IGRN}CONTINUE ${IWHTB}(C)${RST} / ${IRED}ABORT ${IWHTB}(OTHER)${RST}\n"
-- 
cgit v1.2.3-54-g00ecf


From 26ea60dac803ce9526f7f73dbd2866b06680d5d7 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 25 Mar 2021 11:17:41 -0500
Subject: Change case of FILE to lower case file and rename DIRS to
 directories.

---
 chapter7/backup.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/chapter7/backup.sh b/chapter7/backup.sh
index 71ad3a0..8cba32d 100644
--- a/chapter7/backup.sh
+++ b/chapter7/backup.sh
@@ -1,15 +1,15 @@
 #!/bin/bash
 
-FILE="${LFS_VER}-ch7-backup.tar.xz"
-DIRS=(bin dev etc lib lib64 proc run sbin sources sys tools usr var)
+file="${LFS_VER}-ch7-backup.tar.xz"
+directories=(bin dev etc lib lib64 proc run sbin sources sys tools usr var)
 
 if [ -f "${LFS}/sources/chapter7/backup" ]; then
 	echo -e "${YLW}Chapter 7 ${GRN}Backup found. Remove manually to backup again.${RST}"
 else
 
-	echo -ne "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${FILE}${RST}... "
+	echo -ne "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${file}${RST}... "
 	pushd "${LFS}" > /dev/null || exit 1
-		sudo XZ_OPTS="-T${NUMPROCS} -e" tar cJpf "${HOME}"/"${FILE}" "${DIRS[@]}" & pid=$!
+		sudo XZ_OPTS="-T${NUMPROCS} -e" tar cJpf "${HOME}"/"${file}" "${directories[@]}" & pid=$!
 		spinner "$pid"
 		retval=$?
 		if [ "$retval" -ne 0 ]; then
@@ -22,3 +22,4 @@ else
 	touch "${LFS}/sources/chapter7/backup"
 fi
 
+unset file directories
-- 
cgit v1.2.3-54-g00ecf


From ffce566e956e2f5ed6fb4281327db8fccbfa78f4 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 14:35:10 -0500
Subject: Last exit code will be the unset... remove it. Don't need it anyway.

---
 chapter6/m4.sh | 2 --
 1 file changed, 2 deletions(-)

diff --git a/chapter6/m4.sh b/chapter6/m4.sh
index 6dc2c9a..2f67ebe 100644
--- a/chapter6/m4.sh
+++ b/chapter6/m4.sh
@@ -12,5 +12,3 @@ sed '/^HELP2MAN/s/$/ --no-discard-stderr/' -i doc/Makefile.in
             --build="$(build-aux/config.guess)" &&
 make &&
 make DESTDIR="${LFS}" -j1 install
-
-unset CFLAGS
-- 
cgit v1.2.3-54-g00ecf


From 0d597580d56f6f5ee6124aedf1fbc7d0317af37a Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 14:35:53 -0500
Subject: Capitalize the error and remove the unset. It is not needed.

---
 download.sh | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/download.sh b/download.sh
index 72b7bb3..9b3da10 100644
--- a/download.sh
+++ b/download.sh
@@ -27,10 +27,8 @@ cat packages.csv patches.csv | while read -r line; do
 		download "${URL}"
 		if ! echo "${MD5SUM} ${LFS}/sources/${CACHEFILE}" | md5sum -c > /dev/null 2>&1; then
             rm -f "${LFS}/sources/${CACHEFILE}"
-            printf "%b" "\n${GRN}Verification of ${YLW}${CACHEFILE} ${RED}failed! MD5 mismatch!${RST}\n"
+            printf "%b" "\n${GRN}Verification of ${YLW}${CACHEFILE} ${RED}FAILED! MD5 MISMATCH!${RST}\n"
             exit 1
         fi
     fi
 done
-
-unset VERSION URL MD5SUM CACHEFILE
-- 
cgit v1.2.3-54-g00ecf


From 284a8176c1d6fc9eaba1e89d9e1c86056cf64194 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 14:36:09 -0500
Subject: Remove unset command. Not needed. Remove the sleep 5 when compiling.

---
 packageinstall.sh | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/packageinstall.sh b/packageinstall.sh
index 6dc7601..28f9f4b 100644
--- a/packageinstall.sh
+++ b/packageinstall.sh
@@ -28,7 +28,6 @@ else
         pushd "${DIRNAME}" > /dev/null || return 1
 
             printf "%b" "\n${CYN}Compiling ${YLW}${PACKAGE}${RST}... "
-            sleep 5
 
             mkdir -p "${LFS}/sources/log/chapter${CHAPTER}/"
             source "${LFS}/sources/chapter${CHAPTER}/${PACKAGE}.sh" 2>&1 > "${LFS}/sources/log/chapter${CHAPTER}/${PACKAGE}.log" 2>&1 & pid=$!
@@ -48,5 +47,3 @@ else
 
     done
 fi
-
-unset VERSION URL CACHEFILE DIRNAME CHAPTER PACKAGE
-- 
cgit v1.2.3-54-g00ecf


From b1f91cc0a928cd08c01605498e151eda8dbcce4a Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 14:50:49 -0500
Subject: Provide wget exit status when download fails.

---
 download.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/download.sh b/download.sh
index 9b3da10..4e3c794 100644
--- a/download.sh
+++ b/download.sh
@@ -9,6 +9,11 @@ download()
     echo -n "    "
     wget -nc -q --show-progress --progress=dot "$url" 2>&1 | grep --line-buffered "%" | \
         sed -u -e "s,\.,,g" | awk '{printf("\b\b\b\b%4s", $2)}'
+	local retval="${PIPESTATUS[0]}"
+	if [ "${retval}" -ne 0 ]; then
+		printf "%b" "${RED}FAILED! WGET EXIT (${retval})\n${RST}"
+		exit "${retval}"
+	fi
     printf "%b" "\b\b\b\b\n"
     tput cnorm
 }
-- 
cgit v1.2.3-54-g00ecf


From 9f3c0141424fe8dd2d38255373a3e46bc23f13fb Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 15:03:25 -0500
Subject: Create a script exporting separate functions and remove download
 function from downloads script. Reformat MD5 mismatch failed message.

---
 download.sh  | 18 +-----------------
 functions.sh | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 17 deletions(-)
 create mode 100644 functions.sh

diff --git a/download.sh b/download.sh
index 4e3c794..2cec438 100644
--- a/download.sh
+++ b/download.sh
@@ -2,22 +2,6 @@
 
 # Downlod Packages and Patches
 
-download()
-{
-    tput civis
-    local url=$1
-    echo -n "    "
-    wget -nc -q --show-progress --progress=dot "$url" 2>&1 | grep --line-buffered "%" | \
-        sed -u -e "s,\.,,g" | awk '{printf("\b\b\b\b%4s", $2)}'
-	local retval="${PIPESTATUS[0]}"
-	if [ "${retval}" -ne 0 ]; then
-		printf "%b" "${RED}FAILED! WGET EXIT (${retval})\n${RST}"
-		exit "${retval}"
-	fi
-    printf "%b" "\b\b\b\b\n"
-    tput cnorm
-}
-
 cat packages.csv patches.csv | while read -r line; do
     #NAME="$(echo "$line" | cut -d\, -f1)"
     VERSION="$(echo "$line" | cut -d\, -f2)"
@@ -32,7 +16,7 @@ cat packages.csv patches.csv | while read -r line; do
 		download "${URL}"
 		if ! echo "${MD5SUM} ${LFS}/sources/${CACHEFILE}" | md5sum -c > /dev/null 2>&1; then
             rm -f "${LFS}/sources/${CACHEFILE}"
-            printf "%b" "\n${GRN}Verification of ${YLW}${CACHEFILE} ${RED}FAILED! MD5 MISMATCH!${RST}\n"
+            printf "%b" "${GRN}Verification of ${YLW}${CACHEFILE} ${RED}FAILED! MD5 MISMATCH!${RST}\n"
             exit 1
         fi
     fi
diff --git a/functions.sh b/functions.sh
new file mode 100644
index 0000000..d2ff5be
--- /dev/null
+++ b/functions.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+download()
+{
+    tput civis
+    local url=$1
+    echo -n "    "
+    wget -nc -q --show-progress --progress=dot "$url" 2>&1 | grep --line-buffered "%" | \
+        sed -u -e "s,\.,,g" | awk '{printf("\b\b\b\b%4s", $2)}'
+	local retval="${PIPESTATUS[0]}"
+	if [ "${retval}" -ne 0 ]; then
+		printf "%b" "${RED}FAILED! WGET EXIT (${retval})\n${RST}"
+		exit "${retval}"
+	fi
+    printf "%b" "\b\b\b\b\n"
+    tput cnorm
+}
+
+export -f download
-- 
cgit v1.2.3-54-g00ecf


From 41f7b9370db6752b86a8e3cc9c09aa1efc17c83d Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 15:11:45 -0500
Subject: Source functions.

---
 lfs.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lfs.sh b/lfs.sh
index 145faeb..dc0fd0f 100755
--- a/lfs.sh
+++ b/lfs.sh
@@ -14,6 +14,10 @@ printf "%b" "Sourcing spinner...\n"
 # Spinner function (returns an exit value)
 source spinner.sh
 
+printf "%b" "Sourcing functions...\n"
+# Functions used during build
+source functions.sh
+
 # Version check script
 #source versioncheck.sh
 
-- 
cgit v1.2.3-54-g00ecf


From 5dfa81611c0f3c6ffc4db716015097f0b9a1ab20 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 15:53:43 -0500
Subject: Update with kernel version to 5.10.0.

---
 chapter5/glibc.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chapter5/glibc.sh b/chapter5/glibc.sh
index 54db90a..37dbd2b 100644
--- a/chapter5/glibc.sh
+++ b/chapter5/glibc.sh
@@ -17,7 +17,7 @@ cd build || exit 1
       --prefix=/usr \
       --host="${LFS_TGT}" \
       --build="$(../scripts/config.guess)" \
-      --enable-kernel=4.10.0 \
+      --enable-kernel=5.10.0 \
       --with-headers="${LFS}"/usr/include \
       libc_cv_slibdir=/lib &&
 
-- 
cgit v1.2.3-54-g00ecf


From 540bae0d4b3f1745f8afe33fd5822065b34071e1 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 15:53:18 -0500
Subject: Add command for patching bash fixes patch.

---
 chapter6/bash.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/chapter6/bash.sh b/chapter6/bash.sh
index ae7bb34..dee96c6 100644
--- a/chapter6/bash.sh
+++ b/chapter6/bash.sh
@@ -1,5 +1,6 @@
 #!/bin/bash
 
+patch -Np1 -i ../bash-5.1-fixes-1.patch &&
 ./configure --prefix=/usr \
             --build="$(support/config.guess)" \
             --host="${LFS_TGT}" \
-- 
cgit v1.2.3-54-g00ecf


From 704e87d9255adb40ecd5190ecc287381570f9faf Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 15:52:56 -0500
Subject: Add bash-5.1 fixes patch up to patch level 004.

---
 patches.csv | 1 +
 1 file changed, 1 insertion(+)

diff --git a/patches.csv b/patches.csv
index c556e42..48917ee 100644
--- a/patches.csv
+++ b/patches.csv
@@ -1,3 +1,4 @@
+bash,5.1,http://clfs.org/~kb0iic/patches/bash-5.1-fixes-1.patch,55340b67b1401007a816ea97951695d7
 bzip2,1.0.8,http://www.linuxfromscratch.org/patches/lfs/10.1/bzip2-1.0.8-install_docs-1.patch,6a5ac7e89b791aae556de0f745916f7f
 coreutils,8.32,http://www.linuxfromscratch.org/patches/lfs/10.1/coreutils-8.32-i18n-1.patch,cd8ebed2a67fff2e231026df91af6776
 glibc,2.33,http://www.linuxfromscratch.org/patches/lfs/10.1/glibc-2.33-fhs-1.patch,9a5997c3452909b1769918c759eff8a2
-- 
cgit v1.2.3-54-g00ecf


From da175d07d38bbdec782a8cbaf33c77b25eb9d5b1 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 15:52:39 -0500
Subject: Update to linux-5.10.26 from 5.10.17.

---
 packages.csv | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/packages.csv b/packages.csv
index d8c63f0..8766065 100644
--- a/packages.csv
+++ b/packages.csv
@@ -44,8 +44,8 @@ libffi,3.3,https://sourceware.org/pub/libffi/libffi-@.tar.gz,6313289e32f1d38a9df
 libpipeline,1.5.3,http://download.savannah.gnu.org/releases/libpipeline/libpipeline-@.tar.gz,dad443d0911cf9f0f1bd90a334bc9004
 libstdc++,10.2.0,http://ftp.gnu.org/gnu/gcc/gcc-@/gcc-@.tar.xz,e9fd9b1789155ad09bcf3ae747596b50
 libtool,2.4.6,http://ftp.gnu.org/gnu/libtool/libtool-@.tar.xz,1bfb9b923f2c1339b4d2ce1807064aa5
-linux,5.10.17,https://www.kernel.org/pub/linux/kernel/v5.x/linux-@.tar.xz,4908707ed841923d8d1814130d5c380f
-linux-api-headers,5.10.17,https://www.kernel.org/pub/linux/kernel/v5.x/linux-@.tar.xz,4908707ed841923d8d1814130d5c380f
+linux,5.10.26,https://www.kernel.org/pub/linux/kernel/v5.x/linux-@.tar.xz,90c64d22f4e5deb6283c76365183e17e
+linux-api-headers,5.10.26,https://www.kernel.org/pub/linux/kernel/v5.x/linux-@.tar.xz,4908707ed841923d8d1814130d5c380f
 m4,1.4.18,http://ftp.gnu.org/gnu/m4/m4-@.tar.xz,730bb15d96fffe47e148d1e09235af82
 make,4.3,http://ftp.gnu.org/gnu/make/make-@.tar.gz,fc7a67ea86ace13195b0bce683fd4469
 man-DB,2.9.4,http://download.savannah.gnu.org/releases/man-db/man-db-@.tar.xz,6e233a555f7b9ae91ce7cd0faa322bce
-- 
cgit v1.2.3-54-g00ecf


From 4e90c611e6c52be116badd6bf477495dcb370fe8 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 15:52:17 -0500
Subject: Reformat MD5SUM information and include OK or FAILURE on line
 underneath successful download.

---
 download.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/download.sh b/download.sh
index 2cec438..5f5c608 100644
--- a/download.sh
+++ b/download.sh
@@ -16,8 +16,11 @@ cat packages.csv patches.csv | while read -r line; do
 		download "${URL}"
 		if ! echo "${MD5SUM} ${LFS}/sources/${CACHEFILE}" | md5sum -c > /dev/null 2>&1; then
             rm -f "${LFS}/sources/${CACHEFILE}"
-            printf "%b" "${GRN}Verification of ${YLW}${CACHEFILE} ${RED}FAILED! MD5 MISMATCH!${RST}\n"
+            printf "%b" "\n${IPRP}     MD5SUM ${YLW}${MD5SUM} ${RED}FAILED! MD5 MISMATCH!${RST}\n"
             exit 1
         fi
+		
+		printf "%b" "\n${IPRP}     MD5SUM ${YLW}${MD5SUM}${GRN} OK\n${RST}"
+
     fi
 done
-- 
cgit v1.2.3-54-g00ecf


From 72f924d31452c381ff4dc4edd44bc4fef448b43b Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 15:51:29 -0500
Subject: Remove spinner script and move spinner function to functions.

---
 functions.sh | 48 +++++++++++++++++++++++++++++++++++++++++++++++-
 spinner.sh   | 48 ------------------------------------------------
 2 files changed, 47 insertions(+), 49 deletions(-)
 delete mode 100644 spinner.sh

diff --git a/functions.sh b/functions.sh
index d2ff5be..6b8671a 100644
--- a/functions.sh
+++ b/functions.sh
@@ -12,8 +12,54 @@ download()
 		printf "%b" "${RED}FAILED! WGET EXIT (${retval})\n${RST}"
 		exit "${retval}"
 	fi
-    printf "%b" "\b\b\b\b\n"
     tput cnorm
 }
 
 export -f download
+
+## spinner takes the pid of the process as the first argument and
+#  string to display as second argument (default provided) and spins
+#  until the process completes.
+spinner() {
+    local proc="$1"
+    #local str="${2:-'Copyright of KatworX© Tech. Developed by Arjun Singh Kathait and Debugged by the ☆Stack Overflow Community☆'}"
+	local str=""
+    local delay="0.1"
+    tput civis  # hide cursor
+    printf "%b" "${WHT}"
+    while [ -d /proc/"$proc" ]; do
+        #-\|/
+        #⠁⠂⠄⡀⢀⠠⠐⠈
+        #▁▂▃▄▅▆▇█▇▆▅▄▃▂▁
+        #←↖↑↗→↘↓↙
+        #▖▘▝▗
+        #◢◣◤◥
+        #┤┘┴└├┌┬┐
+        #◰◳◲◱
+        #◴◷◶◵
+        #◐◓◑◒
+        #⣾⣽⣻⢿⡿⣟⣯⣷
+        printf '\033[s\033[u[ ▁ ] %s\033[u' "$str"; sleep "$delay"
+        printf '\033[s\033[u[ ▂ ] %s\033[u' "$str"; sleep "$delay"
+        printf '\033[s\033[u[ ▃ ] %s\033[u' "$str"; sleep "$delay"
+        printf '\033[s\033[u[ ▄ ] %s\033[u' "$str"; sleep "$delay"
+        printf '\033[s\033[u[ ▅ ] %s\033[u' "$str"; sleep "$delay"
+        printf '\033[s\033[u[ ▆ ] %s\033[u' "$str"; sleep "$delay"
+        printf '\033[s\033[u[ ▇ ] %s\033[u' "$str"; sleep "$delay"
+        printf '\033[s\033[u[ █ ] %s\033[u' "$str"; sleep "$delay"
+        printf '\033[s\033[u[ ▇ ] %s\033[u' "$str"; sleep "$delay"
+        printf '\033[s\033[u[ ▆ ] %s\033[u' "$str"; sleep "$delay"
+        printf '\033[s\033[u[ ▅ ] %s\033[u' "$str"; sleep "$delay"
+        printf '\033[s\033[u[ ▄ ] %s\033[u' "$str"; sleep "$delay"
+        printf '\033[s\033[u[ ▃ ] %s\033[u' "$str"; sleep "$delay"
+        printf '\033[s\033[u[ ▂ ] %s\033[u' "$str"; sleep "$delay"
+        printf '\033[s\033[u[ ▁ ] %s\033[u' "$str"; sleep "$delay"
+    done
+    wait "${proc}"
+    retval=$?
+    printf '\033[s\033[u%*s\033[u\033[0m' $((${#str}+6)) " "  # return to normal
+    tput cnorm  # restore cursor
+    return $retval
+}
+
+export -f spinner
diff --git a/spinner.sh b/spinner.sh
deleted file mode 100644
index 74cb450..0000000
--- a/spinner.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-
-## spinner takes the pid of the process as the first argument and
-#  string to display as second argument (default provided) and spins
-#  until the process completes.
-spinner() {
-    local proc="$1"
-    #local str="${2:-'Copyright of KatworX© Tech. Developed by Arjun Singh Kathait and Debugged by the ☆Stack Overflow Community☆'}"
-	local str=""
-    local delay="0.1"
-    tput civis  # hide cursor
-    printf "%b" "${WHT}"
-    while [ -d /proc/"$proc" ]; do
-        #-\|/
-        #⠁⠂⠄⡀⢀⠠⠐⠈
-        #▁▂▃▄▅▆▇█▇▆▅▄▃▂▁
-        #←↖↑↗→↘↓↙
-        #▖▘▝▗
-        #◢◣◤◥
-        #┤┘┴└├┌┬┐
-        #◰◳◲◱
-        #◴◷◶◵
-        #◐◓◑◒
-        #⣾⣽⣻⢿⡿⣟⣯⣷
-        printf '\033[s\033[u[ ▁ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▂ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▃ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▄ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▅ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▆ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▇ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ █ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▇ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▆ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▅ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▄ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▃ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▂ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▁ ] %s\033[u' "$str"; sleep "$delay"
-    done
-    wait "${proc}"
-    retval=$?
-    printf '\033[s\033[u%*s\033[u\033[0m' $((${#str}+6)) " "  # return to normal
-    tput cnorm  # restore cursor
-    return $retval
-}
-
-export -f spinner
-- 
cgit v1.2.3-54-g00ecf


From d2c936f4e18395f30b07fe61a5608620cf82a7d8 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 15:57:40 -0500
Subject: Remove spinner source since moved to functions.

---
 lfs.sh | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/lfs.sh b/lfs.sh
index dc0fd0f..d1b23a5 100755
--- a/lfs.sh
+++ b/lfs.sh
@@ -10,10 +10,6 @@ printf "%b" "Sourcing environment variables...\n"
 # LFS build environment settings
 source env.sh
 
-printf "%b" "Sourcing spinner...\n"
-# Spinner function (returns an exit value)
-source spinner.sh
-
 printf "%b" "Sourcing functions...\n"
 # Functions used during build
 source functions.sh
-- 
cgit v1.2.3-54-g00ecf


From c5175c15f5a32347e7ae86b613c8e29996a714c8 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 16:51:31 -0500
Subject: source functions while inside chroot.

---
 insidechroot.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/insidechroot.sh b/insidechroot.sh
index 1863531..8e5ec69 100644
--- a/insidechroot.sh
+++ b/insidechroot.sh
@@ -3,7 +3,7 @@
 CHAPTER="$1"
 
 source /sources/colors.sh
-source /sources/spinner.sh
+source /sources/functions.sh
 
 printf "%b" "${CYN}SUCCESSFULLY ENTERED ${RED}CHROOT${RST}!\n"
 
-- 
cgit v1.2.3-54-g00ecf


From 835366b102f92a5fc7710ad67326b176f1ded477 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 16:54:18 -0500
Subject: Add new line after backup found message and only return FAILED if
 failure.

---
 chapter6/backup.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/chapter6/backup.sh b/chapter6/backup.sh
index f2f0d64..7c458c8 100644
--- a/chapter6/backup.sh
+++ b/chapter6/backup.sh
@@ -4,7 +4,7 @@ file="${LFS_VER}-ch6-backup.tar.xz"
 directories=(bin etc lib lib64 sbin tools usr var)
 
 if [ -f "${LFS}/sources/chapter6/backup" ]; then
-	printf "%b" "${YLW}Chapter 6 ${GRN}Backup found. Remove manually to backup again.${RST}"
+	printf "%b" "${YLW}Chapter 6 ${GRN}Backup found. Remove manually to backup again.\n${RST}"
 else
 
 	echo -ne "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${file}${RST}... "
@@ -13,7 +13,7 @@ else
 		spinner "$pid"
 		retval=$?
 		if [ "$retval" -ne 0 ]; then
-			printf "%b" "${RED}Backup FAILED!${RST}\n"
+			printf "%b" "${RED}FAILED!${RST}\n"
 			exit 1
 		else
 			sudo chown "${USER}" "${HOME}"/"${file}"
-- 
cgit v1.2.3-54-g00ecf


From 6df3121c554f485fc747feb0f348b50e08c3680f Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 17:16:46 -0500
Subject: Remove unset command at end and direct all output to /dev/null for
 tar.

---
 chapter6/backup.sh | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/chapter6/backup.sh b/chapter6/backup.sh
index 7c458c8..e25b3e4 100644
--- a/chapter6/backup.sh
+++ b/chapter6/backup.sh
@@ -9,12 +9,12 @@ else
 
 	echo -ne "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${file}${RST}... "
 	pushd "${LFS}" > /dev/null || exit 1
-		sudo XZ_OPTS="-T${NUMPROCS} -e" tar cJpf "${HOME}"/"${file}" "${directories[@]}" & pid=$!
+		sudo XZ_OPTS="-T${NUMPROCS} -e" tar cJpf "${HOME}"/"${file}" "${directories[@]}" >/dev/null 2>&1 & pid=$!
 		spinner "$pid"
 		retval=$?
 		if [ "$retval" -ne 0 ]; then
 			printf "%b" "${RED}FAILED!${RST}\n"
-			exit 1
+			exit "${retval}"
 		else
 			sudo chown "${USER}" "${HOME}"/"${file}"
 			printf "%b" "${GRN}OK${RST}\n"
@@ -23,5 +23,3 @@ else
 
 	touch "${LFS}/sources/chapter6/backup"
 fi
-
-unset file directories
-- 
cgit v1.2.3-54-g00ecf


From 105789821259880e1eb035d9506eac3cab82e624 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 17:17:43 -0500
Subject: Direct all tar output to /dev/null and return FAILED and exit upon
 failure.

---
 chapter7/backup.sh | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/chapter7/backup.sh b/chapter7/backup.sh
index 8cba32d..2e980c5 100644
--- a/chapter7/backup.sh
+++ b/chapter7/backup.sh
@@ -9,11 +9,12 @@ else
 
 	echo -ne "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${file}${RST}... "
 	pushd "${LFS}" > /dev/null || exit 1
-		sudo XZ_OPTS="-T${NUMPROCS} -e" tar cJpf "${HOME}"/"${file}" "${directories[@]}" & pid=$!
+		sudo XZ_OPTS="-T${NUMPROCS} -e" tar cJpf "${HOME}"/"${file}" "${directories[@]}" >/dev/null 2>&1 & pid=$!
 		spinner "$pid"
 		retval=$?
-		if [ "$retval" -ne 0 ]; then
-			echo -e "${RED}Backup FAILED!${RST}"
+		if [ "${retval}" -ne 0 ]; then
+			echo -e "${RED}FAILED!${RST}"
+			exit "${retval}"
 		else
 			echo -e "${GRN}OK${RST}"
 		fi
@@ -21,5 +22,3 @@ else
 
 	touch "${LFS}/sources/chapter7/backup"
 fi
-
-unset file directories
-- 
cgit v1.2.3-54-g00ecf


From 37c2a2caa41c7c67b0a7daf4107d9a2ac12256dd Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 17:18:17 -0500
Subject: Add some curly braces around retval for fun.

---
 insidechroot.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/insidechroot.sh b/insidechroot.sh
index 8e5ec69..88a5d26 100644
--- a/insidechroot.sh
+++ b/insidechroot.sh
@@ -153,7 +153,7 @@ EOF
 	for package in libstdc++ gettext bison perl python texinfo util-linux; do
 		source packageinstall.sh 7 $package
 		retval=$?
-		if [ "$retval" -ne 0 ]; then
+		if [ "${retval}" -ne 0 ]; then
 			exit 1
 		fi
 	done
-- 
cgit v1.2.3-54-g00ecf


From 440eda1952025bb2d9a76bd8bf62c296ca80f956 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 23:11:03 -0500
Subject: If extraction is successful, print OK. Remove new line before
 printing the compiling package message.

---
 packageinstall.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/packageinstall.sh b/packageinstall.sh
index 28f9f4b..5105fbb 100644
--- a/packageinstall.sh
+++ b/packageinstall.sh
@@ -23,11 +23,13 @@ else
 		if [ "$retval" -ne 0 ]; then
 			printf "%b" "${GRN}Extraction ${RED}FAILED!${RST}\n"
 			return $retval
+		else
+			printf "%b" "${GRN}OK${RST}\n"
 		fi
 
         pushd "${DIRNAME}" > /dev/null || return 1
 
-            printf "%b" "\n${CYN}Compiling ${YLW}${PACKAGE}${RST}... "
+            printf "%b" "${CYN}Compiling ${YLW}${PACKAGE}${RST}... "
 
             mkdir -p "${LFS}/sources/log/chapter${CHAPTER}/"
             source "${LFS}/sources/chapter${CHAPTER}/${PACKAGE}.sh" 2>&1 > "${LFS}/sources/log/chapter${CHAPTER}/${PACKAGE}.log" 2>&1 & pid=$!
-- 
cgit v1.2.3-54-g00ecf


From ebc7e4f32d27e0d3bb82d42db5d20f768948289f Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 26 Mar 2021 23:10:09 -0500
Subject: Replace spinner with random spinner selection when building.
 Possibility to pass an argument to spinner which chooses which spinner to
 use. For now it is random.

---
 functions.sh | 126 ++++++++++++++++++++++++++++++++++++++---------------------
 1 file changed, 82 insertions(+), 44 deletions(-)

diff --git a/functions.sh b/functions.sh
index 6b8671a..4b1f988 100644
--- a/functions.sh
+++ b/functions.sh
@@ -17,49 +17,87 @@ download()
 
 export -f download
 
-## spinner takes the pid of the process as the first argument and
-#  string to display as second argument (default provided) and spins
-#  until the process completes.
-spinner() {
-    local proc="$1"
-    #local str="${2:-'Copyright of KatworX© Tech. Developed by Arjun Singh Kathait and Debugged by the ☆Stack Overflow Community☆'}"
-	local str=""
-    local delay="0.1"
-    tput civis  # hide cursor
-    printf "%b" "${WHT}"
-    while [ -d /proc/"$proc" ]; do
-        #-\|/
-        #⠁⠂⠄⡀⢀⠠⠐⠈
-        #▁▂▃▄▅▆▇█▇▆▅▄▃▂▁
-        #←↖↑↗→↘↓↙
-        #▖▘▝▗
-        #◢◣◤◥
-        #┤┘┴└├┌┬┐
-        #◰◳◲◱
-        #◴◷◶◵
-        #◐◓◑◒
-        #⣾⣽⣻⢿⡿⣟⣯⣷
-        printf '\033[s\033[u[ ▁ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▂ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▃ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▄ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▅ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▆ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▇ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ █ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▇ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▆ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▅ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▄ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▃ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▂ ] %s\033[u' "$str"; sleep "$delay"
-        printf '\033[s\033[u[ ▁ ] %s\033[u' "$str"; sleep "$delay"
-    done
-    wait "${proc}"
-    retval=$?
-    printf '\033[s\033[u%*s\033[u\033[0m' $((${#str}+6)) " "  # return to normal
-    tput cnorm  # restore cursor
-    return $retval
+# Shows a spinner while another command is running. Randomly picks one of 12 spinner styles.
+# @args command to run (with any parameters) while showing a spinner. 
+#       E.g. ‹spinner sleep 10›
+
+function shutdown() {
+  tput cnorm # reset cursor
+}
+trap shutdown EXIT
+
+function cursorBack() {
+  echo -en "\033[$1D"
 }
 
-export -f spinner
+function spinner() {
+  # make sure we use non-unicode character type locale 
+  # (that way it works for any locale as long as the font supports the characters)
+  local LC_CTYPE=C
+
+  local pid=$1 # Process Id of the previous running command
+
+  case $(($RANDOM % 12)) in
+  0)
+    local spin='⠁⠂⠄⡀⢀⠠⠐⠈'
+    local charwidth=3
+    ;;
+  1)
+    local spin='-\|/'
+    local charwidth=1
+    ;;
+  2)
+    local spin="▁▂▃▄▅▆▇█▇▆▅▄▃▂▁"
+    local charwidth=3
+    ;;
+  3)
+    local spin="▉▊▋▌▍▎▏▎▍▌▋▊▉"
+    local charwidth=3
+    ;;
+  4)
+    local spin='←↖↑↗→↘↓↙'
+    local charwidth=3
+    ;;
+  5)
+    local spin='▖▘▝▗'
+    local charwidth=3
+    ;;
+  6)
+    local spin='┤┘┴└├┌┬┐'
+    local charwidth=3
+    ;;
+  7)
+    local spin='◢◣◤◥'
+    local charwidth=3
+    ;;
+  8)
+    local spin='◰◳◲◱'
+    local charwidth=3
+    ;;
+  9)
+    local spin='◴◷◶◵'
+    local charwidth=3
+    ;;
+  10)
+    local spin='◐◓◑◒'
+    local charwidth=3
+    ;;
+  11)
+    local spin='⣾⣽⣻⢿⡿⣟⣯⣷'
+    local charwidth=3
+    ;;
+  esac
+
+  local i=0
+  tput civis # cursor invisible
+  while kill -0 $pid 2>/dev/null; do
+    local i=$(((i + $charwidth) % ${#spin}))
+    printf "%s" "${spin:$i:$charwidth}"
+
+    cursorBack 1
+    sleep .1
+  done
+  tput cnorm
+  wait $pid # capture exit code
+  return $?
+}
-- 
cgit v1.2.3-54-g00ecf


From 24ae50590b533a53cbc254854ec7159c5e02c804 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Mon, 29 Mar 2021 20:43:11 -0500
Subject: Add TESTUSERID when chrooting and use 'id -u' commnd to get user id.
 Use  when adding tester user to passwd.

---
 insidechroot.sh | 3 +--
 lfs.sh          | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/insidechroot.sh b/insidechroot.sh
index 88a5d26..57951ab 100644
--- a/insidechroot.sh
+++ b/insidechroot.sh
@@ -131,7 +131,7 @@ nogroup:x:99:
 users:x:999:
 EOF
 
-		echo "tester:x:$(ls -n "$(tty)" | cut -d" " -f3):101::/home/tester:/bin/bash" >> /etc/passwd
+		echo "tester:x:${TESTERUID}:101::/home/tester:/bin/bash" >> /etc/passwd
 		echo "tester:x:101:" >> /etc/group
 		install -o tester -d /home/tester
 
@@ -162,4 +162,3 @@ EOF
 else
 	printf "%b" "Do Chapter 8, 9 and 10 stuff here.\n"
 fi
-
diff --git a/lfs.sh b/lfs.sh
index d1b23a5..fedf71a 100755
--- a/lfs.sh
+++ b/lfs.sh
@@ -116,6 +116,7 @@ sudo chroot "${LFS}" /usr/bin/env \
 	PATH=/bin:/usr/bin:/sbin:/usr/sbin \
 	NUMPROCS="${NUMPROCS}" \
 	MAKEFLAGS="${MAKEFLAGS}" \
+	TESTERUID="$(id -u)" \
 	/bin/bash --login +h -c "/sources/insidechroot.sh 7"
 retval=$?
 
@@ -147,6 +148,7 @@ sudo chroot "${LFS}" /usr/bin/env \
 	PATH=/bin:/usr/bin:/sbin:/usr/sbin \
 	NUMPROCS="${NUMPROCS}" \
 	MAKEFLAGS="${MAKEFLAGS}" \
+	TESTERUID="$(id -u)" \
 	/bin/bash --login +h -c "/sources/insidechroot.sh 8"
 
 printf "%b" "${CYN}EXITED ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n"
-- 
cgit v1.2.3-54-g00ecf


From 551d2c98ba564e695b6aff09f843861b326f1334 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Tue, 30 Mar 2021 10:02:31 -0500
Subject: Use essential for essential files and symlinks.

---
 insidechroot.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/insidechroot.sh b/insidechroot.sh
index 57951ab..6982e4b 100644
--- a/insidechroot.sh
+++ b/insidechroot.sh
@@ -88,8 +88,8 @@ if [ "${CHAPTER}" -eq 7 ]; then
 	fi
 
 	printf "%b" "${GRN}Creating essential files and symbolic links... ${RST}\n"
-	if [ -f "/sources/symfiles" ]; then
-		printf "%b" "  ${GRN}Files and symbolic links already created.${RST}\n"
+	if [ -f "/sources/essential" ]; then
+		printf "%b" "  ${GRN}Essential files and symbolic links already created.${RST}\n"
 	else
 		ln -sf /proc/self/mounts /etc/mtab
 		echo "127.0.0.1 localhost $(hostname)" > /etc/hosts
@@ -143,8 +143,8 @@ EOF
 		chmod 664  /var/log/lastlog
 		chmod 600  /var/log/btmp
 
-		echo -e "  ${GRN}Files and symlinks created.${RST}"
-		touch /sources/symfiles
+		echo -e "  ${GRN}Essential files and symlinks created.${RST}"
+		touch /sources/essential
 	fi
 
 	cd /sources || exit 1
-- 
cgit v1.2.3-54-g00ecf


From dcde981e41ea2f9364be27c06293d89bae06f8f7 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Tue, 30 Mar 2021 10:25:20 -0500
Subject: Update linux to 5.10.27 and update md5sum.

---
 packages.csv | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/packages.csv b/packages.csv
index 8766065..5f1421f 100644
--- a/packages.csv
+++ b/packages.csv
@@ -44,8 +44,8 @@ libffi,3.3,https://sourceware.org/pub/libffi/libffi-@.tar.gz,6313289e32f1d38a9df
 libpipeline,1.5.3,http://download.savannah.gnu.org/releases/libpipeline/libpipeline-@.tar.gz,dad443d0911cf9f0f1bd90a334bc9004
 libstdc++,10.2.0,http://ftp.gnu.org/gnu/gcc/gcc-@/gcc-@.tar.xz,e9fd9b1789155ad09bcf3ae747596b50
 libtool,2.4.6,http://ftp.gnu.org/gnu/libtool/libtool-@.tar.xz,1bfb9b923f2c1339b4d2ce1807064aa5
-linux,5.10.26,https://www.kernel.org/pub/linux/kernel/v5.x/linux-@.tar.xz,90c64d22f4e5deb6283c76365183e17e
-linux-api-headers,5.10.26,https://www.kernel.org/pub/linux/kernel/v5.x/linux-@.tar.xz,4908707ed841923d8d1814130d5c380f
+linux,5.10.27,https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-@.tar.xz,506ee265062384ac1194b2ea8317ca4f
+linux-api-headers,5.10.27,cdn://www.kernel.org/pub/linux/kernel/v5.x/linux-@.tar.xz,506ee265062384ac1194b2ea8317ca4f
 m4,1.4.18,http://ftp.gnu.org/gnu/m4/m4-@.tar.xz,730bb15d96fffe47e148d1e09235af82
 make,4.3,http://ftp.gnu.org/gnu/make/make-@.tar.gz,fc7a67ea86ace13195b0bce683fd4469
 man-DB,2.9.4,http://download.savannah.gnu.org/releases/man-db/man-db-@.tar.xz,6e233a555f7b9ae91ce7cd0faa322bce
-- 
cgit v1.2.3-54-g00ecf


From 8de4566c3f959c0d9d51c79ea9b4205d46718060 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Tue, 30 Mar 2021 10:26:15 -0500
Subject: Always check md5sum even if file exists. File my be partial. Print
 message that file is cached and then check md5sum. If md5sum fails, remove
 file. Next time script is ran, it will download and check again.

---
 download.sh | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/download.sh b/download.sh
index 5f5c608..d210b1e 100644
--- a/download.sh
+++ b/download.sh
@@ -14,13 +14,16 @@ cat packages.csv patches.csv | while read -r line; do
 
         printf "%b" "${PRP}Downloading ${YLW}${CACHEFILE}${RST}... "
 		download "${URL}"
-		if ! echo "${MD5SUM} ${LFS}/sources/${CACHEFILE}" | md5sum -c > /dev/null 2>&1; then
-            rm -f "${LFS}/sources/${CACHEFILE}"
-            printf "%b" "\n${IPRP}     MD5SUM ${YLW}${MD5SUM} ${RED}FAILED! MD5 MISMATCH!${RST}\n"
-            exit 1
-        fi
+	else
+		printf "%b" "${PRP}File cached ${YLW}${CACHEFILE}${RST}... "
+	fi
+
+	if ! echo "${MD5SUM} ${LFS}/sources/${CACHEFILE}" | md5sum -c > /dev/null 2>&1; then
+		rm -f "${LFS}/sources/${CACHEFILE}"
+        printf "%b" "\n${IPRP}     MD5SUM ${YLW}${MD5SUM} ${RED}FAILED! MD5 MISMATCH!${RST}\n"
+        exit 1
+    fi
 		
 		printf "%b" "\n${IPRP}     MD5SUM ${YLW}${MD5SUM}${GRN} OK\n${RST}"
 
-    fi
 done
-- 
cgit v1.2.3-54-g00ecf


From bb69bafce6afca3fb48cbf65dfad12ec950ca3cb Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Tue, 30 Mar 2021 10:26:42 -0500
Subject: Use intense white for spinner and download percentage status.

---
 functions.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/functions.sh b/functions.sh
index 4b1f988..cab97b5 100644
--- a/functions.sh
+++ b/functions.sh
@@ -4,7 +4,7 @@ download()
 {
     tput civis
     local url=$1
-    echo -n "    "
+    printf "%b" "${IWHT}    "
     wget -nc -q --show-progress --progress=dot "$url" 2>&1 | grep --line-buffered "%" | \
         sed -u -e "s,\.,,g" | awk '{printf("\b\b\b\b%4s", $2)}'
 	local retval="${PIPESTATUS[0]}"
@@ -92,7 +92,7 @@ function spinner() {
   tput civis # cursor invisible
   while kill -0 $pid 2>/dev/null; do
     local i=$(((i + $charwidth) % ${#spin}))
-    printf "%s" "${spin:$i:$charwidth}"
+    printf "%b" "${IWHT}${spin:$i:$charwidth}${RST}"
 
     cursorBack 1
     sleep .1
-- 
cgit v1.2.3-54-g00ecf


From d5a17beb0e521b00e602184f4eb76ea5ae5fa304 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Tue, 30 Mar 2021 12:58:24 -0500
Subject: Use tput for color rather than escape codes from our colors.sh.

---
 functions.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/functions.sh b/functions.sh
index cab97b5..8c5bd93 100644
--- a/functions.sh
+++ b/functions.sh
@@ -90,9 +90,10 @@ function spinner() {
 
   local i=0
   tput civis # cursor invisible
+  tput bold setaf 7
   while kill -0 $pid 2>/dev/null; do
     local i=$(((i + $charwidth) % ${#spin}))
-    printf "%b" "${IWHT}${spin:$i:$charwidth}${RST}"
+    printf "%b" "${spin:$i:$charwidth}"
 
     cursorBack 1
     sleep .1
-- 
cgit v1.2.3-54-g00ecf


From 1e4bef0e5d4447acc7f1ed9d7ae84d388c0c78a7 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Tue, 30 Mar 2021 12:58:51 -0500
Subject: User VERSION variable for the versioned doc directory.

---
 chapter7/util-linux.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chapter7/util-linux.sh b/chapter7/util-linux.sh
index 170e3f5..e70fbfa 100644
--- a/chapter7/util-linux.sh
+++ b/chapter7/util-linux.sh
@@ -1,6 +1,6 @@
 mkdir -p /var/lib/hwclock &&
 ./configure ADJTIME_PATH=/var/lib/hwclock/adjtime    \
-            --docdir=/usr/share/doc/util-linux-2.36.2 \
+            --docdir=/usr/share/doc/util-linux-"${VERSION}" \
             --disable-chfn-chsh \
             --disable-login \
             --disable-nologin \
-- 
cgit v1.2.3-54-g00ecf


From 57671253b64d9144d7f39137d654edb7555df62c Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Tue, 30 Mar 2021 12:59:05 -0500
Subject: User VERSION variable for the versioned doc directory.

---
 chapter7/bison.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chapter7/bison.sh b/chapter7/bison.sh
index a2344a6..3112d1f 100644
--- a/chapter7/bison.sh
+++ b/chapter7/bison.sh
@@ -1,3 +1,3 @@
-./configure --prefix=/usr --docdir=/usr/share/doc/bison-3.7.5 &&
+./configure --prefix=/usr --docdir=/usr/share/doc/bison-"${VERSION}" &&
 make &&
 make -j1 install
-- 
cgit v1.2.3-54-g00ecf


From 661a2ab5a84b70f3075777599b27e19f06b49e8a Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Tue, 30 Mar 2021 12:59:40 -0500
Subject: Create a variable with only the major minor of the perl version and
 use it in the configure options.

---
 chapter7/perl.sh | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/chapter7/perl.sh b/chapter7/perl.sh
index 2cb5245..970e17c 100644
--- a/chapter7/perl.sh
+++ b/chapter7/perl.sh
@@ -1,11 +1,15 @@
+#!/bin/bash
+
+MAJMIN="$(cut -d\. -f1,2 <<< "${VERSION}")"
+
 sh Configure -des \
              -Dprefix=/usr \
              -Dvendorprefix=/usr \
-             -Dprivlib=/usr/lib/perl5/5.32/core_perl \
-             -Darchlib=/usr/lib/perl5/5.32/core_perl \
-             -Dsitelib=/usr/lib/perl5/5.32/site_perl \
-             -Dsitearch=/usr/lib/perl5/5.32/site_perl \
-             -Dvendorlib=/usr/lib/perl5/5.32/vendor_perl \
-             -Dvendorarch=/usr/lib/perl5/5.32/vendor_perl &&
+             -Dprivlib=/usr/lib/perl5/"${MAJMIN}"/core_perl \
+             -Darchlib=/usr/lib/perl5/"${MAJMIN}"/core_perl \
+             -Dsitelib=/usr/lib/perl5/"${MAJMIN}"/site_perl \
+             -Dsitearch=/usr/lib/perl5/"${MAJMIN}"/site_perl \
+             -Dvendorlib=/usr/lib/perl5/"${MAJMIN}"/vendor_perl \
+             -Dvendorarch=/usr/lib/perl5/"${MAJMIN}"/vendor_perl &&
 make &&
 make -j1 install
-- 
cgit v1.2.3-54-g00ecf


From dc161b4d4f5c37c2e72a953e639641b112fb68a0 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Tue, 30 Mar 2021 13:03:52 -0500
Subject: Add shebangs and cleanup libstdc++.sh

---
 chapter7/bison.sh      | 2 ++
 chapter7/gettext.sh    | 2 ++
 chapter7/libstdc++.sh  | 6 ++++--
 chapter7/python.sh     | 2 ++
 chapter7/texinfo.sh    | 2 ++
 chapter7/util-linux.sh | 2 ++
 6 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/chapter7/bison.sh b/chapter7/bison.sh
index 3112d1f..2385d22 100644
--- a/chapter7/bison.sh
+++ b/chapter7/bison.sh
@@ -1,3 +1,5 @@
+#!/bin/bash
+
 ./configure --prefix=/usr --docdir=/usr/share/doc/bison-"${VERSION}" &&
 make &&
 make -j1 install
diff --git a/chapter7/gettext.sh b/chapter7/gettext.sh
index 85bc7f4..49fbf15 100644
--- a/chapter7/gettext.sh
+++ b/chapter7/gettext.sh
@@ -1,3 +1,5 @@
+#!/bin/bash
+
 ./configure --disable-shared
 make &&
 cp -v gettext-tools/src/msgfmt /usr/bin
diff --git a/chapter7/libstdc++.sh b/chapter7/libstdc++.sh
index 5e81693..c2ef63b 100644
--- a/chapter7/libstdc++.sh
+++ b/chapter7/libstdc++.sh
@@ -1,12 +1,14 @@
+#!/bin/bash
+
 ln -s gthr-posix.h libgcc/gthr-default.h
 mkdir build
-cd build
+cd build || exit 1
 ../libstdc++-v3/configure \
     CXXFLAGS="-g -O2 -D_GNU_SOURCE" \
     --prefix=/usr \
     --disable-multilib \
     --disable-nls \
-    --host=$(uname -m)-lfs-linux-gnu \
+    --host="$(uname -m)"-lfs-linux-gnu \
     --disable-libstdcxx-pch &&
 make &&
 make -j1 install
diff --git a/chapter7/python.sh b/chapter7/python.sh
index 7d158b1..daf1677 100644
--- a/chapter7/python.sh
+++ b/chapter7/python.sh
@@ -1,3 +1,5 @@
+#!/bin/bash
+
 ./configure --prefix=/usr \
             --enable-shared \
             --without-ensurepip &&
diff --git a/chapter7/texinfo.sh b/chapter7/texinfo.sh
index 7f133fe..1935156 100644
--- a/chapter7/texinfo.sh
+++ b/chapter7/texinfo.sh
@@ -1,3 +1,5 @@
+#!/bin/bash
+
 ./configure --prefix=/usr &&
 make &&
 make -j1 install
diff --git a/chapter7/util-linux.sh b/chapter7/util-linux.sh
index e70fbfa..7a00c8c 100644
--- a/chapter7/util-linux.sh
+++ b/chapter7/util-linux.sh
@@ -1,3 +1,5 @@
+#!/bin/bash
+
 mkdir -p /var/lib/hwclock &&
 ./configure ADJTIME_PATH=/var/lib/hwclock/adjtime    \
             --docdir=/usr/share/doc/util-linux-"${VERSION}" \
-- 
cgit v1.2.3-54-g00ecf


From 2fdc594c54a592070de1336d8b9a8e8eb97e974b Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 1 Apr 2021 13:00:40 -0500
Subject: Add warning message about potential loss of data when not manually
 setting up the LFS partition, filesystem and mounting.

---
 lfs.sh | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lfs.sh b/lfs.sh
index fedf71a..a22704c 100755
--- a/lfs.sh
+++ b/lfs.sh
@@ -18,7 +18,15 @@ source functions.sh
 #source versioncheck.sh
 
 printf "%b" "\n\n\n${CYN}BUILDING ${YLW}${LFS_VER} $(uname -m)${CYN} at \
-${IWHT}${LFS}${CYN} on ${IWHT}${LFS_DISK}${LFS_PART}${RST}\n\n\n"
+${IWHT}${LFS}${CYN} on ${IWHT}${LFS_DISK}${LFS_PART}${RST}\n\n"
+
+printf "%b" "${IRED}*** ${IREDB}WARNING${RST} \
+${IWHT}POTENTIAL DATA LOSS \
+${IREDB}WARNING ${RST}${IRED}***${GRN}\n${RST}"
+
+printf "%b" "${GRN}Automatic creation of partition(s), filesystem(s) \n\
+and mounting will occur unless manually performed\n\
+before continuing.${RST}\n\n\n"
 
 # Continue or Abort
 printf "%b" "${IGRN}CONTINUE ${IWHTB}(C)${RST} / ${IRED}ABORT ${IWHTB}(OTHER)${RST}\n"
-- 
cgit v1.2.3-54-g00ecf


From fd6537d1bf69e3b73eb3e7cec0be7811e4a72539 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 1 Apr 2021 13:43:18 -0500
Subject: Add message when copying requierd files for build to LFS sources
 target directory.

---
 lfs.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lfs.sh b/lfs.sh
index a22704c..ad58449 100755
--- a/lfs.sh
+++ b/lfs.sh
@@ -79,6 +79,9 @@ esac
 #printf "%b" "${LFS_PWD}\n${LFS_PWD}\n" | sudo passwd lfs
 
 # Copy scripts and csv files to LFS sources target
+printf "%b" "${GRN}Copying required files to ${YLW}${LFS}/sources \
+${GRN}target directory.${RST}\n"
+
 cp -rf ./*.sh chapter* ./*.csv "${LFS}/sources"
 cd "${LFS}/sources" || exit 1
 
-- 
cgit v1.2.3-54-g00ecf


From 30bbcceb41eb4b8bd8126039b9a90a8b60faa605 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 1 Apr 2021 13:57:03 -0500
Subject: Add chapter 7 build message.

---
 insidechroot.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/insidechroot.sh b/insidechroot.sh
index 6982e4b..b927c29 100644
--- a/insidechroot.sh
+++ b/insidechroot.sh
@@ -150,6 +150,9 @@ EOF
 	cd /sources || exit 1
 
 	# Chapter 7
+    printf "%b" "${IWHT}============ ${IGRN}Building ${IYLW}Chapter 7${IWHT} \
+============${RST}\n"
+
 	for package in libstdc++ gettext bison perl python texinfo util-linux; do
 		source packageinstall.sh 7 $package
 		retval=$?
-- 
cgit v1.2.3-54-g00ecf


From 5b6db0dde8b8fbbd638c76088ecd35c83492f95b Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 1 Apr 2021 14:02:43 -0500
Subject: Add empty line.

---
 lfs.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lfs.sh b/lfs.sh
index 5c8cbb9..555221d 100755
--- a/lfs.sh
+++ b/lfs.sh
@@ -124,6 +124,7 @@ chmod ugo+x insidechroot.sh
 
 printf "%b" "${CYN}PREPARING ${RED}CHROOT${CYN} ENVIRONMENT...${RST}\n"
 sudo ./preparechroot.sh "${LFS}"
+
 printf "%b" "${CYN}ENTERING ${RED}CHROOT${CYN} ENVIRONMENT...${RST}\n"
 sleep 3
 
-- 
cgit v1.2.3-54-g00ecf


From 7aa6e829ae02e63d9f126581897e906793b38d63 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 1 Apr 2021 14:34:16 -0500
Subject: Add new line to beginning of building chapter 7 build printf.

---
 insidechroot.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/insidechroot.sh b/insidechroot.sh
index b927c29..b44e4ca 100644
--- a/insidechroot.sh
+++ b/insidechroot.sh
@@ -150,7 +150,7 @@ EOF
 	cd /sources || exit 1
 
 	# Chapter 7
-    printf "%b" "${IWHT}============ ${IGRN}Building ${IYLW}Chapter 7${IWHT} \
+    printf "%b" "\n${IWHT}============ ${IGRN}Building ${IYLW}Chapter 7${IWHT} \
 ============${RST}\n"
 
 	for package in libstdc++ gettext bison perl python texinfo util-linux; do
-- 
cgit v1.2.3-54-g00ecf


From fc856c4c50dbb349732c84319ca53c1af3059b20 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 1 Apr 2021 15:14:31 -0500
Subject: Remove sources from backup dirs array.

---
 chapter7/backup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chapter7/backup.sh b/chapter7/backup.sh
index 2e980c5..d34e383 100644
--- a/chapter7/backup.sh
+++ b/chapter7/backup.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 file="${LFS_VER}-ch7-backup.tar.xz"
-directories=(bin dev etc lib lib64 proc run sbin sources sys tools usr var)
+directories=(bin dev etc lib lib64 proc run sbin sys tools usr var)
 
 if [ -f "${LFS}/sources/chapter7/backup" ]; then
 	echo -e "${YLW}Chapter 7 ${GRN}Backup found. Remove manually to backup again.${RST}"
-- 
cgit v1.2.3-54-g00ecf


From 35b8da43e8fbe15ecd0114e409bf188d4c39eecf Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 1 Apr 2021 15:15:42 -0500
Subject: Use intense green for already completed tasks which are indented.

---
 insidechroot.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/insidechroot.sh b/insidechroot.sh
index b44e4ca..307e990 100644
--- a/insidechroot.sh
+++ b/insidechroot.sh
@@ -10,7 +10,7 @@ printf "%b" "${CYN}SUCCESSFULLY ENTERED ${RED}CHROOT${RST}!\n"
 if [ "${CHAPTER}" -eq 7 ]; then
 	printf "%b" "${GRN}Creating directories...${RST}\n"
 	if [ -f /sources/createdirs ]; then
-		printf "%b" "${GRN}  Directories already created.${RST}\n"
+		printf "%b" "${IGRN}  Directories already created.${RST}\n"
 	else
 		mkdir -p /boot
 		mkdir -p /home
@@ -89,7 +89,7 @@ if [ "${CHAPTER}" -eq 7 ]; then
 
 	printf "%b" "${GRN}Creating essential files and symbolic links... ${RST}\n"
 	if [ -f "/sources/essential" ]; then
-		printf "%b" "  ${GRN}Essential files and symbolic links already created.${RST}\n"
+		printf "%b" "  ${IGRN}Essential files and symbolic links already created.${RST}\n"
 	else
 		ln -sf /proc/self/mounts /etc/mtab
 		echo "127.0.0.1 localhost $(hostname)" > /etc/hosts
-- 
cgit v1.2.3-54-g00ecf


From 2eb42bd36d90feeee9ec0b50c711ebca06eea090 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 1 Apr 2021 15:16:54 -0500
Subject: Use intense colors fo indented chroot already prepared message.

---
 preparechroot.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/preparechroot.sh b/preparechroot.sh
index 1d05e72..dfc9e84 100644
--- a/preparechroot.sh
+++ b/preparechroot.sh
@@ -5,7 +5,7 @@ source colors.sh
 export LFS="$1"
 
 if [ -f chrootprepared ]; then
-	printf "%b" "${RED}CHROOT ${GRN}already prepared...\n${RST}"
+	printf "%b" "  ${IRED}CHROOT ${GGRN}already prepared...\n${RST}"
 	exit 0
 fi
 
-- 
cgit v1.2.3-54-g00ecf


From 0e1cd3eda02f349022e8197ffe963ec148de8f31 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 1 Apr 2021 15:17:40 -0500
Subject: Change GGRN to IGRN.

---
 preparechroot.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/preparechroot.sh b/preparechroot.sh
index dfc9e84..32f6558 100644
--- a/preparechroot.sh
+++ b/preparechroot.sh
@@ -5,7 +5,7 @@ source colors.sh
 export LFS="$1"
 
 if [ -f chrootprepared ]; then
-	printf "%b" "  ${IRED}CHROOT ${GGRN}already prepared...\n${RST}"
+	printf "%b" "  ${IRED}CHROOT ${IGRN}already prepared...\n${RST}"
 	exit 0
 fi
 
-- 
cgit v1.2.3-54-g00ecf


From b5a6b72fc21d9f54b626cc8be5536b179125efd4 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 1 Apr 2021 15:39:20 -0500
Subject: Add SPINNER to chroot variables for spinnertype to be used.

---
 lfs.sh | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lfs.sh b/lfs.sh
index 0dea3a0..e31460a 100755
--- a/lfs.sh
+++ b/lfs.sh
@@ -125,10 +125,10 @@ source chapter6/backup.sh
 chmod ugo+x preparechroot.sh
 chmod ugo+x insidechroot.sh
 
-printf "%b" "${CYN}PREPARING ${RED}CHROOT${CYN} ENVIRONMENT...${RST}\n"
+printf "%b" "\n${CYN}PREPARING ${RED}CHROOT${CYN} ENVIRONMENT...${RST}\n"
 sudo ./preparechroot.sh "${LFS}"
 
-printf "%b" "${CYN}ENTERING ${RED}CHROOT${CYN} ENVIRONMENT...${RST}\n"
+printf "%b" "\n${CYN}ENTERING ${RED}CHROOT${CYN} ENVIRONMENT...${RST}\n"
 sleep 3
 
 sudo chroot "${LFS}" /usr/bin/env \
@@ -138,11 +138,12 @@ 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" "${CYN}EXITED ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n"
+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"
@@ -162,6 +163,9 @@ 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 \
@@ -170,7 +174,8 @@ 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 8"
 
-printf "%b" "${CYN}EXITED ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n"
+printf "%b" "\n${CYN}EXITED ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n"
-- 
cgit v1.2.3-54-g00ecf


From 0aea4d271cdc7002ea16c68fd54d4825bfbdcc6e Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 1 Apr 2021 15:47:00 -0500
Subject: Adjust indention and syntax.

---
 functions.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/functions.sh b/functions.sh
index 43bf4d1..63fa887 100644
--- a/functions.sh
+++ b/functions.sh
@@ -103,8 +103,8 @@ function spinner() {
   local i=0
   tput civis # cursor invisible
   tput bold setaf 7
-  while kill -0 $pid 2>/dev/null; do
-    local i=$(((i + $charwidth) % ${#spin}))
+  while kill -0 "$pid" 2>/dev/null; do
+    local i=$(((i + charwidth) % ${#spin}))
     printf "%b" "${spin:$i:$charwidth}"
 
     cursorBack 1
-- 
cgit v1.2.3-54-g00ecf


From 9dbc17f3dcaf1191c49a557c7dbb60ededbf4d5b Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 1 Apr 2021 15:49:05 -0500
Subject: Use CYN at end of last CHROOT exit message.

---
 lfs.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lfs.sh b/lfs.sh
index e31460a..aaa27af 100755
--- a/lfs.sh
+++ b/lfs.sh
@@ -178,4 +178,4 @@ sudo chroot "${LFS}" /usr/bin/env \
 	TESTERUID="$(id -u)" \
 	/bin/bash --login +h -c "/sources/insidechroot.sh 8"
 
-printf "%b" "\n${CYN}EXITED ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n"
+printf "%b" "\n${CYN}EXITED ${RED}CHROOT${CYN} ENVIRONMENT...${RST}\n"
-- 
cgit v1.2.3-54-g00ecf


From 2b3ad233705d788ef0ea0ba65a6197cb8120e688 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 1 Apr 2021 16:10:13 -0500
Subject: Pass SPINNER variable to spinner for spinnertype.

---
 chapter7/backup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chapter7/backup.sh b/chapter7/backup.sh
index d34e383..4bdb206 100644
--- a/chapter7/backup.sh
+++ b/chapter7/backup.sh
@@ -10,7 +10,7 @@ else
 	echo -ne "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${file}${RST}... "
 	pushd "${LFS}" > /dev/null || exit 1
 		sudo XZ_OPTS="-T${NUMPROCS} -e" tar cJpf "${HOME}"/"${file}" "${directories[@]}" >/dev/null 2>&1 & pid=$!
-		spinner "$pid"
+		spinner "$pid" "${SPINNER}"
 		retval=$?
 		if [ "${retval}" -ne 0 ]; then
 			echo -e "${RED}FAILED!${RST}"
-- 
cgit v1.2.3-54-g00ecf


From 6b0f4abdb2d5c0ae1b3a2d82a7953f03f8e1d114 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 1 Apr 2021 16:20:54 -0500
Subject: Use intense colors for already completed message.

---
 chapter6/cleanup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chapter6/cleanup.sh b/chapter6/cleanup.sh
index cd620d3..9a1e3af 100644
--- a/chapter6/cleanup.sh
+++ b/chapter6/cleanup.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 if [ -f "${LFS}/sources/chapter6/cleanup" ]; then
-	echo -e "${YLW}Chapter 6 ${GRN}cleanup already performed.${RST}"
+	echo -e "${IYLW}Chapter 6 ${IGRN}cleanup already performed.${RST}"
 else
 
 	echo -ne "${GRN}Cleaning up ${YLW}${LFS}${RST}... "
-- 
cgit v1.2.3-54-g00ecf


From 1624434cc39a74b36881aa657f4cea38b9bfba77 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 1 Apr 2021 16:21:00 -0500
Subject: Use intense colors for already completed message.

---
 chapter7/cleanup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chapter7/cleanup.sh b/chapter7/cleanup.sh
index b300e7e..f4a8333 100644
--- a/chapter7/cleanup.sh
+++ b/chapter7/cleanup.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 if [ -f "${LFS}/sources/chapter7/cleanup" ]; then
-	echo -e "${YLW}Chapter 7 ${GRN}cleanup already performed.${RST}"
+	echo -e "  ${IYLW}Chapter 7 ${IGRN}cleanup already performed.${RST}"
 else
 
 	echo -ne "${GRN}Cleaning up ${YLW}${LFS}${RST}... "
-- 
cgit v1.2.3-54-g00ecf


From b0d25df104e1a9cdb50d84c594cd90f1a926696d Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 1 Apr 2021 16:23:49 -0500
Subject: Fix indentation.

---
 chapter6/cleanup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chapter6/cleanup.sh b/chapter6/cleanup.sh
index 9a1e3af..3215924 100644
--- a/chapter6/cleanup.sh
+++ b/chapter6/cleanup.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 if [ -f "${LFS}/sources/chapter6/cleanup" ]; then
-	echo -e "${IYLW}Chapter 6 ${IGRN}cleanup already performed.${RST}"
+	echo -e "  ${IYLW}Chapter 6 ${IGRN}cleanup already performed.${RST}"
 else
 
 	echo -ne "${GRN}Cleaning up ${YLW}${LFS}${RST}... "
-- 
cgit v1.2.3-54-g00ecf


From fa97bb7243563fca9dba2dc58f5bc68762344265 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 1 Apr 2021 16:29:45 -0500
Subject: Use intense color and indention for backup already found message.

---
 chapter6/backup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chapter6/backup.sh b/chapter6/backup.sh
index db01b98..8d2be5d 100644
--- a/chapter6/backup.sh
+++ b/chapter6/backup.sh
@@ -4,7 +4,7 @@ file="${LFS_VER}-ch6-backup.tar.xz"
 directories=(bin etc lib lib64 sbin tools usr var)
 
 if [ -f "${LFS}/sources/chapter6/backup" ]; then
-	printf "%b" "${YLW}Chapter 6 ${GRN}Backup found. Remove manually to backup again.\n${RST}"
+	printf "%b" "  ${IYLW}Chapter 6 ${IGRN}Backup found. Remove manually to backup again.\n${RST}"
 else
 
 	echo -ne "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${file}${RST}... "
-- 
cgit v1.2.3-54-g00ecf


From 35d43dceb238ecd5a61c3fdc9035844e8146c940 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 1 Apr 2021 16:34:38 -0500
Subject: Use intense colors for backup found message and indent. Change
 cleanup and backup message for chapter 7 in lfs.sh.

---
 chapter7/backup.sh | 2 +-
 lfs.sh             | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/chapter7/backup.sh b/chapter7/backup.sh
index 4bdb206..8b0944d 100644
--- a/chapter7/backup.sh
+++ b/chapter7/backup.sh
@@ -4,7 +4,7 @@ file="${LFS_VER}-ch7-backup.tar.xz"
 directories=(bin dev etc lib lib64 proc run sbin sys tools usr var)
 
 if [ -f "${LFS}/sources/chapter7/backup" ]; then
-	echo -e "${YLW}Chapter 7 ${GRN}Backup found. Remove manually to backup again.${RST}"
+	echo -e "  ${IYLW}Chapter 7 ${IGRN}Backup found. Remove manually to backup again.${RST}"
 else
 
 	echo -ne "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${file}${RST}... "
diff --git a/lfs.sh b/lfs.sh
index aaa27af..64ca920 100755
--- a/lfs.sh
+++ b/lfs.sh
@@ -118,6 +118,7 @@ for package in m4 ncurses bash coreutils diffutils file findutils gawk grep gzip
     fi
 done
 
+printf "%b" "\n${YLW}Chapter 6 ${GRN}cleanup and backup${RST}\n"
 source chapter6/cleanup.sh
 source chapter6/backup.sh
 
@@ -153,7 +154,7 @@ if [ "$retval" -eq 7 ]; then
 	sudo umount "${LFS}"/sys
 	sudo umount "${LFS}"/proc
 
-	printf "%b" "${GRN}Cleaning and backing up before starting Chapter 8.\n"
+    printf "%b" "\n${YLW}Chapter 7 ${GRN}cleanup and backup${RST}\n"
 	source "${LFS}"/sources/chapter7/cleanup.sh
 	source "${LFS}"/sources/chapter7/backup.sh
 else
-- 
cgit v1.2.3-54-g00ecf


From d9af1744baa9db3b6c9c7eb9df057b965aa6e3ed Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Thu, 1 Apr 2021 17:17:00 -0500
Subject: Change cleanup and backup already performed messages.

---
 chapter7/backup.sh  | 2 +-
 chapter7/cleanup.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/chapter7/backup.sh b/chapter7/backup.sh
index 8b0944d..68b9824 100644
--- a/chapter7/backup.sh
+++ b/chapter7/backup.sh
@@ -4,7 +4,7 @@ file="${LFS_VER}-ch7-backup.tar.xz"
 directories=(bin dev etc lib lib64 proc run sbin sys tools usr var)
 
 if [ -f "${LFS}/sources/chapter7/backup" ]; then
-	echo -e "  ${IYLW}Chapter 7 ${IGRN}Backup found. Remove manually to backup again.${RST}"
+	echo -e "  ${IGRN}Backup found. Remove manually to backup again.${RST}"
 else
 
 	echo -ne "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${file}${RST}... "
diff --git a/chapter7/cleanup.sh b/chapter7/cleanup.sh
index f4a8333..95e1449 100644
--- a/chapter7/cleanup.sh
+++ b/chapter7/cleanup.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 if [ -f "${LFS}/sources/chapter7/cleanup" ]; then
-	echo -e "  ${IYLW}Chapter 7 ${IGRN}cleanup already performed.${RST}"
+	echo -e "  ${IGRN}Cleanup already performed.${RST}"
 else
 
 	echo -ne "${GRN}Cleaning up ${YLW}${LFS}${RST}... "
-- 
cgit v1.2.3-54-g00ecf


From 215711600f348efb37b13163b838ee06c6071ca9 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 2 Apr 2021 11:34:56 -0500
Subject: Use [[ ]] instead of [ ]

---
 lfs.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lfs.sh b/lfs.sh
index 873426c..eced325 100755
--- a/lfs.sh
+++ b/lfs.sh
@@ -160,7 +160,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
+if [[ "$retval" -eq 7 ]]; then
 	printf "%b" "${GRN}Unmounting Virtual Kernel Filesystems...\n"
 	sudo umount "${LFS}"/dev/pts
 	sudo umount "${LFS}"/dev/
-- 
cgit v1.2.3-54-g00ecf


From 95902f2386e5d79fdcd688aa27737af896b3ac28 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 2 Apr 2021 11:36:04 -0500
Subject: Use [[ ]] instead of [ ]

---
 insidechroot.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/insidechroot.sh b/insidechroot.sh
index d943214..c6ce796 100644
--- a/insidechroot.sh
+++ b/insidechroot.sh
@@ -156,7 +156,7 @@ EOF
 	for package in libstdc++ gettext bison perl python texinfo util-linux; do
 		source packageinstall.sh 7 $package
 		retval=$?
-		if [ "${retval}" -ne 0 ]; then
+		if [[ "${retval}" -ne 0 ]]; then
 			exit 1
 		fi
 	done
-- 
cgit v1.2.3-54-g00ecf


From eb35696e9b37f041ee4ddc606910abc5218fc9b4 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 2 Apr 2021 12:32:29 -0500
Subject: Format FAIL and OK messages with intense color. Reset colors before
 new line. Try to keep a sane style in the scripts.

---
 chapter7/backup.sh  | 4 ++--
 chapter7/cleanup.sh | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/chapter7/backup.sh b/chapter7/backup.sh
index 68b9824..2aac08e 100644
--- a/chapter7/backup.sh
+++ b/chapter7/backup.sh
@@ -13,10 +13,10 @@ else
 		spinner "$pid" "${SPINNER}"
 		retval=$?
 		if [ "${retval}" -ne 0 ]; then
-			echo -e "${RED}FAILED!${RST}"
+			echo -e "${IRED}FAILED!${RST}\n"
 			exit "${retval}"
 		else
-			echo -e "${GRN}OK${RST}"
+			echo -e "${IGRN}OK${RST}\n"
 		fi
 	popd > /dev/null || exit 1
 
diff --git a/chapter7/cleanup.sh b/chapter7/cleanup.sh
index 95e1449..60a934f 100644
--- a/chapter7/cleanup.sh
+++ b/chapter7/cleanup.sh
@@ -18,6 +18,6 @@ else
 	sudo strip --strip-unneeded "${LFS}"/usr/sbin/* >/dev/null 2>&1
 	sudo strip --strip-unneeded "${LFS}"/tools/bin/* >/dev/null 2>&1
 
-	echo -e "${GRN}OK${RST}"
+	echo -e "${IGRN}OK${RST}\n"
 	touch "${LFS}"/sources/chapter7/cleanup >/dev/null 2>&1
 fi
-- 
cgit v1.2.3-54-g00ecf


From d15a78517dfa18948aaf9ae91b19cdc2de5df998 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Fri, 2 Apr 2021 13:36:51 -0500
Subject: Cleanup information messages for chapater 7 backup and cleanup and
 change from echo to printf.

---
 chapter7/backup.sh  | 8 ++++----
 chapter7/cleanup.sh | 6 +++---
 lfs.sh              | 3 ++-
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/chapter7/backup.sh b/chapter7/backup.sh
index 2aac08e..a6abb86 100644
--- a/chapter7/backup.sh
+++ b/chapter7/backup.sh
@@ -4,19 +4,19 @@ file="${LFS_VER}-ch7-backup.tar.xz"
 directories=(bin dev etc lib lib64 proc run sbin sys tools usr var)
 
 if [ -f "${LFS}/sources/chapter7/backup" ]; then
-	echo -e "  ${IGRN}Backup found. Remove manually to backup again.${RST}"
+	printf "%b" "  ${IGRN}Backup previously completed${RST}\n"
 else
 
-	echo -ne "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${file}${RST}... "
+	printf "%b" "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${file}${RST}... "
 	pushd "${LFS}" > /dev/null || exit 1
 		sudo XZ_OPTS="-T${NUMPROCS} -e" tar cJpf "${HOME}"/"${file}" "${directories[@]}" >/dev/null 2>&1 & pid=$!
 		spinner "$pid" "${SPINNER}"
 		retval=$?
 		if [ "${retval}" -ne 0 ]; then
-			echo -e "${IRED}FAILED!${RST}\n"
+			printf "%b" "${IRED}FAILED!${RST}\n"
 			exit "${retval}"
 		else
-			echo -e "${IGRN}OK${RST}\n"
+			printf "%b" "${IGRN}OK${RST}\n"
 		fi
 	popd > /dev/null || exit 1
 
diff --git a/chapter7/cleanup.sh b/chapter7/cleanup.sh
index 60a934f..0a5ec86 100644
--- a/chapter7/cleanup.sh
+++ b/chapter7/cleanup.sh
@@ -1,10 +1,10 @@
 #!/bin/bash
 
 if [ -f "${LFS}/sources/chapter7/cleanup" ]; then
-	echo -e "  ${IGRN}Cleanup already performed.${RST}"
+	printf "%b" "  ${IGRN}Cleanup already performed${RST}\n"
 else
 
-	echo -ne "${GRN}Cleaning up ${YLW}${LFS}${RST}... "
+	printf "%b" "${GRN}Cleaning up ${YLW}${LFS}${RST}... "
 
 	sudo find "${LFS}"/usr/lib -name \*.la -delete >/dev/null 2>&1
 	sudo find "${LFS}"/usr/libexec -name \*.la -delete >/dev/null 2>&1
@@ -18,6 +18,6 @@ else
 	sudo strip --strip-unneeded "${LFS}"/usr/sbin/* >/dev/null 2>&1
 	sudo strip --strip-unneeded "${LFS}"/tools/bin/* >/dev/null 2>&1
 
-	echo -e "${IGRN}OK${RST}\n"
+	printf "%b" "${IGRN}OK${RST}\n"
 	touch "${LFS}"/sources/chapter7/cleanup >/dev/null 2>&1
 fi
diff --git a/lfs.sh b/lfs.sh
index bdd8659..55bdfb6 100755
--- a/lfs.sh
+++ b/lfs.sh
@@ -169,7 +169,8 @@ if [[ "$retval" -eq 7 ]]; then
 	sudo umount "${LFS}"/sys
 	sudo umount "${LFS}"/proc
 
-    printf "%b" "\n${YLW}Chapter 7 ${GRN}cleanup and backup${RST}\n"
+	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
-- 
cgit v1.2.3-54-g00ecf


From 091055a1f954a780fb9feff6f6b46f78be451ee8 Mon Sep 17 00:00:00 2001
From: William Harrington <kb0iic@berzerkula.org>
Date: Sat, 3 Apr 2021 01:50:42 -0500
Subject: Use intensity for OK and adjust message.

---
 insidechroot.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/insidechroot.sh b/insidechroot.sh
index 486c252..a2fb9df 100644
--- a/insidechroot.sh
+++ b/insidechroot.sh
@@ -83,7 +83,7 @@ if [[ "${CHAPTER}" -eq 7 ]]; then
 		install -d -m 0750 /root
 		install -d -m 1777 /tmp /var/tmp
 
-		printf "%b" "  ${GRN}Directories created${RST}\n"
+		printf "%b" "  ${IGRN}OK${RST}\n"
 		touch /sources/createdirs
 	fi
 
-- 
cgit v1.2.3-54-g00ecf