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

<[email protected]>
Newsgroups org.yoctoproject.lists.meta-arago
Message-ID <[email protected]>
From: Randolph Sapp <[email protected]>

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 <[email protected]>
---
 oe-layertool-setup.sh | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

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" ]
-- 
2.52.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.