~racb/junk/pandakit

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/expect -f

set hostname [lindex $argv 0]
spawn /usr/lib/pandakit/console-rw $hostname
set timeout 30
expect {
    -ex "Hit any key to stop autoboot:" {send "\n"}
    timeout {send_user "timed out\n"; exit 1}
}
expect {
    -ex "Marvell>> " {sleep 2;send "dhcp\n"}
    timeout {send_user "timed out\n"; exit 1}
}
expect {
    timeout {send_user "timed out\n"; exit 1}
    -ex "egiga0 mvNetaPortEnable failed" {send_user "known race\n"; exit 75}
    -ex "Retry count exceeded" {send_user "bootp error\n"; exit 1}
    -ex "DHCP client bound to address"
}
expect { 
    -ex "Marvell>> " {send "pxe get\n"}
    timeout {send_user "timed out\n"; exit 1}
}
expect { 
    -ex "Marvell>> " {send "pxe boot\n"}
    timeout {send_user "timed out\n"; exit 1}
}
expect {
    timeout {send_user "timed out\n"; exit 1}
    -ex "Starting kernel ..."
}
set timeout 1900
expect {
    timeout {send_user "timed out\n"; exit 1}
    "Error parsing config file" {exit 4}
#    "Uncompressing Linux" {exit 99}
#    "Detecting network hardwar" {exit 0}
    "Oops" {exit 2}
    "panic occurred" {exit 6}
    "Kernel panic" {sleep 60; exit 7}
    "The debootstrap program exited with an error (return value 1)" {exit 3}
    "Press enter to continue" {exit 5}
# "Prompt: '?' for help>" as well as "Prompt: '?' for help, default=1>"
    "Prompt: '?' for help" {exit 8}
    "login:" {exit 0}
}