#!/usr/bin/perl # Watch the second stage boot to a password prompt, in hercules. use strict; use Expect; my $exp = new Expect; #$exp->exp_internal(1); $exp->raw_pty(1); $exp->spawn($ENV{CONSOLECOMMAND}) or die "cannot connect: $!\n"; # boot it $exp->expect($ENV{STAGE_2_MAX_TIME}, "Command ==>"); $exp->send("ipl 120\r"); $exp->expect($ENV{STAGE_2_MAX_TIME}, [ "ogin:" => sub { exit; }], [ "-re", "lo.*gin:" => sub { exit; }], [ "-re", "rting.*[gkx]dm" => sub { exit; }], [ "Unable to mount root fs" => sub { exit 1; }], [ timeout => sub { print STDERR "timeout!\n"; exit 1; }], ); exit;