#!/usr/bin/expect -f

# Set up flash for fsest/fstest2, but this time
# build the files from an erased flash, rather than importing
# a filesystem image.
#

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 "eraseall /dev/mtd0\r"
expect "#"

send "mount -n -t jffs2 /dev/mtdblock0 /flash\r"
expect "#"

send "cd /flash\r"
expect "#"

send "makefiles\r"
expect "#"

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

exit 0
