From 6555b03e733d3c267f0866deb600ea58aca9660e Mon Sep 17 00:00:00 2001
From: Heitor Matsui <heitorvieira.matsui@windriver.com>
Date: Mon, 9 Sep 2024 15:20:39 -0300
Subject: [PATCH] Update input_file in pxeboot-update script

Commit [1] added backward compatibility for lowlatency upgrades,
since the lowlatency pxe files were removed by [2]. However, one
of the input files used by the script are not being updated and
still contains "_lowlatency" name, making the script to fail in
lowlatency systems. This commit fixes the file name.

[1] https://review.opendev.org/c/starlingx/metal/+/928261
[2] https://review.opendev.org/c/starlingx/metal/+/888358

Test Plan
PASS: AIO-SX - run pxeboot-upgrade-24.09.sh script manually with input file set
      as '-i /var/pxeboot/pxelinux.cfg.files/pxe-smallsystem_lowlatency-install-24.09'
PASS: AIO-SX - lock/unlock host

Story: 2010676
Task: 50985

Change-Id: I94c47c0c1ffd9b560f573f85f3402f3534292a3e
Signed-off-by: Heitor Matsui <heitorvieira.matsui@windriver.com>
---
 .../pxe-network-installer/pxeboot-update.sh                   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/installer/pxe-network-installer/pxe-network-installer/pxeboot-update.sh b/installer/pxe-network-installer/pxe-network-installer/pxeboot-update.sh
index 82672d3e..09474f83 100755
--- a/installer/pxe-network-installer/pxe-network-installer/pxeboot-update.sh
+++ b/installer/pxe-network-installer/pxe-network-installer/pxeboot-update.sh
@@ -77,10 +77,12 @@ do
     case $opt in
         i)
             input_file=$OPTARG
+            input_file_dirname=$(dirname $input_file)
             input_file_basename=$(basename $input_file)
             # lowlatency files removed. Added for backwards compatibility
             fixed_input_file_basename=$(echo $input_file_basename | sed 's/_lowlatency//')
-            input_file_efi=$(dirname $input_file)/efi-$fixed_input_file_basename
+            input_file=${input_file_dirname}/${fixed_input_file_basename}
+            input_file_efi=${input_file_dirname}/efi-${fixed_input_file_basename}
             ;;
         o)
             output_file=$OPTARG