move driver code for chapter 10 inside chapter 10 folder

This commit is contained in:
Aditya 2023-01-22 22:25:36 +05:30
parent c094fafccc
commit e42268b483
2 changed files with 59 additions and 29 deletions

55
scripts/chapter10/main.sh Normal file
View file

@ -0,0 +1,55 @@
#!/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
}
# Chapter 10.2
# ============
echo "Creating /etc/fstab"
su -c "bash $SCRIPT/chapter10/10.2-fstab.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter10/10.2-fstab.sh"
fi
# Chapter 10.3
# ============
echo "Building kernel"
su -c "bash $SCRIPT/chapter10/10.3-kernel.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter10/10.3-kernel.sh"
fi
# Chapter 10.4
# ============
echo "Installng grub"
su -c "bash $SCRIPT/chapter10/10.4-grub.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter10/10.4-grub.sh"
fi

View file

@ -201,41 +201,16 @@ then
stop_script "Stopped in chapter 9"
fi
# Chapter 10.2
# ============
# Chapter 10
# ==========
echo "Chapter 10"
echo "Creating /etc/fstab"
su -c "bash $SCRIPT/chapter10/10.2-fstab.sh"
bash ./chapter10/main.sh
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter10/10.2-fstab.sh"
fi
# Chapter 10.3
# ============
echo "Building kernel"
su -c "bash $SCRIPT/chapter10/10.3-kernel.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter10/10.3-kernel.sh"
fi
# Chapter 10.4
# ============
echo "Installng grub"
su -c "bash $SCRIPT/chapter10/10.4-grub.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter10/10.4-grub.sh"
stop_script "Stopped in chapter 10"
fi
# Chapter 11.1