[LEDE-DEV] [patch master 14/15] Expressions don't expand in single quotes, use double quotes for that

Jan-Tarek Butt tarek at ring0.de
Fri Sep 30 13:02:28 PDT 2016


---
 scripts/deptest.sh       |  2 +-
 scripts/ext-toolchain.sh | 24 ++++++++++++------------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/scripts/deptest.sh b/scripts/deptest.sh
index 0b0e7a9..2b156b3 100755
--- a/scripts/deptest.sh
+++ b/scripts/deptest.sh
@@ -88,7 +88,7 @@ test_package() # $1=pkgname
 	local SELECTED=
 	while IFS= read -r conf; do
 		grep "$conf=" .config > /dev/null && SELECTED=1 && break
-	done < "$(grep CONFIG_PACKAGE tmp/.packagedeps | grep -E "[ /]$pkg\$" | sed -e 's,package-$(\(CONFIG_PACKAGE_.*\)).*,\1,')"
+	done < "$(grep CONFIG_PACKAGE tmp/.packagedeps | grep -E "[ /]$pkg\$" | sed -e "s,package-\$(\\(CONFIG_PACKAGE_.*\\)).*,\\1,")"
 	local STAMP_SUCCESS="$STAMP_DIR_SUCCESS/$pkg"
 	local STAMP_FAILED="$STAMP_DIR_FAILED/$pkg"
 	local STAMP_BLACKLIST="$STAMP_DIR_BLACKLIST/$pkg"
diff --git a/scripts/ext-toolchain.sh b/scripts/ext-toolchain.sh
index cafdfdb..de36613 100755
--- a/scripts/ext-toolchain.sh
+++ b/scripts/ext-toolchain.sh
@@ -203,16 +203,16 @@ wrap_bin_cc() {
 
 	echo    '#!/bin/sh'                                                > "$out"
 	{
-		echo    'for arg in "$@"; do'
-		echo    ' case "$arg" in -l*|-L*|-shared|-static)'
-		echo -n '  exec "'"$bin"'" '"$CFLAGS"' ${STAGING_DIR:+'
-		echo -n '-idirafter "$STAGING_DIR/usr/include" '
-		echo -n '-L "$STAGING_DIR/usr/lib" '
-		echo    '-Wl,-rpath-link,"$STAGING_DIR/usr/lib"} "$@" ;;'
+		echo    "for arg in \"\$@\"; do"
+		echo    " case \"\$arg\" in -l*|-L*|-shared|-static)"
+		echo -n "  exec \"$bin\" $CFLAGS \${STAGING_DIR:+"
+		echo -n "-idirafter \"\$STAGING_DIR/usr/include\" "
+		echo -n "-L \"\$STAGING_DIR/usr/lib\" "
+		echo    "-Wl,-rpath-link,\"\$STAGING_DIR/usr/lib\"} \"\$@\" ;;"
 		echo    ' esac'
 		echo    'done'
-		echo -n 'exec "'"$bin"'" '"$CFLAGS"' ${STAGING_DIR:+'
-		echo    '-idirafter "$STAGING_DIR/usr/include"} "$@"'
+		echo -n "exec \"$bin\" $CFLAGS \${STAGING_DIR:+"
+		echo    "-idirafter \"\$STAGING_DIR/usr/include\"} \"\$@\""
 	} >> "$out"
 
 	chmod +x "$out"
@@ -224,9 +224,9 @@ wrap_bin_ld() {
 
 	echo    '#!/bin/sh'                                                > "$out"
 	{
-		echo -n 'exec "'"$bin"'" ${STAGING_DIR:+'
-		echo -n '-L "$STAGING_DIR/usr/lib" '
-		echo    '-rpath-link "$STAGING_DIR/usr/lib"} "$@"'
+		echo -n "exec \"$bin\" \${STAGING_DIR:+"
+		echo -n "-L \"\$STAGING_DIR/usr/lib\" "
+		echo    "-rpath-link \"\$STAGING_DIR/usr/lib\"} \"\$@\""
 	} >> "$out"
 
 	chmod +x "$out"
@@ -254,7 +254,7 @@ wrap_bins() {
 
 				if [ -x "$out" ] && ! grep -q STAGING_DIR "$out"; then
 					mv "$out" "$out.bin"
-					bin='$(dirname "$0")/'"${out##*/}"'.bin'
+					bin="\$(dirname \"\$0\")/${out##*/}.bin"
 				fi
 
 				case "${cmd##*/}" in
-- 
2.10.0




More information about the Lede-dev mailing list