checking sdcore or free5gc directory exist in a image

tested these changes on aiab setup with all sdcore images/free5gc images.
All pods are up and running, registration call flow is fine with gnbsim

Change-Id: I8a0fdab559cf3cb524cf159ae1d7b201acfd05f3
diff --git a/5g-control-plane/templates/bin/_amf-run.sh.tpl b/5g-control-plane/templates/bin/_amf-run.sh.tpl
index ce0d310..cdc0377 100644
--- a/5g-control-plane/templates/bin/_amf-run.sh.tpl
+++ b/5g-control-plane/templates/bin/_amf-run.sh.tpl
@@ -6,12 +6,21 @@
 
 set -xe
 
-IMGPATH={{ .Values.config.imagePath }}
+DIR=""
+if [ -d "/free5gc/amf" ]; then
+  DIR="/free5gc"
+  echo "free5gc directory exist" 
+fi
+if [ -d "/sdcore/amf" ]; then
+  DIR="/sdcore"
+  echo "sdcore directory exist" 
+fi 
+
 {{- if .Values.config.coreDump.enabled }}
-cp $IMGPATH/amf/amf /tmp/coredump/
+cp $DIR/amf/amf /tmp/coredump/
 {{- end }}
 
-cd $IMGPATH
+cd $DIR
 cat config/amfcfg.conf
 
 GOTRACEBACK=crash ./amf/amf -amfcfg config/amfcfg.conf
diff --git a/5g-control-plane/templates/bin/_ausf-run.sh.tpl b/5g-control-plane/templates/bin/_ausf-run.sh.tpl
index 0307aed..ec0c519 100644
--- a/5g-control-plane/templates/bin/_ausf-run.sh.tpl
+++ b/5g-control-plane/templates/bin/_ausf-run.sh.tpl
@@ -6,11 +6,21 @@
 
 set -xe
 
+DIR=""
+if [ -d "/free5gc/ausf" ]; then
+  DIR="/free5gc"
+  echo "free5gc directory exist"
+fi
+if [ -d "/sdcore/ausf" ]; then
+  DIR="/sdcore"
+  echo "sdcore directory exist"
+fi
+
 {{- if .Values.config.coreDump.enabled }}
-cp /free5gc/ausf/ausf /tmp/coredump/
+cp $DIR/ausf/ausf /tmp/coredump/
 {{- end }}
 
-cd /free5gc
+cd $DIR
 cat config/ausfcfg.conf
 
 GOTRACEBACK=crash ./ausf/ausf -ausfcfg config/ausfcfg.conf
diff --git a/5g-control-plane/templates/bin/_nrf-run.sh.tpl b/5g-control-plane/templates/bin/_nrf-run.sh.tpl
index 7caa2e9..97c4402 100644
--- a/5g-control-plane/templates/bin/_nrf-run.sh.tpl
+++ b/5g-control-plane/templates/bin/_nrf-run.sh.tpl
@@ -6,11 +6,21 @@
 
 set -xe
 
+DIR=""
+if [ -d "/free5gc/nrf" ]; then
+  DIR="/free5gc"
+  echo "free5gc directory exist"
+fi
+if [ -d "/sdcore/nrf" ]; then
+  DIR="/sdcore"
+  echo "sdcore directory exist"
+fi
+
 {{- if .Values.config.coreDump.enabled }}
-cp /free5gc/nrf/nrf /tmp/coredump/
+cp $DIR/nrf/nrf /tmp/coredump/
 {{- end }}
 
-cd /free5gc
+cd $DIR
 
 cat config/nrfcfg.conf
 
diff --git a/5g-control-plane/templates/bin/_nssf-run.sh.tpl b/5g-control-plane/templates/bin/_nssf-run.sh.tpl
index 2aae4a0..a903d75 100644
--- a/5g-control-plane/templates/bin/_nssf-run.sh.tpl
+++ b/5g-control-plane/templates/bin/_nssf-run.sh.tpl
@@ -6,11 +6,21 @@
 
 set -xe
 
+DIR=""
+if [ -d "/free5gc/nssf" ]; then
+  DIR="/free5gc"
+  echo "free5gc directory exist"
+fi
+if [ -d "/sdcore/nssf" ]; then
+  DIR="/sdcore"
+  echo "sdcore directory exist"
+fi
+
 {{- if .Values.config.coreDump.enabled }}
-cp /free5gc/nssf/nssf /tmp/coredump/
+cp $DIR/nssf/nssf /tmp/coredump/
 {{- end }}
 
-cd /free5gc
+cd $DIR
 
 cat config/nssfcfg.conf
 
diff --git a/5g-control-plane/templates/bin/_pcf-run.sh.tpl b/5g-control-plane/templates/bin/_pcf-run.sh.tpl
index 9dfee3f..1c6f554 100644
--- a/5g-control-plane/templates/bin/_pcf-run.sh.tpl
+++ b/5g-control-plane/templates/bin/_pcf-run.sh.tpl
@@ -6,11 +6,21 @@
 
 set -xe
 
+DIR=""
+if [ -d "/free5gc/pcf" ]; then
+  DIR="/free5gc"
+  echo "free5gc directory exist"
+fi
+if [ -d "/sdcore/pcf" ]; then
+  DIR="/sdcore"
+  echo "sdcore directory exist"
+fi
+
 {{- if .Values.config.coreDump.enabled }}
-cp /free5gc/pcf/pcf /tmp/coredump/
+cp $DIR/pcf/pcf /tmp/coredump/
 {{- end }}
 
-cd /free5gc
+cd $DIR
 
 cat config/pcfcfg.conf
 
diff --git a/5g-control-plane/templates/bin/_smf-run.sh.tpl b/5g-control-plane/templates/bin/_smf-run.sh.tpl
index aafc97c..8280a07 100644
--- a/5g-control-plane/templates/bin/_smf-run.sh.tpl
+++ b/5g-control-plane/templates/bin/_smf-run.sh.tpl
@@ -6,11 +6,21 @@
 
 set -xe
 
+DIR=""
+if [ -d "/free5gc/smf" ]; then
+  DIR="/free5gc"
+  echo "free5gc directory exist"
+fi
+if [ -d "/sdcore/smf" ]; then
+  DIR="/sdcore"
+  echo "sdcore directory exist"
+fi
+
 {{- if .Values.config.coreDump.enabled }}
-cp /free5gc/smf/smf /tmp/coredump/
+cp $DIR/smf/smf /tmp/coredump/
 {{- end }}
 
-cd /free5gc
+cd $DIR
 
 cat config/smfcfg.conf
 cat uerouting/uerouting.conf
diff --git a/5g-control-plane/templates/bin/_udm-run.sh.tpl b/5g-control-plane/templates/bin/_udm-run.sh.tpl
index a171cea..dbc92d8 100644
--- a/5g-control-plane/templates/bin/_udm-run.sh.tpl
+++ b/5g-control-plane/templates/bin/_udm-run.sh.tpl
@@ -6,11 +6,21 @@
 
 set -xe
 
+DIR=""
+if [ -d "/free5gc/udm" ]; then
+  DIR="/free5gc"
+  echo "free5gc directory exist"
+fi
+if [ -d "/sdcore/udm" ]; then
+  DIR="/sdcore"
+  echo "sdcore directory exist"
+fi
+
 {{- if .Values.config.coreDump.enabled }}
-cp /free5gc/udm/udm /tmp/coredump/
+cp $DIR/udm/udm /tmp/coredump/
 {{- end }}
 
-cd /free5gc
+cd $DIR
 
 cat config/udmcfg.conf
 
diff --git a/5g-control-plane/templates/bin/_udr-run.sh.tpl b/5g-control-plane/templates/bin/_udr-run.sh.tpl
index 900f72a..7dca3e0 100644
--- a/5g-control-plane/templates/bin/_udr-run.sh.tpl
+++ b/5g-control-plane/templates/bin/_udr-run.sh.tpl
@@ -6,11 +6,21 @@
 
 set -xe
 
+DIR=""
+if [ -d "/free5gc/udr" ]; then
+  DIR="/free5gc"
+  echo "free5gc directory exist"
+fi
+if [ -d "/sdcore/udr" ]; then
+  DIR="/sdcore"
+  echo "sdcore directory exist"
+fi
+
 {{- if .Values.config.coreDump.enabled }}
-cp /free5gc/udr/udr /tmp/coredump/
+cp $DIR/udr/udr /tmp/coredump/
 {{- end }}
 
-cd /free5gc
+cd $DIR
 
 cat config/udrcfg.conf
 
diff --git a/5g-control-plane/templates/bin/_webui-run.sh.tpl b/5g-control-plane/templates/bin/_webui-run.sh.tpl
index 5e91d50..522a0e0 100644
--- a/5g-control-plane/templates/bin/_webui-run.sh.tpl
+++ b/5g-control-plane/templates/bin/_webui-run.sh.tpl
@@ -6,11 +6,21 @@
 
 set -xe
 
+DIR=""
+if [ -d "/free5gc/webconsole" ]; then
+  DIR="/free5gc"
+  echo "free5gc directory exist"
+fi
+if [ -d "/sdcore/webconsole" ]; then
+  DIR="/sdcore"
+  echo "sdcore directory exist"
+fi
+
 {{- if .Values.config.coreDump.enabled }}
-cp /free5gc/webconsole/webconsole /tmp/coredump/
+cp $DIR/webconsole/webconsole /tmp/coredump/
 {{- end }}
 
-cd /free5gc
+cd $DIR
 
 cat config/webuicfg.conf