base-files: replace backticks by $(...)
authorAdrian Schmutzler <freifunk@adrianschmutzler.de>
Sun, 10 May 2020 14:47:46 +0000 (16:47 +0200)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Sat, 11 Jul 2020 10:52:01 +0000 (12:52 +0200)
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 <freifunk@adrianschmutzler.de>
package/base-files/files/bin/board_detect
package/base-files/files/etc/uci-defaults/13_fix-group-user
package/base-files/files/lib/preinit/30_failsafe_wait
package/base-files/files/sbin/pkg_check

index 441db6a08fc9e349b3fca1efc68a9c7934d3bb77..840bd0178d14101f8a36932b438d8c38ed09f1fa 100755 (executable)
@@ -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
index bf9febdfe43cf07cedc11a88bc0622bd7e63d3d7..74f501e8f77fcbe2c4a3a0143a1182d91971b0eb 100644 (file)
@@ -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}"
index 85dca398fa781824161388a894002a7c1188a47b..a2c2c386aa3aa5963e01cec640cc32e5858d120b 100644 (file)
@@ -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
 }
index 9968c9b78e58c85d27bebdfb9fba20eeedd185f4..775e401b266db953b441413a6b908d4f3a934261 100755 (executable)
@@ -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