From f47ee38cd5e8eb1e28f96c98cb572e017e1dd7c6 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Wed, 19 Feb 2014 07:49:18 +0100 Subject: [PATCH] Do not run amtterm only after reset and get rid of sleep() This way, amtterm fails is somebody is already connected. Only if amtterm succeeds, we proceed to reset/poweron. With recent amttool (at least commit [1]), this works even without sleep before running amtterm. [1]: https://www.kraxel.org/cgit/amtterm/log/?h=0ece5135fef56dbd0d94957c334655a57adb7212 --- novaboot | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/novaboot b/novaboot index 34a2c6a..19a3b44 100755 --- a/novaboot +++ b/novaboot @@ -637,14 +637,12 @@ END $result = powerChange($host,$user,$amt_password, "on"); } die "AMT reset failed (ReturnValue $result)" if $result != 0; - - sleep(2); # Without pause, connection to AMT machine is - # initiated before reset and fails after restart - - # amtterm must be run here because AMT doesn't allow to - # reset/on/off computer when somebody is connected - $exp = Expect->spawn("amtterm -u $user -p $amt_password $host $port"); }; + + my $cmd = "amtterm -u $user -p $amt_password $host $port"; + print "novaboot: Running: $cmd\n" =~ s/\Q$amt_password\E/???/r; + $exp = Expect->spawn($cmd); + $exp->expect(10, "RUN_SOL") || die "Expect for 'RUN_SOL' timed out"; } if ($remote_expect) { -- 2.39.2