55 lines
960 B
Text
55 lines
960 B
Text
set timeout 10
|
|
|
|
set when [lindex $argv 0];
|
|
|
|
spawn socat -,echo=0,icanon=1 unix-connect:vm/monitor
|
|
set monitor_id $spawn_id
|
|
|
|
spawn socat unix-connect:vm/console -
|
|
set console_id $spawn_id
|
|
|
|
proc chat {instr outstr} {
|
|
expect {
|
|
$instr { send $outstr }
|
|
timeout { exit 1 }
|
|
}
|
|
}
|
|
|
|
proc adddevice { } {
|
|
global monitor_id console_id spawn_id
|
|
set spawn_id $monitor_id
|
|
|
|
chat "QEMU" "device_add usb-storage,bus=xhci.0,drive=usbstick\n"
|
|
chat "(qemu)" "version\r"
|
|
|
|
set spawn_id $console_id
|
|
expect {
|
|
"sda: sda1" { }
|
|
timeout { exit 1 }
|
|
}
|
|
}
|
|
|
|
if { $when eq "early" } {
|
|
adddevice
|
|
}
|
|
|
|
|
|
expect "BusyBox"
|
|
chat "#" "PS1=RE\\ADY_\\ ; stty -echo \r"
|
|
chat "READY_" "tail -f /run/uncaught-logs/current & \rs6-rc -b -a list\r"
|
|
|
|
chat "mount" "\r"
|
|
|
|
if { $when eq "late" } {
|
|
adddevice
|
|
}
|
|
|
|
send "\r"
|
|
set timeout 20
|
|
|
|
chat "READY_" "sleep 3; grep /srv /proc/mounts && hostname\r"
|
|
|
|
expect {
|
|
"inout" { }
|
|
timeout { exit 1 }
|
|
}
|