mirror of
https://github.com/rxrbln/t2sde.git
synced 2025-05-08 20:21:59 +08:00
55 lines
825 B
Plaintext
55 lines
825 B
Plaintext
#!/usr/bin/expect -f
|
|
|
|
set qemu [lindex $argv 0]
|
|
set argv [lreplace $argv 0 0]
|
|
|
|
# Wait enough (forever) until a long-time boot
|
|
set timeout 30
|
|
#timeout {exit 1}
|
|
|
|
# Start the guest VM
|
|
spawn $qemu -nographic {*}$argv
|
|
|
|
# TODO: detect grub and send \n to avoid delay
|
|
|
|
if { [string match "*-*86*" $qemu] } {
|
|
expect {
|
|
timeout {exit 1}
|
|
"*GNU GRUB*"
|
|
}
|
|
|
|
set send_slow {3 .1}
|
|
|
|
# edit grub entry w/ arrow key escapes and C-x
|
|
send "e"
|
|
send -s "\033\[B\033\[B\033\[B\033\[D"
|
|
|
|
#after 10
|
|
send -s " console=ttyS0\030"
|
|
}
|
|
|
|
set send_slow {8 .1}
|
|
|
|
expect {
|
|
timeout {exit 1}
|
|
"T2 SDE installer first stage*"
|
|
}
|
|
|
|
expect {
|
|
timeout {exit 1}
|
|
"* hit enter otherwise. (default:*"
|
|
}
|
|
|
|
send "\n"
|
|
expect {
|
|
timeout {exit 1}
|
|
"install:/#"
|
|
}
|
|
|
|
|
|
send "echo o > /proc/sysrq-trigger\n"
|
|
expect {
|
|
timeout {exit 1}
|
|
"reboot: Power down"
|
|
}
|