~brendan-donegan/checkbox/bug926417_cli_plus_help

« back to all changes in this revision

Viewing changes to scripts/memory_compare

  • Committer: Brendan Donegan
  • Date: 2012-02-02 17:27:37 UTC
  • mfrom: (1217.2.1 memory_compare_tweaks)
  • Revision ID: brendan.donegan@canonical.com-20120202172737-sdj35dpyytwbkuj0
Merged memory compare tweaks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/bash
2
2
 
 
3
MIN_LEVEL=90
 
4
 
3
5
meminfo_total=`grep 'MemTotal' /proc/meminfo | awk '{print $2}'`
4
6
meminfo_units=`grep 'MemTotal' /proc/meminfo | awk '{print $3}'`
5
7
 
7
9
 
8
10
dmi_total=0
9
11
 
10
 
for size in `dmidecode | grep -A10 'DMI type 17' | grep Size | grep -o [0-9]*`
 
12
for size in `dmidecode -t 17 | grep Size | grep -o [0-9]*`
11
13
do
12
14
    dmi_total=`echo $dmi_total + $size | bc`
13
15
done
18
20
accuracy=`echo "scale=2; $meminfo_total / $dmi_total * 100" | bc`
19
21
echo "Accuracy: $accuracy"
20
22
 
21
 
if [ ${accuracy::-3} -lt 95 ]
 
23
if [ ${accuracy::-3} -lt $MIN_LEVEL ]
22
24
then
23
25
    echo "Memory totals not close enough"
24
26
    exit 1