#!/usr/bin/expect -f

# Set up flash for fsest/fstest2
#

set timeout -1

spawn telnet zaphod 2016
set tel $spawn_id

spawn rst x
expect eof
wait


set spawn_id $tel

expect Download

spawn bootit
expect eof
wait

set spawn_id $tel

expect "ogin:"
send "root\r"

expect "rd:"
send "brecis\r"

expect "#"

send "portmap &\r"
expect "#"

send "mount -n 199.86.15.105:/home/steve/work/uClinux /mnt\r"
expect "#"

send "eraseall /dev/mtd0\r"
expect "#"

send "cd /mnt/brecis/mtdutils\r"
expect "#"

send "dd if=checkfs.img of=/dev/mtd0 bs=64k\r"
expect "#"

send "shutdown -h now\r"
expect "Download"

exit 0