collect: A scoring system was implanted to determinate if is a UCA classmate

Signed-off-by: 's avatarEdileuton Henrique de Oliveira <eho09@c3sl.ufpr.br>
parent dab7762c
......@@ -19,15 +19,54 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
#------------------------------------------------------------------------------
# Function: ucaClassmate
# Verify if is a UCA classmate.
# Return true or false.
function ucaClassmate()
{
count=0
#UCA classmate features
UCA_processor_model="Intel(R) Atom(TM)"
UCA_processor_clock=1700.00
UCA_HD=4
UCA_memory=1025
UCA_CLASSMATE=$(grep "Metasys ClassmatePC" /etc/issue 2> /dev/null)
is_UCA=4
# check if Metasys is the SO installed
test -f "/etc/cmpc-release" -o -n "${UCA_CLASSMATE}" && count=$(($count+1))
# check if le-light is the SO installed
dpkg -l le-light-all 2> /dev/null | grep -q 'ii' && count=$(($count+1))
# check processor model
processor_clock=$(cat /proc/cpuinfo | grep -m 1 'cpu MHz' | awk -F' ' '{printf $4}')
echo $processor_clock '<' $UCA_processor_clock | test $(bc 2> /dev/null) -eq 1 && count=$(($count+1))
# check processor clock
processor_model=$(cat /proc/cpuinfo | grep -m 1 'model name' | awk -F' ' '{printf $4 " " $5}')
test "${processor_model}" = "${UCA_processor_model}" && count=$(($count+1))
# check HD
HD=$((($(cat /sys/block/sda/size 2> /dev/null || echo 0)*512)/1073741824))
test $HD -lt $UCA_HD && count=$(($count+1))
# check memory
memory=$(grep "MemTotal" /proc/meminfo | uniq | awk '{print $2/1024}')
echo $memory '<' $UCA_memory | test $(bc 2> /dev/null) -eq 1 && count=$(($count+1))
test $count -ge $is_UCA && return 0
return 1
}
PROJECTOR=$(grep "Projetor ProInfo" /etc/issue 2> /dev/null)
UCA_SERVER=$(grep "Metasys School Server" /etc/issue 2> /dev/null)
UCA_CLASSMATE=$(grep "Metasys ClassmatePC" /etc/issue 2> /dev/null)
if test -n "${PROJECTOR}" -o -f "/usr/sbin/projetor"; then
printf "3\n"
elif test -n "${UCA_SERVER}"; then
printf "2\n"
elif test -f "/etc/cmpc-release" -o -n "${UCA_CLASSMATE}"; then
elif ucaClassmate; then
printf "1\n"
else
printf "0\n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment