From d7d6e055e9d9d9554f59e919f37e0b6cd46b12a1 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Sun, 10 May 2020 16:47:46 +0200 Subject: [PATCH] base-files: replace backticks by $(...) This replaces deprecated backticks by more versatile $(...) syntax. This does not touch lib/upgrade/nand.sh, as there replacement is not trivial. Signed-off-by: Adrian Schmutzler --- package/base-files/files/bin/board_detect | 2 +- .../files/etc/uci-defaults/13_fix-group-user | 2 +- .../files/lib/preinit/30_failsafe_wait | 2 +- package/base-files/files/sbin/pkg_check | 16 ++++++++-------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package/base-files/files/bin/board_detect b/package/base-files/files/bin/board_detect index 441db6a08fc..840bd0178d1 100755 --- a/package/base-files/files/bin/board_detect +++ b/package/base-files/files/bin/board_detect @@ -5,7 +5,7 @@ CFG=$1 [ -n "$CFG" ] || CFG=/etc/board.json [ -d "/etc/board.d/" -a ! -s "$CFG" ] && { - for a in `ls /etc/board.d/*`; do + for a in $(ls /etc/board.d/*); do [ -x $a ] || continue; $(. $a) done diff --git a/package/base-files/files/etc/uci-defaults/13_fix-group-user b/package/base-files/files/etc/uci-defaults/13_fix-group-user index bf9febdfe43..74f501e8f77 100644 --- a/package/base-files/files/etc/uci-defaults/13_fix-group-user +++ b/package/base-files/files/etc/uci-defaults/13_fix-group-user @@ -1,6 +1,6 @@ . /lib/functions.sh -for file in `grep -sl Require-User /usr/lib/opkg/info/*.control`; do +for file in $(grep -sl Require-User /usr/lib/opkg/info/*.control); do file="${file##*/}" file="${file%.control}" add_group_and_user "${file}" diff --git a/package/base-files/files/lib/preinit/30_failsafe_wait b/package/base-files/files/lib/preinit/30_failsafe_wait index 85dca398fa7..a2c2c386aa3 100644 --- a/package/base-files/files/lib/preinit/30_failsafe_wait +++ b/package/base-files/files/lib/preinit/30_failsafe_wait @@ -91,7 +91,7 @@ failsafe_wait() { grep -q 'failsafe=' /proc/cmdline && FAILSAFE=true && export FAILSAFE if [ "$FAILSAFE" != "true" ]; then fs_wait_for_key f 'to enter failsafe mode' $fs_failsafe_wait_timeout && FAILSAFE=true - [ -f "/tmp/failsafe_button" ] && FAILSAFE=true && echo "- failsafe button "`cat /tmp/failsafe_button`" was pressed -" + [ -f "/tmp/failsafe_button" ] && FAILSAFE=true && echo "- failsafe button "$(cat /tmp/failsafe_button)" was pressed -" [ "$FAILSAFE" = "true" ] && export FAILSAFE && touch /tmp/failsafe fi } diff --git a/package/base-files/files/sbin/pkg_check b/package/base-files/files/sbin/pkg_check index 9968c9b78e5..775e401b266 100755 --- a/package/base-files/files/sbin/pkg_check +++ b/package/base-files/files/sbin/pkg_check @@ -72,14 +72,14 @@ while [ "$1" ]; do fi [ $QUIET = yes ] || echo " * Checking package $1:" ERR="" - CHECK="`sha256sum -c /usr/lib/opkg/info/$1.files-sha256sum 2> /dev/null`" + CHECK="$(sha256sum -c /usr/lib/opkg/info/$1.files-sha256sum 2> /dev/null)" # Are the changed files config files? - if [ $? -ne 0 ] && [ "`cat "/usr/lib/opkg/info/$1.files-sha256sum"`" ]; then - NEWCHECK="`echo "$CHECK" | grep '^.*: OK$'`" - for i in `echo "$CHECK" | sed -n 's|^\(.*\): FAILED$|\1|p'`; do - if [ "`grep "^$i\$" "/usr/lib/opkg/info/$1.conffiles" 2> /dev/null`" ] || \ - [ "`echo "$i" | grep "^/etc/uci-defaults/"`" ]; then + if [ $? -ne 0 ] && [ "$(cat "/usr/lib/opkg/info/$1.files-sha256sum")" ]; then + NEWCHECK="$(echo "$CHECK" | grep '^.*: OK$')" + for i in $(echo "$CHECK" | sed -n 's|^\(.*\): FAILED$|\1|p'); do + if [ "$(grep "^$i\$" "/usr/lib/opkg/info/$1.conffiles" 2> /dev/null)" ] || \ + [ "$(echo "$i" | grep "^/etc/uci-defaults/")" ]; then NEWCHECK="${NEWCHECK}${NL}${i}: CONFIGURED" else NEWCHECK="${NEWCHECK}${NL}${i}: FAILED" @@ -91,7 +91,7 @@ while [ "$1" ]; do # Do we have changed files or not? if [ -z "$ERR" ]; then - [ $QUIET = yes ] || [ -z "`cat "/usr/lib/opkg/info/$1.files-sha256sum"`" ] || echo "$CHECK" | sed 's|^| - |' + [ $QUIET = yes ] || [ -z "$(cat "/usr/lib/opkg/info/$1.files-sha256sum")" ] || echo "$CHECK" | sed 's|^| - |' [ $QUIET = yes ] || echo " * Package $1 is ok" [ $QUIET = yes ] || echo else @@ -107,7 +107,7 @@ while [ "$1" ]; do echo "Exiting on first change found!" exit 1 fi - for i in `echo "$CHECK" | sed -n 's|^\(.*\): FAILED$|\1|p'`; do + for i in $(echo "$CHECK" | sed -n 's|^\(.*\): FAILED$|\1|p'); do SUMMARY="${SUMMARY}${NL} - $1: $i" done echo -- 2.30.2