mirror of
https://git.adityakumar.xyz/lfs-scripts.git
synced 2024-11-09 23:19:44 +00:00
Stop relying on SU
This commit is contained in:
parent
adf65dfb8c
commit
0b97320e00
1 changed files with 74 additions and 17 deletions
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Set SU
|
||||
# ======
|
||||
if [ $? -eq 1 ]
|
||||
then
|
||||
SU=doas
|
||||
|
@ -8,6 +9,8 @@ else
|
|||
SU=sudo
|
||||
fi
|
||||
|
||||
# Exit on error
|
||||
# =============
|
||||
exit_status=0
|
||||
|
||||
function check_exit_code() {
|
||||
|
@ -24,35 +27,89 @@ function stop_script() {
|
|||
exit 1
|
||||
}
|
||||
|
||||
|
||||
# Chapter 2
|
||||
# =========
|
||||
echo "Chapter 2"
|
||||
echo "Checking required packages"
|
||||
bash ./chapter2/2.2-version-check.sh
|
||||
|
||||
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
|
||||
|
||||
|
||||
# Exit on error
|
||||
check_exit_code
|
||||
if [ $exit_status -ne 0 ]
|
||||
then
|
||||
stop_script "chapter2/2.2-version-check.sh"
|
||||
fi
|
||||
|
||||
|
||||
# Set LFS variable
|
||||
# ================
|
||||
export LFS=/mnt/lfs
|
||||
echo "LFS is $LFS"
|
||||
|
||||
# Chapter 2.5
|
||||
# ===========
|
||||
echo "Creating filesystem"
|
||||
su -c "bash ./chapter2/2.5-create-filesystem.sh"
|
||||
|
||||
# Exit on error
|
||||
check_exit_code
|
||||
if [ $exit_status -ne 0 ]
|
||||
then
|
||||
stop_script "chapter2/2.5-create-filesystem.sh"
|
||||
fi
|
||||
|
||||
|
||||
# Chapter 2.7
|
||||
# ===========
|
||||
echo "Mounting filesystem"
|
||||
su -c "bash ./chapter2/2.7-mount.sh"
|
||||
|
||||
# Exit on error
|
||||
check_exit_code
|
||||
if [ $exit_status -ne 0 ]
|
||||
then
|
||||
stop_script "chapter2/2.7-mount.sh"
|
||||
fi
|
||||
|
||||
|
||||
# Chapter 3
|
||||
# =========
|
||||
echo "Chapter 3"
|
||||
echo "Downloading sources"
|
||||
bash ./chapter3/3.1-sources.sh
|
||||
|
||||
# Exit on error
|
||||
check_exit_code
|
||||
if [ $exit_status -ne 0 ]
|
||||
then
|
||||
stop_script "chapter3/3.1-sources.sh"
|
||||
fi
|
||||
|
||||
|
||||
# Chapter 4
|
||||
# =========
|
||||
echo "Chapter 4"
|
||||
echo "Creating direcctories"
|
||||
su -c "bash ./chapter4/4.2-create-dir.sh"
|
||||
|
||||
# Exit on error
|
||||
check_exit_code
|
||||
if [ $exit_status -ne 0 ]
|
||||
then
|
||||
stop_script "chapter4/4.2-create-dir.sh"
|
||||
fi
|
||||
|
||||
|
||||
# Chapter 4.3
|
||||
# ===========
|
||||
echo "Adding LFS user"
|
||||
su -c "bash ./chapter4/4.3-add-user.sh"
|
||||
|
||||
# Exit on error
|
||||
check_exit_code
|
||||
if [ $exit_status -ne 0 ]
|
||||
then
|
||||
stop_script "chapter4/4.3-add-user.sh"
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue