[LEDE-DEV] [patch master 11/15] Consider using { cmd1; cmd2; } >> file instead of individual redirects
Jan-Tarek Butt
tarek at ring0.de
Fri Sep 30 13:02:25 PDT 2016
---
scripts/config/lxdialog/check-lxdialog.sh | 16 +++++++-----
scripts/diffconfig.sh | 16 +++++++-----
scripts/ext-toolchain.sh | 43 +++++++++++++++++--------------
3 files changed, 42 insertions(+), 33 deletions(-)
diff --git a/scripts/config/lxdialog/check-lxdialog.sh b/scripts/config/lxdialog/check-lxdialog.sh
index 5075ebf..02f05ad 100644
--- a/scripts/config/lxdialog/check-lxdialog.sh
+++ b/scripts/config/lxdialog/check-lxdialog.sh
@@ -50,13 +50,15 @@ check() {
main() {}
EOF
if [ $? != 0 ]; then
- echo " *** Unable to find the ncurses libraries or the" 1>&2
- echo " *** required header files." 1>&2
- echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2
- echo " *** " 1>&2
- echo " *** Install ncurses (ncurses-devel) and try again." 1>&2
- echo " *** " 1>&2
- exit 1
+ {
+ echo " *** Unable to find the ncurses libraries or the"
+ echo " *** required header files."
+ echo " *** 'make menuconfig' requires the ncurses libraries."
+ echo " ***"
+ echo " *** Install ncurses (ncurses-devel) and try again."
+ echo " ***"
+ } 1>&2
+ exit 1
fi
}
diff --git a/scripts/diffconfig.sh b/scripts/diffconfig.sh
index bdaf1a1..182336a 100755
--- a/scripts/diffconfig.sh
+++ b/scripts/diffconfig.sh
@@ -1,12 +1,14 @@
#!/bin/sh
grep \^CONFIG_TARGET_ .config | head -n3 > tmp/.diffconfig.head
-grep \^CONFIG_TARGET_DEVICE_ .config >> tmp/.diffconfig.head
-grep '^CONFIG_ALL=y' .config >> tmp/.diffconfig.head
-grep '^CONFIG_ALL_KMODS=y' .config >> tmp/.diffconfig.head
-grep '^CONFIG_ALL_NONSHARED=y' .config >> tmp/.diffconfig.head
-grep '^CONFIG_DEVEL=y' .config >> tmp/.diffconfig.head
-grep '^CONFIG_TOOLCHAINOPTS=y' .config >> tmp/.diffconfig.head
-grep '^CONFIG_BUSYBOX_CUSTOM=y' .config >> tmp/.diffconfig.head
+{
+ grep \^CONFIG_TARGET_DEVICE_ .config
+ grep '^CONFIG_ALL=y' .config
+ grep '^CONFIG_ALL_KMODS=y' .config
+ grep '^CONFIG_ALL_NONSHARED=y' .config
+ grep '^CONFIG_DEVEL=y' .config
+ grep '^CONFIG_TOOLCHAINOPTS=y' .config
+ grep '^CONFIG_BUSYBOX_CUSTOM=y' .config
+} >> tmp/.diffconfig.head
./scripts/config/conf --defconfig=tmp/.diffconfig.head -w tmp/.diffconfig.stage1 Config.in >/dev/null
./scripts/kconfig.pl '>+' tmp/.diffconfig.stage1 .config >> tmp/.diffconfig.head
./scripts/config/conf --defconfig=tmp/.diffconfig.head -w tmp/.diffconfig.stage2 Config.in >/dev/null
diff --git a/scripts/ext-toolchain.sh b/scripts/ext-toolchain.sh
index 2817b90..cafdfdb 100755
--- a/scripts/ext-toolchain.sh
+++ b/scripts/ext-toolchain.sh
@@ -202,16 +202,18 @@ wrap_bin_cc() {
local bin="$2"
echo '#!/bin/sh' > "$out"
- echo 'for arg in "$@"; do' >> "$out"
- echo ' case "$arg" in -l*|-L*|-shared|-static)' >> "$out"
- echo -n ' exec "'"$bin"'" '"$CFLAGS"' ${STAGING_DIR:+' >> "$out"
- echo -n '-idirafter "$STAGING_DIR/usr/include" ' >> "$out"
- echo -n '-L "$STAGING_DIR/usr/lib" ' >> "$out"
- echo '-Wl,-rpath-link,"$STAGING_DIR/usr/lib"} "$@" ;;' >> "$out"
- echo ' esac' >> "$out"
- echo 'done' >> "$out"
- echo -n 'exec "'"$bin"'" '"$CFLAGS"' ${STAGING_DIR:+' >> "$out"
- echo '-idirafter "$STAGING_DIR/usr/include"} "$@"' >> "$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 ' esac'
+ echo 'done'
+ echo -n 'exec "'"$bin"'" '"$CFLAGS"' ${STAGING_DIR:+'
+ echo '-idirafter "$STAGING_DIR/usr/include"} "$@"'
+ } >> "$out"
chmod +x "$out"
}
@@ -221,9 +223,11 @@ wrap_bin_ld() {
local bin="$2"
echo '#!/bin/sh' > "$out"
- echo -n 'exec "'"$bin"'" ${STAGING_DIR:+' >> "$out"
- echo -n '-L "$STAGING_DIR/usr/lib" ' >> "$out"
- echo '-rpath-link "$STAGING_DIR/usr/lib"} "$@"' >> "$out"
+ {
+ echo -n 'exec "'"$bin"'" ${STAGING_DIR:+'
+ echo -n '-L "$STAGING_DIR/usr/lib" '
+ echo '-rpath-link "$STAGING_DIR/usr/lib"} "$@"'
+ } >> "$out"
chmod +x "$out"
}
@@ -349,12 +353,13 @@ print_config() {
else
echo "# CONFIG_BUILD_NLS is not set" >> "$config"
fi
-
- echo "CONFIG_DEVEL=y" >> "$config"
- echo "CONFIG_EXTERNAL_TOOLCHAIN=y" >> "$config"
- echo "CONFIG_TOOLCHAIN_ROOT=\"$TOOLCHAIN\"" >> "$config"
- echo "CONFIG_TOOLCHAIN_PREFIX=\"$prefix\"" >> "$config"
- echo "CONFIG_TARGET_NAME=\"$target\"" >> "$config"
+ {
+ echo "CONFIG_DEVEL=y"
+ echo "CONFIG_EXTERNAL_TOOLCHAIN=y"
+ echo "CONFIG_TOOLCHAIN_ROOT=\"$TOOLCHAIN\""
+ echo "CONFIG_TOOLCHAIN_PREFIX=\"$prefix\""
+ echo "CONFIG_TARGET_NAME=\"$target\""
+ } >> "$config"
if [ "$LIBC_TYPE" != glibc ]; then
echo "CONFIG_TOOLCHAIN_LIBC=\"$LIBC_TYPE\"" >> "$config"
--
2.10.0
More information about the Lede-dev
mailing list