Last active
January 26, 2022 15:15
-
-
Save Phate6660/ce6bc3455ca72ab39b7364a22c28da75 to your computer and use it in GitHub Desktop.
Modified version check script for LFS to make output a bit easier to read. WIP.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Simple script to list version numbers of critical development tools | |
## Original by LFS team / contributor(s), modified by Phate6660. | |
## Startup | |
export LC_ALL=C | |
## Aliases | |
bash_version="$(bash --version | head -n1 | cut -d" " -f2-4)" | |
binutils_version="$(ld --version | head -n1 | cut -d" " -f3-)" | |
bison_version="$(bison --version | head -n1)" | |
bzip2_version="$(bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f1,6-)" | |
coreutils_version="$(chown --version | head -n1 | cut -d")" -f2)" | |
diff_version="$(diff --version | head -n1)" | |
find_version="$(find --version | head -n1)" | |
gawk_version="$(gawk --version | head -n1)" | |
gcc_version="$(gcc --version | head -n1)" | |
gccplusplus_version="$(g++ --version | head -n1)" | |
glibc_version="$(ldd --version | head -n1 | cut -d" " -f2-)" | |
grep_version="$(grep --version | head -n1)" | |
gzip_version="$(gzip --version | head -n1)" | |
system_info="$(cat /proc/version)" | |
m4_version="$(m4 --version | head -n1)" | |
make_version="$(make --version | head -n1)" | |
patch_version="$(patch --version | head -n1)" | |
perl_version="$(perl -V:version)" | |
python_version="$(python3 --version)" | |
sed_version="$(sed --version | head -n1)" | |
tar_version="$(tar --version | head -n1)" | |
makeinfo_version="$(makeinfo --version | head -n1)" | |
xz_version="$(xz --version | head -n1)" | |
## Functions | |
shell_version() { | |
MYSH=$(readlink -f /bin/sh) | |
if echo $MYSH | grep -q bash; then | |
shell_version="/bin/sh -> $MYSH" | |
else | |
shell_version="ERROR: /bin/sh does not point to bash, please fix that." | |
fi | |
unset MYSH | |
} | |
yacc_version() { | |
if [ -h /usr/bin/yacc ]; then | |
yacc_version="/usr/bin/yacc -> $(readlink -f /usr/bin/yacc)" | |
elif [ -x /usr/bin/yacc ]; then | |
yacc_version="$(/usr/bin/yacc --version | head -n1)" | |
else | |
yacc_version="Not installed or not found." | |
fi | |
} | |
awk_version() { | |
if [ -h /usr/bin/awk ]; then | |
awk_version="/usr/bin/awk -> $(readlink -f /usr/bin/awk)"; | |
elif [ -x /usr/bin/awk ]; then | |
awk_version="$(/usr/bin/awk --version | head -n1)" | |
else | |
awk_version="awk not found" | |
fi | |
} | |
gccplusplus_complilation_test() { | |
echo 'int main(){}' > dummy.c && g++ -o dummy dummy.c | |
if [ -x dummy ]; then | |
gccplusplus_complilation_test="g++ compilation OK" | |
else | |
gccplusplus_complilation_test="g++ compilation failed" | |
fi | |
rm -f dummy.c dummy | |
} | |
main() { | |
echo " | |
awk = $awk_version | |
bash = $bash_version | |
binutils = $binutils_version | |
bison = $bison_version | |
bzip2 = $bzip2_version | |
coreutils = $coreutils_version | |
diff = $diff_version | |
find = $find_version | |
gawk = $gawk_version | |
gcc = $gcc_version | |
g++ = $gccplusplus_version | |
g++ compilation test = $gccplusplus_complilation_test | |
glibc = $glibc_version | |
grep = $grep_version | |
gzip = $gzip_version | |
system info = $system_info | |
m4 = $m4_version | |
make = $make_version | |
patch = $patch_version | |
perl = $perl_version | |
python = $python_version | |
sed = $sed_version | |
shell = $shell_version | |
tar = $tar_version | |
makeinfo = $makeinfo_version | |
xz = $xz_version | |
yacc = $yacc_version | |
" | |
} | |
## Run | |
awk_version | |
gccplusplus_complilation_test | |
shell_version | |
yacc_version | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example output: