Fernando de Oliveira wrote:

> I like this. Output from
>
> $ cat /etc/lfs-release
> SVN-20120311

Here is another version.  I can't say I really like it.  The original is 
40 lines and this is 73.  All this because users either don't have 
enough experience to understand what's there now or because a user 
(generally experienced) just skips it.

After all, the book says:

/bin/sh should be a symbolic or hard link to bash
/usr/bin/yacc should be a link to bison or small script that executes bison
/usr/bin/awk should be a link to gawk

We then print out all the current values on the system.

How much hand holding do we need to do?

   -- Bruce

#!/bin/bash
# Simple script to list version numbers of critical development tools

function die
{
   rm -f dummy.c dummy
   echo "Error: $1"
   exit 1
}

function executable
{
   EXE=$(which $1 2>/dev/null)
   [ -x "$EXE" ] || die "$1 not found"
}

export LC_ALL=C
bash --version | head -n1 | cut -d" " -f2-4

SH=`readlink -f /bin/sh`
echo "/bin/sh -> $SH"
[ "$SH" ==  "/bin/bash" ] || die "/bin/sh is not a symlink to bash"

executable ld
echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3-

executable bison; bison --version | head -n1

if [ -e /usr/bin/yacc ];
   then echo "/usr/bin/yacc -> `readlink -f /usr/bin/yacc`";
   else die "yacc not found"; fi

executable bzip2
bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f1,6-

executable chown
echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2

executable diff; diff --version | head -n1
executable find; find --version | head -n1
executable gawk; gawk --version | head -n1

AWK=`readlink -f /usr/bin/awk`
awk=/usr/bin/awk
echo "$awk -> $AWK"
[ "$AWK" ==  "/usr/bin/gawk" ] || die "$awk is not a symlink to gawk"

executable gcc; gcc --version | head -n1

echo 'main(){}' > dummy.c && gcc -o dummy dummy.c
if [ -x dummy ]
   then
     echo "gcc compilation OK"
     rm -f dummy.c dummy
   else
     die "gcc compilation failed"
fi

executable ldd;      ldd --version | head -n1 | cut -d" " -f2-  # glibc
executable grep;     grep --version | head -n1
executable gzip;     gzip --version | head -n1

cat /proc/version;
executable m4;       m4 --version | head -n1
executable make;     make --version | head -n1
executable patch;    patch --version | head -n1
executable perl;     echo Perl `perl -V:version`
executable sed;      sed --version | head -n1
executable tar;      tar --version | head -n1
executable makeinfo; echo "Texinfo: `makeinfo --version | head -n1`"
executable xz;       xz --version | head -n1

echo -e "\n\n*** Review all versions for currency!"
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to