From 0daabdeb8754674558a86b1f11c3b427d12d899f Mon Sep 17 00:00:00 2001
From: Bartosz Podrygajlo <bartosz.podrygajlo@openairinterface.org>
Date: Mon, 7 Oct 2024 09:15:44 +0200
Subject: [PATCH] Update the aw2s entrypoint to support new yaml config and
 updated images

---
 docker/scripts/gnb-aw2s_entrypoint.sh | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/docker/scripts/gnb-aw2s_entrypoint.sh b/docker/scripts/gnb-aw2s_entrypoint.sh
index 7085800d131..7df325d78b5 100755
--- a/docker/scripts/gnb-aw2s_entrypoint.sh
+++ b/docker/scripts/gnb-aw2s_entrypoint.sh
@@ -9,14 +9,29 @@ echo "=================================="
 echo "/proc/sys/kernel/core_pattern=$(cat /proc/sys/kernel/core_pattern)"
 
 if [ ! -f $CONFIGFILE ]; then
-  echo "No configuration file found: please mount at $CONFIGFILE"
-  exit 255
+  echo "No configuration file $CONFIGFILE found: attempting to find YAML config"
+  YAML_CONFIGFILE=$PREFIX/etc/gnb.yaml
+  if [ ! -f $YAML_CONFIGFILE ]; then
+    echo "No configuration file $YAML_CONFIGFILE found. Please mount either at $CONFIGFILE or $YAML_CONFIGFILE"
+    exit 255
+  fi
+  CONFIGFILE=$YAML_CONFIGFILE
 fi
 
 echo "=================================="
 echo "== Configuration file:"
 cat $CONFIGFILE
 
+new_args=()
+
+while [[ $# -gt 0 ]]; do
+  new_args+=("$1")
+  shift
+done
+
+new_args+=("-O")
+new_args+=("$CONFIGFILE")
+
 # enable printing of stack traces on assert
 export OAI_GDBSTACKS=1
 
@@ -24,7 +39,6 @@ echo "=================================="
 echo "== Starting gNB soft modem with AW2S"
 if [[ -v USE_ADDITIONAL_OPTIONS ]]; then
     echo "Additional option(s): ${USE_ADDITIONAL_OPTIONS}"
-    new_args=()
     while [[ $# -gt 0 ]]; do
         new_args+=("$1")
         shift
@@ -35,6 +49,6 @@ if [[ -v USE_ADDITIONAL_OPTIONS ]]; then
     echo "${new_args[@]}"
     exec "${new_args[@]}"
 else
-    echo "$@"
-    exec "$@"
+    echo "${new_args[@]}"
+    exec "${new_args[@]}"
 fi
-- 
GitLab