move driver code for chapter 3 inside chapter 3 folder

This commit is contained in:
Aditya 2023-01-22 20:03:01 +05:30
parent e4c59cd8d6
commit 811dc4fe1d
2 changed files with 33 additions and 5 deletions

31
scripts/chapter3/main.sh Normal file
View file

@ -0,0 +1,31 @@
#!/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
}
echo "Downloading sources"
bash ./3.1-sources.sh
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter3/3.1-sources.sh"
fi

View file

@ -47,21 +47,18 @@ export LFS=/mnt/lfs
echo "LFS is $LFS"
# Chapter 3
# =========
echo "Chapter 3"
echo "Downloading sources"
bash ./chapter3/3.1-sources.sh
bash ./chapter3/main.sh
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter3/3.1-sources.sh"
stop_script "Stopped in chapter 3"
fi
# Chapter 4
# =========
echo "Chapter 4"