From 1140c4b1d878030cbb30ec5df6b60b89874f93e9 Mon Sep 17 00:00:00 2001 From: Adam Wujek <adam.wujek@cern.ch> Date: Fri, 27 Feb 2015 15:28:57 +0100 Subject: [PATCH] patches/barebox: fix tftp boot sequence Second test of $? value was not always result of command "tftp $eth0.ipaddr/wrboot wrboot", but sometimes result of first if statement (in case first tftp was successful). In other words, when there was file wrboot-$eth0.ethaddr on tftp server, script was still fetching and executing wrboot. Signed-off-by: Adam Wujek <adam.wujek@cern.ch> --- patches/barebox/v2014.04/env/bin/boot-script | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/patches/barebox/v2014.04/env/bin/boot-script b/patches/barebox/v2014.04/env/bin/boot-script index 085deeff9..fe8c76391 100644 --- a/patches/barebox/v2014.04/env/bin/boot-script +++ b/patches/barebox/v2014.04/env/bin/boot-script @@ -7,15 +7,18 @@ fi # fetch wrboot-<MAC> script, or <IP>/wrboot or wrboot tftp wrboot-$eth0.ethaddr wrboot -if [ "$?" -ne "0" ]; then +ret=$? +if [ "$ret" -ne "0" ]; then sleep 1 tftp $eth0.ipaddr/wrboot wrboot + ret=$? fi -if [ "$?" -ne "0" ]; then +if [ "$ret" -ne "0" ]; then sleep 1 tftp wrboot wrboot + ret=$? fi -if [ "$?" -eq "0" ]; then +if [ "$ret" -eq "0" ]; then ./wrboot fi -- GitLab