Sunday, November 26, 2006

Catch the bootloader

Copy and paste the following and put into a file (redboot.exp):

#!/bin/sh
# the next line restarts using expect interpreter \
  exec expect "$0" "$@"

exp_internal 0
log_user 0
exp_internal -f "/tmp/redboot-int.log" 0
set logfile [open "/tmp/redboot.log" "a"]

spawn arping -f 192.168.0.1
set timeout 45
puts $logfile "Spawn started (arping)"; flush $logfile
expect EOF

spawn telnet 192.168.0.1 9000
set timeout 45
expect "enter ^C to abort"
send "\003"

expect "RedBoot>"
send_user "RedBoot> "
interact

No comments: