liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

wait-for-wlan.expect (538B)


      1 set timeout 60
      2 
      3 set FINISHED 0
      4 set EXIT "1"
      5 
      6 spawn socat unix-connect:vm/console -
      7 expect {
      8   "BusyBox" { }
      9   "#" { }
     10 }
     11 send "\r\n"
     12 expect {
     13   "#"  { send "NOT=not_present\r" }
     14 }
     15 expect "#"
     16 while { $FINISHED < 10 } {
     17   send "date && grep AP-ENABLED /run/log/* || echo \$NOT\r\n"
     18   
     19   expect {
     20     "wlan0: AP-ENABLED" { set FINISHED 999; set EXIT 0; }
     21     "not_present" { send_user "waiting ...\n" ; sleep 5 }
     22   }
     23   set FINISHED [ expr $FINISHED + 1 ]
     24 }
     25 
     26 if { $EXIT > 0 } {
     27   send "tail -40 /run/log/current\r\n"
     28   expect "#"
     29 }
     30 exit $EXIT