#!/bin/bash
#
# chkver 
#
# Show O/S details and physical/virtual
# Author: Arto Jääskeläinen 
#
# v1.0 Initial version
#
########################################################################

get_bits()
{
local bits
unset result
case $(uname -m) in
i586 | i686)    bits=32 ;;
x86_64)         bits=64 ;;
*)              bits=0  ;;
esac
result=$bits
}

get_issue()
{
result=$(sed '1q;d' /etc/issue| sed 's/\\.*//g;')
}

get_virtual()
{
result=$(dmesg | grep -Eio "VMware|QEMU|XEN" | grep . -m1)
}

echo
get_issue
echo "Issue:            $result"
get_bits
echo "Bit width:        $result bits"
echo "Kernel:           $(uname -r)"
if [ -d /proc/asound ]; then
echo "Sound:            $(cat /proc/asound/version)"
else
echo "Sound:            No ALSA found"
fi
get_virtual
if [ -n "$result" ]; then
echo "Virtual:          $result"
else
echo "Virtual:          Physical machine"
fi
echo


