set timeout 60 set FINISHED 0 set EXIT "1" spawn socat unix-connect:vm/console - expect { "BusyBox" { } "#" { } } send "\r\n" expect { "#" { send "NOT=not_present\r" } } expect "#" while { $FINISHED < 10 } { send "date && grep AP-ENABLED /run/uncaught-logs/* || echo \$NOT\r\n" expect { "wlan0: AP-ENABLED" { set FINISHED 999; set EXIT 0; } "not_present" { send_user "waiting ...\n" ; sleep 5 } } set FINISHED [ expr $FINISHED + 1 ] } if { $EXIT > 0 } { send "tail -40 /run/uncaught-logs/current\r\n" expect "#" } exit $EXIT