]> rtime.felk.cvut.cz Git - novaboot.git/blobdiff - novaboot
Add support for $NB_MYIP in --uboot-init
[novaboot.git] / novaboot
index 7b203a3a918d023c574e1315dfe9a0c370093260..76b48bcbf060cccc3f7c12459d1d83759ac2bad4 100755 (executable)
--- a/novaboot
+++ b/novaboot
@@ -988,6 +988,11 @@ if (defined $uboot) {
                 [qr/Hit any key to stop autoboot:/, sub { $exp->send("\n"); exp_continue; }],
                 $uboot_prompt) || die "No uBoot prompt deteceted";
     foreach my $cmd (@uboot_init) {
+       if ($cmd =~ /\$NB_MYIP/) {
+           my $ip = (grep /inet /, `ip addr show eth0`)[0] || die "Problem determining our IP address";
+           $ip =~ s/\s*inet ([0-9.]*).*/$1/;
+           $cmd =~ s/\$NB_MYIP/$ip/g;
+       }
        chomp($cmd);
        $exp->send("$cmd\n");
        $exp->expect(10, $uboot_prompt) || die "uBoot prompt timeout";
@@ -1545,6 +1550,9 @@ Command(s) to send the U-Boot bootloader before loading the images and
 booting them. This option can be given multiple times. After sending
 commands from each option novaboot waits for U-Boot I<prompt>.
 
+If the command contains string I<$NB_MYIP> then this string is
+replaced by IPv4 address of eth0 interface.
+
 =back
 
 =head2 Target interaction phase