]> rtime.felk.cvut.cz Git - novaboot.git/commitdiff
Do not run amtterm only after reset and get rid of sleep()
authorMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 19 Feb 2014 06:49:18 +0000 (07:49 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 19 Feb 2014 06:49:18 +0000 (07:49 +0100)
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

index 34a2c6af182f2b53d2e56e14a0346f81d61679d9..19a3b44754fa9ec2b0e517d2baa026122cc33f71 100755 (executable)
--- 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) {