diff mbox series

[meta-arago,oe-layersetup,3/5] oe-layertool-setup: fix config template parsing

Message ID 20260205225528.92769-5-rs@ti.com
State New
Headers show
Series oe-layertool-setup: general clean up and bugfix | expand

Commit Message

Randolph Sapp Feb. 5, 2026, 10:55 p.m. UTC
From: Randolph Sapp <rs@ti.com>

It may be possible that someone submits a config without any templates.
In this case we should not enter an infinite loop, nor should we try to
copy empty strings.

Signed-off-by: Randolph Sapp <rs@ti.com>
---
 oe-layertool-setup.sh | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/oe-layertool-setup.sh b/oe-layertool-setup.sh
index cd6d04e..979390f 100755
--- a/oe-layertool-setup.sh
+++ b/oe-layertool-setup.sh
@@ -658,7 +658,7 @@  get_oecorelayerconf() {
 
     done="n"
 
-    while [ "$done" != "y" ]
+    while [ "$done" != "y" ] && [ -n "$confs" ]
     do
 
 cat << EOM
@@ -713,7 +713,7 @@  get_oecorelocalconf() {
 
     done="n"
 
-    while [ "$done" != "y" ]
+    while [ "$done" != "y" ] && [ -n "$confs" ]
     do
 
 cat << EOM
@@ -765,7 +765,10 @@  NOTE: Any additional entries to this file will be lost if the $0
 
 EOM
     # First copy the template file
-    cp -f "$OECORELAYERCONFPATH" "$confdir/bblayers.conf"
+    if [ -n "$OECORELAYERCONFPATH" ]
+    then
+        cp -f "$OECORELAYERCONFPATH" "$confdir/bblayers.conf"
+    fi
 
     # Now add the layers we have configured to the BBLAYERS variable
 cat >> "$confdir/bblayers.conf" << EOM
@@ -806,7 +809,10 @@  EOM
     fi
 
     # First copy the template file
-    cp -f "$OECORELOCALCONFPATH" "$confdir/local.conf"
+    if [ -n "$OECORELOCALCONFPATH" ]
+    then
+        cp -f "$OECORELOCALCONFPATH" "$confdir/local.conf"
+    fi
 
     # If command line option was not set use the old dldir
     if [ -z "$dldir" ]