move driver code for chapter 9 inside chapter 9 folder

This commit is contained in:
Aditya 2023-01-22 22:14:06 +05:30
parent 2f06e904ba
commit c094fafccc
2 changed files with 83 additions and 53 deletions

79
scripts/chapter9/main.sh Normal file
View file

@ -0,0 +1,79 @@
#!/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 9.2
# ===========
echo "Installing LFS bootscripts"
su -c "$SCRIPT/chapter9/9.2-lfs-bootscripts.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter9/9.2-lfs-bootscripts.sh"
fi
# Chapter 9.6
# ===========
echo "Configuring sysvinit"
su -c "bash $SCRIPT/chapter9/9.6-configure-sysvinit.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter9/9.6-configure-sysvinit.sh"
fi
# Chapter 9.7
# ===========
echo "Configurintg shell startup files"
su -c "bash $SCRIPT/chapter9/9.7-shell-startup.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter9/9.7-shell-startup.sh"
fi
# Chapter 9.8
# ===========
echo "Creating /etc/inputrc"
su -c "bash $SCRIPT/chapter9/9.8-inputrc.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter9/9.8-inputrc.sh"
fi
# Chapter 9.9
# ===========
echo "Creating /etc/shells"
su -c "bash $SCRIPT/chapter9/9.9-shells.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter9/9.9-shells.sh"
fi

View file

@ -189,65 +189,16 @@ then
stop_script "Stopped in chapter 8"
fi
# Chapter 9.2
# ===========
# Chapter 9
# =========
echo "Chapter 9"
echo "Installing LFS bootscripts"
su -c "SCRIPT/chapter9/9.2-lfs-bootscripts.sh"
bash ./chapter9/main.sh
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter9/9.2-lfs-bootscripts.sh"
fi
# Chapter 9.6
# ===========
echo "Configuring sysvinit"
su -c "bash $SCRIPT/chapter9/9.6-configure-sysvinit.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter9/9.6-configure-sysvinit.sh"
fi
# Chapter 9.7
# ===========
echo "Configurintg shell startup files"
su -c "bash $SCRIPT/chapter9/9.7-shell-startup.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter9/9.7-shell-startup.sh"
fi
# Chapter 9.8
# ===========
echo "Creating /etc/inputrc"
su -c "bash $SCRIPT/chapter9/9.8-inputrc.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter9/9.8-inputrc.sh"
fi
# Chapter 9.9
# ===========
echo "Creating /etc/shells"
su -c "bash $SCRIPT/chapter9/9.9-shells.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter9/9.9-shells.sh"
stop_script "Stopped in chapter 9"
fi
# Chapter 10.2