mirror of
https://git.adityakumar.xyz/lfs-scripts.git
synced 2024-11-21 19:52:52 +00:00
Add 4.4 - set up environment
This commit is contained in:
parent
adf65dfb8c
commit
378f236bcc
2 changed files with 109 additions and 17 deletions
20
scripts/chapter4/4.4-set-up-env.sh
Normal file
20
scripts/chapter4/4.4-set-up-env.sh
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
cat > ~/.bash_profile << "EOF"
|
||||
exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
|
||||
EOF
|
||||
|
||||
cat > ~/.bashrc << "EOF"
|
||||
set +h
|
||||
umask 022
|
||||
LFS=/mnt/lfs
|
||||
LC_ALL=POSIX
|
||||
LFS_TGT=$(uname -m)-lfs-linux-gnu
|
||||
PATH=/usr/bin
|
||||
if [ ! -L /bin ]; then PATH=/bin:$PATH; fi
|
||||
PATH=$LFS/tools/bin:$PATH
|
||||
CONFIG_SITE=$LFS/usr/share/config.site
|
||||
export LFS LC_ALL LFS_TGT PATH CONFIG_SITE
|
||||
EOF
|
||||
|
||||
source ~/.bash_profile
|
106
scripts/main.sh
106
scripts/main.sh
|
@ -1,6 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Set SU
|
||||
# ======
|
||||
command -v sudo > /dev/null
|
||||
if [ $? -eq 1 ]
|
||||
then
|
||||
SU=doas
|
||||
|
@ -8,6 +10,8 @@ else
|
|||
SU=sudo
|
||||
fi
|
||||
|
||||
# Exit on error
|
||||
# =============
|
||||
exit_status=0
|
||||
|
||||
function check_exit_code() {
|
||||
|
@ -24,35 +28,103 @@ 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
|
||||
|
||||
PWD=$(pwd)
|
||||
|
||||
# Chapter 4.4
|
||||
# ===========
|
||||
echo "Setting Up the Environment"
|
||||
su - lfs -c "$PWD/chapter4/4.4-set-up-env.sh"
|
||||
|
||||
|
||||
# Exit on error
|
||||
check_exit_code
|
||||
if [ $exit_status -ne 0 ]
|
||||
then
|
||||
stop_script "chapter4/4.4-set-up-env.sh"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue