From: Randolph Sapp <[email protected]>

Previously templates were always being overridden with this internal
value that just so happened to be functionally equivalent to the
template DL_DIR.

Template:
        DL_DIR = "${OEBASE}/downloads"

Internal override:
        DL_DIR = "$oebase/downloads"

Functionally equivalent, but the internal override would be expanded to
include the full path of "$oebase" before being written to the file. In
the end it was unnecessarily bound to the context in which oe-layersetup
was executed.

This change lets us keep the local.conf sample/template value unless a
value is specified over cmdline or a backup value is found. It also
explicitly warns the user when a backup value is used.

Signed-off-by: Randolph Sapp <[email protected]>
---
 oe-layertool-setup.sh | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/oe-layertool-setup.sh b/oe-layertool-setup.sh
index 2bee538..eb412ff 100755
--- a/oe-layertool-setup.sh
+++ b/oe-layertool-setup.sh
@@ -808,21 +808,21 @@ EOM
     # First copy the template file
     cp -f "$OECORELOCALCONFPATH" "$confdir/local.conf"
 
-    # Find if old DL_DIR was set
-    if [ -e "$confdir/local.conf.bak" ]
-    then
-        old_dldir=$(grep -e "^DL_DIR =" "$confdir/local.conf.bak" | sed 
's|DL_DIR = ||' | sed 's/"//g')
-    else
-        old_dldir="$oebase/downloads"
-    fi
-
     # If command line option was not set use the old dldir
     if [ -z "$dldir" ]
     then
-        dldir=$old_dldir
+        if [ -e "$confdir/local.conf.bak" ]
+        then
+            dldir=$(grep -e "^DL_DIR =" "$confdir/local.conf.bak" | sed 
's|DL_DIR = ||' | sed 's/"//g')
+            printf '%s\n' "WARNING: Loading old DL_DIR from 
$confdir/local.conf" \
+                          "DL_DIR = $dldir";
+        fi
     fi
 
-    sed -i "s|^DL_DIR.*|DL_DIR = \"${dldir}\"|" "$confdir/local.conf"
+    if [ -n "$dldir" ]
+    then
+        sed -i "s|^DL_DIR.*|DL_DIR = \"${dldir}\"|" "$confdir/local.conf"
+    fi
 
     if [ -e "$oebase/tmp_append_local.conf" ]
     then
-- 
2.45.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#15338): 
https://lists.yoctoproject.org/g/meta-arago/message/15338
Mute This Topic: https://lists.yoctoproject.org/mt/106231927/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-arago/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to