move driver code for chapter 5 inside chapter 5 folder

This commit is contained in:
Aditya 2023-01-22 21:25:59 +05:30
parent dc3d878e75
commit 6e0ab27a7a
2 changed files with 83 additions and 51 deletions

81
scripts/chapter5/main.sh Normal file
View file

@ -0,0 +1,81 @@
#!/bin/bash
# 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
}
PWD=$(pwd)
# Chapter 5.2
# ===========
echo "Building binutils"
su - lfs -c "bash $PWD/5.2-binutils.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter5/5.2-binutils.sh"
fi
# Chapter 5.3
# ===========
echo "Building gcc"
su - lfs -c "bash $PWD/5.3-gcc.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter5/5.3-gcc.sh"
fi
# Chapter 5.4
# ===========
echo "Building Linux API Headers"
su - lfs -c "bash $PWD/5.4-linux-headers.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter5/5.4-linux-headers.sh"
fi
# Chapter 5.5
# ===========
echo "Building glibc"
su - lfs -c "bash $PWD/5.5-glibc.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter5/5.5-glibc.sh"
fi
# Chapter 5.6
# ===========
echo "Building listdc++"
su - lfs -c "bash $PWD/5.6-libstdc++.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter5/5.6-libstdc++.sh"
fi

View file

@ -74,62 +74,13 @@ fi
# Chapter 5.2 # Chapter 5.2
# =========== # ===========
echo "Chapter 5" echo "Chapter 5"
echo "Building binutils" bash ./chapter5/main.sh
su - lfs -c "bash $PWD/chapter5/5.2-binutils.sh"
# Exit on error # Exit on error
check_exit_code check_exit_code
if [ $exit_status -ne 0 ] if [ $exit_status -ne 0 ]
then then
stop_script "chapter5/5.2-binutils.sh" stop_script "Stopped in chapter 5"
fi
# Chapter 5.3
# ===========
echo "Building gcc"
su - lfs -c "bash $PWD/chapter5/5.3-gcc.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter5/5.3-gcc.sh"
fi
# Chapter 5.4
# ===========
echo "Building Linux API Headers"
su - lfs -c "bash $PWD/chapter5/5.4-linux-headers.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter5/5.4-linux-headers.sh"
fi
# Chapter 5.5
# ===========
echo "Building glibc"
su - lfs -c "bash $PWD/chapter5/5.5-glibc.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter5/5.5-glibc.sh"
fi
# Chapter 5.6
# ===========
echo "Building listdc++"
su - lfs -c "bash $PWD/chapter5/5.6-libstdc++.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter5/5.6-libstdc++.sh"
fi fi
# Chapter 6.2 # Chapter 6.2