oe-layertool-setup: fix dldir logic for templates
PATCH 1/1 oe-layertool-setup: fix dldir logic for templates
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(-)
oe-layertool-setup.sh +10 -10
@@ -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
Signature · 1 line
2.45.1