=================================================================== RCS file: /cvs/trango/Net-Telnet-Trango/scripts/update_trango.pl,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- trango/Net-Telnet-Trango/scripts/update_trango.pl 2005/12/29 18:41:17 1.12 +++ trango/Net-Telnet-Trango/scripts/update_trango.pl 2005/12/30 01:02:41 1.13 @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $RedRiver: update_trango.pl,v 1.11 2005/12/21 02:03:30 andrew Exp $ +# $RedRiver: update_trango.pl,v 1.12 2005/12/29 18:41:17 andrew Exp $ ######################################################################## # update_trango.pl *** Updates trango foxes with a new firmware # @@ -44,24 +44,23 @@ my $t = new Net::Telnet::Trango ({ Host => $fox, Timeout => 5, - }); + Errmode => 'return', + }) or die "Couldn't make new connection: $!"; $l->p("Connecting to $fox"); - my ($type, $version) = $t->connect(); - - unless (defined $type && defined $version) { - $l->sp("Error connecting!"); + unless ($t->open) { + $l->sp("Error connecting: $!"); next; } - if ($type ne $conf->{'type'}) { - $l->sp("Wrong type of unit ('$type' should be '$conf->{'type'}')"); + if ($t->host_type ne $conf->{'type'}) { + $l->sp("Wrong type of unit ('$t->host_type' should be '$conf->{'type'}')"); $t->close; next; } - if ($version eq $conf->{'ver'}) { - $l->sp("Already up to date with firmware version '$version'"); + if ($t->firmware_version eq $conf->{'ver'}) { + $l->sp("Already up to date with firmware version '$t->firmware_version'"); $t->close; next; } @@ -71,17 +70,24 @@ $l->p("Sending commands"); ## Send commands - #print Dump $t->ver(); - #print Dump $t->tftpd(); - if ( upload($t, $conf->{'file_name'}) ) { - $l->p("Rebooting"); - $t->reboot; - } else { + print Dump $t->login_banner; + print Dump $t->sysinfo; + print Dump $t->last_lines; + print Dump $t->ver(); + print Dump $t->tftpd(); + print Dump $t->enable_tftpd(); + print Dump [ "Exit", $t->exit ]; + print Dump $t->tftpd(); + print Dump $t->disable_tftpd(); + print Dump $t->tftpd(); + #if ( upload($t, $conf->{'file_name'}) ) { + # $l->p("Rebooting"); + # $t->reboot; + #} else { $l->p("Exiting"); $t->exit; - } + #} - $t->close; $l->sp(""); } @@ -159,7 +165,9 @@ $l->p("Updating flash (new checksum '$conf->{'cksum'}')"); unless ($results = $t->updateflash( - $ver->{'Firmware Checksum'}, $conf->{'cksum'} + args => 'mainimage ' . $ver->{'Firmware Checksum'} . + ' ' . $conf->{'cksum'}, + Timeout => 90, ) ) { $l->sp("Couldn't update flash: $!"); next;