-
Notifications
You must be signed in to change notification settings - Fork 16
/
5.3-lfs_check-tools.sh
97 lines (83 loc) · 2.17 KB
/
5.3-lfs_check-tools.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
CHAPTER_SECTION=3
echo ""
echo "### ---------------------------"
echo "### CHECK TOOLS ###"
echo "### CHAPTER 5.$CHAPTER_SECTION ###"
echo "### Check tools for compilation"
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
echo ""
echo "... Checking symlinked tools for compilation"
echo ".... 1/5 Looking for /bin/sh"
if [ $( readlink -f /bin/sh ) != "/bin/bash" ]
then
echo "!! Fatal Error 3: /bin/sh is not symlinked to /bin/bash"
exit 3
else
echo "-> Correct"
fi
echo ".... 2/5 Looking for /usr/bin/awk"
if [ $( readlink -f /usr/bin/awk ) != "/usr/bin/gawk" ]
then
echo "!! Fatal Error 3: /usr/bin/awk is not symlinked to /usr/bin/gawk"
exit 3
else
echo "-> Correct"
fi
echo ".... 3/5 Looking for /usr/bin/gawk"
if [ ! -f /usr/bin/gawk ]
then
echo "!! Fatal Error 1: '/usr/bin/gawk' not found."
exit 1
else
echo "-> Correct"
fi
echo ".... 4/5 Looking for /usr/bin/yacc"
if [ $( readlink -f /usr/bin/yacc ) != "/usr/bin/bison.yacc" ]
then
echo "!! Fatal Error 3: /usr/bin/yacc is not symlinked to /usr/bin/bison.yacc"
exit 3
else
echo "-> Correct"
fi
echo ".... 5/5 Looking for /usr/bin/bison.yacc"
if [ ! -f /usr/bin/bison.yacc ]
then
echo "!! Fatal Error 1: '/usr/bin/bison.yacc' not found."
exit 1
else
echo "-> Correct"
fi
echo ""
echo "///// HUMAN REQUIRED \\\\\\\\\\\\\\\\\\\\"
echo "Read carefully above, no errors should be detected"
echo ""
echo -e "\a"
read -p "Enter to confirm" -n 1 -r
echo ""
echo ""
echo "######### END OF CHAPTER 5.$CHAPTER_SECTION ########"
echo "///// HUMAN REQUIRED \\\\\\\\\\\\\\\\\\\\"
echo "### Please run the next step:"
echo "### ./5.4-lfs_binutils-2.25.1-pass-1.sh"
echo ""
exit 0