From: Michal Sojka Date: Wed, 10 Sep 2014 11:31:09 +0000 (+0200) Subject: Expand $NB_PREFIX in U-Boot commands X-Git-Tag: 20140910~3 X-Git-Url: https://rtime.felk.cvut.cz/gitweb/novaboot.git/commitdiff_plain/da7887e0f84977277b7ab584f70ad74ca6512ca5 Expand $NB_PREFIX in U-Boot commands --- diff --git a/README.md b/README.md index a09d5f5..0eff63b 100644 --- a/README.md +++ b/README.md @@ -446,7 +446,8 @@ can currently be accomplished by the following options: **--amt**, commands from each option novaboot waits for U-Boot _prompt_. If the command contains string _$NB\_MYIP_ then this string is - replaced by IPv4 address of eth0 interface. + replaced by IPv4 address of eth0 interface. Similarly _$NB\_PREFIX_ is + replaced with prefix given by **--prefix**. See also `uboot` keyword in ["NOVABOOT SCRIPT SYNTAX"](#novaboot-script-syntax)). diff --git a/novaboot b/novaboot index c28b7e2..9b2c3df 100755 --- a/novaboot +++ b/novaboot @@ -1005,6 +1005,11 @@ if (defined $uboot) { $ip =~ s/\s*inet ([0-9.]*).*/$1/; $cmd =~ s/\$NB_MYIP/$ip/g; } + if ($cmd =~ /\$NB_PREFIX/) { + my $p = $prefix; + $p =~ s|/*$||; + $cmd =~ s/\$NB_PREFIX/$p/g; + } chomp($cmd); $exp->send("$cmd\n"); $exp->expect(10, $uboot_prompt) || die "U-Boot prompt timeout"; @@ -1588,7 +1593,8 @@ booting them. This option can be given multiple times. After sending commands from each option novaboot waits for U-Boot I. If the command contains string I<$NB_MYIP> then this string is -replaced by IPv4 address of eth0 interface. +replaced by IPv4 address of eth0 interface. Similarly I<$NB_PREFIX> is +replaced with prefix given by B<--prefix>. See also C keyword in L).