mirror of
https://git.adityakumar.xyz/lfs-scripts.git
synced 2024-12-22 15:22:56 +00:00
create ch2 - version-check
This commit is contained in:
parent
0cf52b5f1b
commit
910e521b3c
2 changed files with 82 additions and 0 deletions
54
scripts/chapter2/2.2-version-check.sh
Normal file
54
scripts/chapter2/2.2-version-check.sh
Normal file
|
@ -0,0 +1,54 @@
|
|||
#!/bin/bash
|
||||
## Simple script to list version numbers of critical development tools
|
||||
|
||||
export LC_ALL=C
|
||||
bash --version | head -n1 | cut -d" " -f2-4
|
||||
MYSH=$(readlink -f /bin/sh)
|
||||
echo "/bin/sh -> $MYSH"
|
||||
echo $MYSH | grep -q bash || echo "ERROR: /bin/sh does not point to bash"
|
||||
unset MYSH
|
||||
|
||||
echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3-
|
||||
bison --version | head -n1
|
||||
|
||||
if [ -h /usr/bin/yacc ]; then
|
||||
echo "/usr/bin/yacc -> `readlink -f /usr/bin/yacc`";
|
||||
elif [ -x /usr/bin/yacc ]; then
|
||||
echo yacc is `/usr/bin/yacc --version | head -n1`
|
||||
else
|
||||
echo "yacc not found"
|
||||
fi
|
||||
|
||||
echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2
|
||||
diff --version | head -n1
|
||||
find --version | head -n1
|
||||
gawk --version | head -n1
|
||||
|
||||
if [ -h /usr/bin/awk ]; then
|
||||
echo "/usr/bin/awk -> `readlink -f /usr/bin/awk`";
|
||||
elif [ -x /usr/bin/awk ]; then
|
||||
echo awk is `/usr/bin/awk --version | head -n1`
|
||||
else
|
||||
echo "awk not found"
|
||||
fi
|
||||
|
||||
gcc --version | head -n1
|
||||
g++ --version | head -n1
|
||||
grep --version | head -n1
|
||||
gzip --version | head -n1
|
||||
cat /proc/version
|
||||
m4 --version | head -n1
|
||||
make --version | head -n1
|
||||
patch --version | head -n1
|
||||
echo Perl `perl -V:version`
|
||||
python3 --version
|
||||
sed --version | head -n1
|
||||
tar --version | head -n1
|
||||
makeinfo --version | head -n1 # texinfo version
|
||||
xz --version | head -n1
|
||||
|
||||
echo 'int main(){}' > dummy.c && g++ -o dummy dummy.c
|
||||
if [ -x dummy ]
|
||||
then echo "g++ compilation OK";
|
||||
else echo "g++ compilation failed"; fi
|
||||
rm -f dummy.c dummy
|
28
scripts/main.sh
Normal file
28
scripts/main.sh
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
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
|
||||
|
||||
check_exit_code
|
||||
if [ $exit_status -ne 0 ]
|
||||
then
|
||||
stop_script "chapter2/2.2-version-check.sh"
|
||||
fi
|
||||
|
Loading…
Reference in a new issue