Default
LFS related scripts
C. BinKadal --- Sendirian, Berhad


LFS related scripts

These are Linux From Scratch (LFS) related scripts.


File version-check.sh (Download)

#!/bin/bash
# Copyright © 1999-2022 Gerard Beekmans, modified by C. BinKadal.
# See file LICENCE-MIT.
# START: Mon 04 Jul 2022 13:00
#
# 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


File SBU-check.sh (Download)

#!/bin/bash
# VER06: Mon 04 Jul 2022 16:00
# VER05: Tue 03 May 2022 18:30
# Adapted from LFS:  © 1999-2022 Gerard Beekmans
# Modified by C. BinKadal. See file LICENCE-MIT.
#
LOG="/tmp/tmpLFS-SBU.log"
BINUTILS="binutils-2.38"
TARBALL="$LFS/sources/$BINUTILS.tar.xz"
[ -f $TARBALL ]            || { echo "$TARBALL file: Not found";        exit 1; }
[[ "$(whoami)" == "lfs" ]] || { echo 'Run this script with user "LFS"'; exit 2; }
time {
    echo "HOSTNAME: $(hostname) -- DATE: $(date)"
    pushd  $LFS/sources/
    rm -rf $BINUTILS/
    echo  "tar..."
    tar    xf $TARBALL
    cd     $BINUTILS/
    mkdir -pv build/
    cd     build/
    echo  "configure..." | tee $LOG
    ../configure --prefix=$LFS/tools \
                 --with-sysroot=$LFS \
                 --target=$LFS_TGT   \
                 --disable-nls       \
                 --disable-werror &>> $LOG
    echo "make..." | tee -a $LOG
    make &>> $LOG
    echo "make install"
    make install &>> $LOG
    popd
    rm -rf $BINUTILS/
    CPUINFO=$(grep -E 'model +name.+' /proc/cpuinfo | head -1 |\
       awk '{$1="";$2="";$3="";print}' | sed -e 's/^   //')
    MYMEM=$(free  --giga|grep ^Mem:|awk  '{print $2}')
    MYSWAP=$(free --giga|grep ^Swap:|awk '{print $2}')
    echo "Memory: $MYMEM GB -- Swap: $MYSWAP GB -- MAKEFLAGS: $MAKEFLAGS"
    echo -n "Standard Build Unit (SBU) for $CPUINFO"
    echo "===== ====="
    echo "Do cross check for ERRORs in file $LOG"
} 


DISCLAIMER


This is the WAY! This MEMO is mainly written for OWN PURPOSES. It is based on "Google Here, Google There, and Everywhere (GSGS)." Whether this is PLAGIARY or RESEARCH, there has never been a claim that this is an original work, nor is it necessarily the best solution, and not for Scopus consumption :). Please provide feedback, especially if you have alternative explanations. Hopefully, this note will be helpful in the future when you have forgotten how to solve this trivia problem.



© 2022-2022 --- C. BinKadal --- About --- Revision: 0020--26-Jul-2022.