BBB System Configuration Testing Script

I’m working on a testing script to see if my server can run BBB. Useful if you’re building old systems to use as a development box.

#! /bin/bash

echo "BBB system verification test."
echo "This must be run as root."

. /etc/default/locale

if [[ "$LANG" != "en_US.UTF-8" ]] ; then
    echo "LANG is not en_US.UTF-8"
    exit 1 
fi
echo LANG is $LANG

count=`systemctl show-environment | grep LANG | wc -l`
if [[ $count != '1' ]] ; then
    echo 'LANG is not in systemctl environment'
    exit 1
fi
echo LANG is in systemctl environment

memkb=`cat /proc/meminfo | grep MemTotal | perl -p -e 's/^.+? ([0-9]+?) .+$/$1/'`
if [[ $memkb < 4194304 ]] ; then
    echo 'Memory is less than 4GB'
    exit 1
fi
echo Memory is $memkb kB

. /etc/lsb-release
if [[ $DISTRIB_ID != 'Ubuntu' ]] ; then
    echo "Distro must be Ubuntu"
    exit 1
fi
if [[ $DISTRIB_RELEASE < '16.04' ]] ; then
    # fixme - this is not the right way to test for this
    echo "Distro must be Ubuntu 16.04 or later"
    exit 1
fi
echo Distro is Ubuntu 16.04 or later

arch=`uname -m`
if [[ $arch != 'x86_64' ]] ; then
    echo 'Architecture is not x86_64'
    exit 1
fi
echo Architecture is $arch

count=`ip addr | grep inet6 | wc -l`
if [[ $count == 0 ]] ; then
    echo 'No IPv6 support'
    exit 1
fi
echo IPv6 supported

uname=`uname -r`
major=`echo $uname | perl -p -e 's/^([0-9]+?)\.([0-9]+?)\.(.*)$/$1/'`
minor=`echo $uname | perl -p -e 's/^([0-9]+?)\.([0-9]+?)\.(.*)$/$2/'`
if [[ $major < 4 ]] ; then
    echo 'Kernel must be 4.15 or later'
    exit 1
fi
if [[ $major == 4 ]] ; then
    if [[ $minor < 15 ]] ; then
        echo 'Kernel must be 4.15 of later. You have 4.'
        exit 1
    fi
fi
echo Kernel version $uname

cores=`cat /proc/cpuinfo | awk '/^processor/{print $3}' | wc -l`
if [[ $cores < 4 ]] ; then
    echo 'Need at leat 4 cores'
    exit 1
fi
echo $cores cores

This is based on the BBB installation instructions. It doesn’t do everything, just several preflighting tasks. It ends before the Firewall section.