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 <freifunk@adrianschmutzler.de>
This commit is contained in:
Adrian Schmutzler 2020-05-10 16:47:46 +02:00
parent 5115cb0501
commit d7d6e055e9
4 changed files with 11 additions and 11 deletions

View File

@ -5,7 +5,7 @@ CFG=$1
[ -n "$CFG" ] || CFG=/etc/board.json [ -n "$CFG" ] || CFG=/etc/board.json
[ -d "/etc/board.d/" -a ! -s "$CFG" ] && { [ -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; [ -x $a ] || continue;
$(. $a) $(. $a)
done done

View File

@ -1,6 +1,6 @@
. /lib/functions.sh . /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##*/}"
file="${file%.control}" file="${file%.control}"
add_group_and_user "${file}" add_group_and_user "${file}"

View File

@ -91,7 +91,7 @@ failsafe_wait() {
grep -q 'failsafe=' /proc/cmdline && FAILSAFE=true && export FAILSAFE grep -q 'failsafe=' /proc/cmdline && FAILSAFE=true && export FAILSAFE
if [ "$FAILSAFE" != "true" ]; then if [ "$FAILSAFE" != "true" ]; then
fs_wait_for_key f 'to enter failsafe mode' $fs_failsafe_wait_timeout && FAILSAFE=true 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 [ "$FAILSAFE" = "true" ] && export FAILSAFE && touch /tmp/failsafe
fi fi
} }

View File

@ -72,14 +72,14 @@ while [ "$1" ]; do
fi fi
[ $QUIET = yes ] || echo " * Checking package $1:" [ $QUIET = yes ] || echo " * Checking package $1:"
ERR="" 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? # Are the changed files config files?
if [ $? -ne 0 ] && [ "`cat "/usr/lib/opkg/info/$1.files-sha256sum"`" ]; then if [ $? -ne 0 ] && [ "$(cat "/usr/lib/opkg/info/$1.files-sha256sum")" ]; then
NEWCHECK="`echo "$CHECK" | grep '^.*: OK$'`" NEWCHECK="$(echo "$CHECK" | grep '^.*: OK$')"
for i in `echo "$CHECK" | sed -n 's|^\(.*\): FAILED$|\1|p'`; do for i in $(echo "$CHECK" | sed -n 's|^\(.*\): FAILED$|\1|p'); do
if [ "`grep "^$i\$" "/usr/lib/opkg/info/$1.conffiles" 2> /dev/null`" ] || \ if [ "$(grep "^$i\$" "/usr/lib/opkg/info/$1.conffiles" 2> /dev/null)" ] || \
[ "`echo "$i" | grep "^/etc/uci-defaults/"`" ]; then [ "$(echo "$i" | grep "^/etc/uci-defaults/")" ]; then
NEWCHECK="${NEWCHECK}${NL}${i}: CONFIGURED" NEWCHECK="${NEWCHECK}${NL}${i}: CONFIGURED"
else else
NEWCHECK="${NEWCHECK}${NL}${i}: FAILED" NEWCHECK="${NEWCHECK}${NL}${i}: FAILED"
@ -91,7 +91,7 @@ while [ "$1" ]; do
# Do we have changed files or not? # Do we have changed files or not?
if [ -z "$ERR" ]; then 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 " * Package $1 is ok"
[ $QUIET = yes ] || echo [ $QUIET = yes ] || echo
else else
@ -107,7 +107,7 @@ while [ "$1" ]; do
echo "Exiting on first change found!" echo "Exiting on first change found!"
exit 1 exit 1
fi 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" SUMMARY="${SUMMARY}${NL} - $1: $i"
done done
echo echo