@@ -182,7 +182,8 @@ default_prerm() {
fi
local shell="$(command -v bash)"
- for i in $(grep -s "^/etc/init.d/" "$root/usr/lib/opkg/info/${pkgname}.list"); do
+ grep -s "^/etc/init.d/" "$root/usr/lib/opkg/info/${pkgname}.list" | while IFS= read -r i
+ do
if [ -n "$root" ]; then
${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" disable
else
@@ -260,7 +261,8 @@ default_postinst() {
if grep -m1 -q -s "^/etc/uci-defaults/" "$filelist"; then
[ -d /tmp/.uci ] || mkdir -p /tmp/.uci
- for i in $(grep -s "^/etc/uci-defaults/" "$filelist"); do
+ grep -s "^/etc/uci-defaults/" "$filelist" | while IFS= read -r i
+ do
( [ -f "$i" ] && cd "$(dirname $i)" && . "$i" ) && rm -f "$i"
done
uci commit
@@ -270,7 +272,8 @@ default_postinst() {
fi
local shell="$(command -v bash)"
- for i in $(grep -s "^/etc/init.d/" "$root$filelist"); do
+ grep -s "^/etc/init.d/" "$root$filelist" | while IFS= read -r i
+ do
if [ -n "$root" ]; then
${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" enable
else
From https://github.com/koalaman/shellcheck/wiki/SC2013 For loops by default (subject to $IFS) read word by word. Additionally, glob expansion will occur. I believe the intended use case of these loops is to read lines. Signed-off-by: Rosen Penev <rosenp@gmail.com> --- package/base-files/files/lib/functions.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)