Merge pull request #247 from ThomasKaiser/master

In case a really slow SD card is used display warning at 3rd boot
This commit is contained in:
Igor Pečovnik 2016-03-28 18:50:24 +02:00
commit 7973c070f5

View File

@ -254,10 +254,32 @@ EOT
chmod +x /etc/update-motd.d/90-warning
} # show_motd_warning
check_sd_card_speed() {
# function that checks on 3rd boot whether firstrun script made a quick
# benchmark when a SD card with 4GB or less capacity has been detected
# and displays a warning when random I/O is below some tresholds.
RebootCount=$(grep -c '^### df:' /var/log/armhwinfo.log)
if [ ${RebootCount} -eq 2 ]; then
# check whether iozone data has been collected
IozoneResults="$(awk -F" " '/^### quick iozone test/ {print $10"\t"$11}' </var/log/armhwinfo.log)"
if [ "X${IozoneResults}" != "X" ]; then
set ${IozoneResults}
Readspeed=$1
Writespeed=$2
if [ ${Readspeed} -lt 800 -o ${Writespeed} -lt 400 ]; then
show_motd_warning "Your SD card seems to be very slow. Please check performance using armbianmonitor -c"
fi
fi
fi
} # check_sd_card_speed
case $1 in
*start*)
# set optimal disk scheduler settings
set_io_scheduler &
# check sd card speed once
check_sd_card_speed &
# get hardware informations
collect_informations