From 1b8ca5c49cd20a605f765aa336419da6714926be Mon Sep 17 00:00:00 2001 From: Aditya Date: Sun, 22 Jan 2023 21:34:33 +0530 Subject: [PATCH] move driver code for chapter 6 inside chapter 6 folder --- scripts/chapter6/main.sh | 225 +++++++++++++++++++++++++++++++++++++++ scripts/main.sh | 4 +- 2 files changed, 227 insertions(+), 2 deletions(-) create mode 100644 scripts/chapter6/main.sh diff --git a/scripts/chapter6/main.sh b/scripts/chapter6/main.sh new file mode 100644 index 0000000..bf4d3e8 --- /dev/null +++ b/scripts/chapter6/main.sh @@ -0,0 +1,225 @@ +#!/bin/bash + +PWD=$(pwd) + +# Exit on error +# ============= +exit_status=0 + +function check_exit_code() { + if [ $? -ne 0 ] + then + exit_status=1 + else + exit_status=0 + fi +} + +function stop_script() { + echo "Script failed in $(pwd)/$1" + exit 1 +} + +# Chapter 6.2 +# =========== +echo "Building m4" +su - lfs -c "bash $PWD/6.2-m4.sh" + +# Exit on error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter6/6.2-m4.sh" +fi + +# Chapter 6.3 +# =========== +echo "Building ncurses" +su - lfs -c "bash $PWD/6.3-ncurses.sh" + +# Exit onn error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter6/6.3-ncurses.sh" +fi + +# Chapter 6.4 +# =========== +echo "Building bash" +su - lfs -c "bash $PWD/6.4-bash.sh" + +# Exit on error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter6/6.4-bash.sh" +fi + +# Chapter 6.5 +# =========== +echo "Building coreutils" +su - lfs -c "bash $PWD/6.5-coreutils.sh" + +# Exit on error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter6/6.5-ncurses.sh" +fi + +# Chapter 6.6 +# =========== +echo "Building diffutils" +su - lfs -c "bash $PWD/6.6-diffutils.sh" + +# Exit on error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter6/6.6-diffutils.sh" +fi + +# Chapter 6.7 +# =========== +echo "Building file" +su - lfs -c "bash $PWD/6.7-file.sh" + +# Exit on error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter6/6.7-file.sh" +fi + +# Chapter 6.8 +# =========== +echo "Building findutils" +su - lfs -c "bash $PWD/6.8-findutils.sh" + +# Exit on error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter6/6.8-findutils.sh" +fi + +# Chapter 6.9 +# =========== +echo "Building gawk" +su - lfs -c "bash $PWD/6.9-gawk.sh" + +# Exit on error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter6/6.9-gawk.sh" +fi + +# Chapter 6.10 +# ============ +echo "Building grep" +su - lfs -c "bash $PWD/6.10-grep.sh" + +# Exit on error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter6/6.10-grep.sh" +fi + +# Chapter 6.11 +# ============ +echo "Building gzip" +su - lfs -c "bash $PWD/6.11-gzip.sh" + +# Exit on error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter6/6.11-gzip.sh" +fi + +# Chapter 6.12 +# ============ +echo "Building make" +su - lfs -c "bash $PWD/6.12-make.sh" + +# Exit on error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter6/6.12-make.sh" +fi + +# Chapter 6.13 +# ============ +echo "Building patch" +su - lfs -c "bash $PWD/6.13-patch.sh" + +# Exit on error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter6/6.13-patch.sh" +fi + +# Chapter 6.14 +# ============ +echo "Building sed" +su - lfs -c "bash $PWD/6.14-sed.sh" + +# Exit on error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter6/6.14-sed.sh" +fi + +# Chapter 6.15 +# ============ +echo "Building tar" +su - lfs -c "bash $PWD/6.15-tar.sh" + +# Exit on error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter6/6.15-tar.sh" +fi + +# Chapter 6.16 +# ============ +echo "Building xz" +su - lfs -c "bash $PWD/6.16-xz.sh" + +# Exit on error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter6/6.16-xz.sh" +fi + +# Chapter 6.17 +# ============ +echo "Building binutils pass 2" +su - lfs -c "bash $PWD/6.17-binutils.sh" + +# Exit on error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter6/6.17-binutils.sh" +fi + +# Chapter 6.18 +# ============ +echo "Building gcc pass 2" +su - lfs -c "bash $PWD/6.18-gcc.sh" + +# Exit on error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter6/6.18-gcc.sh" +fi diff --git a/scripts/main.sh b/scripts/main.sh index 19cfad6..ecf2552 100644 --- a/scripts/main.sh +++ b/scripts/main.sh @@ -71,8 +71,8 @@ then stop_script "Stopped in chapter 4" fi -# Chapter 5.2 -# =========== +# Chapter 5 +# ========= echo "Chapter 5" bash ./chapter5/main.sh