From 9314c567b1ea364b91d38ccda3d494257fed5bb8 Mon Sep 17 00:00:00 2001
From: Lorenzo Pagliai <lorenzo.pagliai@seco.com>
Date: Thu, 21 Mar 2024 17:53:55 +0100
Subject: [PATCH] [ARTIFACTS][NAME] Handle equal variables

* Since for Intel boards the PROCESSOR and BOARD variable values
  coincides, it is necessary to handle this case and remove one of the
two variables from the artifact name.
---
 scripts/artifacts_name.sh | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/scripts/artifacts_name.sh b/scripts/artifacts_name.sh
index ad6a32d..7099d0c 100644
--- a/scripts/artifacts_name.sh
+++ b/scripts/artifacts_name.sh
@@ -3,15 +3,22 @@
 TAG_NAME=$1
 DEPLOY_DATE=$2
 
-export uboot_filename="seco_"$PROCESSOR"_"$BOARD"_uboot-"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_"$DEPLOY_DATE".tar.gz"
-export uboot_filename_latest="seco_"$PROCESSOR"_"$BOARD"_uboot-"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_latest.tar.gz"
-export kernel_filename="seco_"$PROCESSOR"_"$BOARD"_kernel-"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_"$DEPLOY_DATE".tar.gz"
-export kernel_filename_latest="seco_"$PROCESSOR"_"$BOARD"_kernel-"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_latest.tar.gz"
-export filesystem_name="seco_"$PROCESSOR"_"$BOARD"_filesystem-"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_"$DEPLOY_DATE".tar.bz2"
-export filesystem_name_latest="seco_"$PROCESSOR"_"$BOARD"_filesystem-"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_latest.tar.bz2"
-export image_name="seco_"$PROCESSOR"_"$BOARD"_"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_"$DEPLOY_DATE"."$IMAGE_EXTENSION""
-export image_name_latest="seco_"$PROCESSOR"_"$BOARD"_"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_latest."$IMAGE_EXTENSION""
-export bmap_name="seco_"$PROCESSOR"_"$BOARD"_bmapfile-"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_"$DEPLOY_DATE".rootfs.wic.bmap"
-export bmap_name_latest="seco_"$PROCESSOR"_"$BOARD"_bmapfile-"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_latest.rootfs.wic.bmap"
-export bundle_filename="seco_"$PROCESSOR"_"$BOARD"_edgehog-bundle_"$KERNEL"_"$TAG_NAME"_"$DEPLOY_DATE".raucb"
-export bundle_filename_latest="seco_"$PROCESSOR"_"$BOARD"_edgehog-bundle_"$KERNEL"_"$TAG_NAME"_latest.raucb"
\ No newline at end of file
+# Check if PROCESSOR and BOARD coincide
+if [ "$PROCESSOR" = "$BOARD" ]; then
+    board_suffix=""
+else
+    board_suffix="_$BOARD"
+fi
+
+export uboot_filename="seco_"$PROCESSOR""$board_suffix"_uboot-"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_"$DEPLOY_DATE".tar.gz"
+export uboot_filename_latest="seco_"$PROCESSOR""$board_suffix"_uboot-"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_latest.tar.gz"
+export kernel_filename="seco_"$PROCESSOR""$board_suffix"_kernel-"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_"$DEPLOY_DATE".tar.gz"
+export kernel_filename_latest="seco_"$PROCESSOR""$board_suffix"_kernel-"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_latest.tar.gz"
+export filesystem_name="seco_"$PROCESSOR""$board_suffix"_filesystem-"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_"$DEPLOY_DATE".tar.bz2"
+export filesystem_name_latest="seco_"$PROCESSOR""$board_suffix"_filesystem-"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_latest.tar.bz2"
+export image_name="seco_"$PROCESSOR""$board_suffix"_"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_"$DEPLOY_DATE"."$IMAGE_EXTENSION""
+export image_name_latest="seco_"$PROCESSOR""$board_suffix"_"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_latest."$IMAGE_EXTENSION""
+export bmap_name="seco_"$PROCESSOR""$board_suffix"_bmapfile-"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_"$DEPLOY_DATE".rootfs.wic.bmap"
+export bmap_name_latest="seco_"$PROCESSOR""$board_suffix"_bmapfile-"$IMAGE_NAME"_"$KERNEL"_"$TAG_NAME"_latest.rootfs.wic.bmap"
+export bundle_filename="seco_"$PROCESSOR""$board_suffix"_edgehog-bundle_"$KERNEL"_"$TAG_NAME"_"$DEPLOY_DATE".raucb"
+export bundle_filename_latest="seco_"$PROCESSOR""$board_suffix"_edgehog-bundle_"$KERNEL"_"$TAG_NAME"_latest.raucb"
\ No newline at end of file
-- 
GitLab