lfs-scripts/scripts/main.sh

59 lines
797 B
Bash
Raw Normal View History

2023-01-05 06:17:49 +00:00
#!/bin/bash
2023-01-05 09:26:40 +00:00
# Set SU
if [ $? -eq 1 ]
then
SU=doas
else
SU=sudo
fi
2023-01-05 06:17:49 +00:00
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 "Chapter 2"
echo "Checking required packages"
bash ./chapter2/2.2-version-check.sh
2023-01-06 04:55:59 +00:00
echo "Creating filesystem"
$SU bash ./chapter2/2.5-create-filesystem.sh
echo "Mounting filesystem"
$SU bash ./chapter2/2.7-mount.sh
echo "Chapter 3"
echo "Downloading sources"
bash ./chapter3/3.1-sources.sh
echo "Chapter 4"
echo "Creating direcctories"
$SU bash ./chapter4/4.2-create-dir.sh
2023-01-05 06:17:49 +00:00
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter2/2.2-version-check.sh"
fi
2023-01-05 09:28:27 +00:00
# Set LFS variable
export LFS=/mnt/lfs
echo "LFS is $LFS"