-
Notifications
You must be signed in to change notification settings - Fork 16
/
4.4-lfs_setting-up-environment.sh
70 lines (62 loc) · 1.61 KB
/
4.4-lfs_setting-up-environment.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
echo ""
echo "### ---------------------------"
echo "### SET UP ENVIRONMENT ###"
echo "### CHAPTER 4.4 ###"
echo "### Setting Up the Environment"
echo "### Must be run as \"lfs\" user"
echo "### ---------------------------"
echo ""
echo "... Loading commun functions and variables"
if [ ! -f ./script-all_commun-functions.sh ]
then
echo "!! Fatal Error 1: './script-all_commun-functions.sh' not found."
exit 1
fi
source ./script-all_commun-functions.sh
if [ ! -f ./script-all_commun-variables.sh ]
then
echo "!! Fatal Error 1: './script-all_commun-variables.sh' not found."
exit 1
fi
source ./script-all_commun-variables.sh
echo ""
echo "... Validating the environment"
check_partitions
is_user lfs
if [ $( readlink -f /bin/sh ) != "/bin/bash" ]
then
echo "!! Fatal Error 3: /bin/sh is not symlinked to /bin/bash"
exit 3
fi
echo ""
echo "... Setting up of the Environment"
echo ".... Making of .bash_profile"
cat > ~/.bash_profile << "EOF"
exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
EOF
echo ".... Making of .bashrc"
cat > ~/.bashrc << "EOF"
set +h
umask 022
LFS=/mnt/lfs
LC_ALL=POSIX
LFS_TGT=$(uname -m)-lfs-linux-gnu
PATH=/tools/bin:/bin:/usr/bin
export LFS LC_ALL LFS_TGT PATH
EOF
echo ""
echo "///// HUMAN REQUIRED \\\\\\\\\\\\\\\\\\\\"
echo "Read carefully the following instructions"
echo ""
echo -e "\a"
read -p "Enter to confirm" -n 1 -r
echo ""
echo ""
echo "######### END OF CHAPTER 4.4 ########"
echo "///// HUMAN REQUIRED \\\\\\\\\\\\\\\\\\\\"
echo "### Please run the next steps:"
echo "### source ~/.bash_profile"
echo "### ./5.all-lfs_construct-tools.sh"
echo ""
exit 0