base-files/functions.sh: use command -v instead of which

which must be executed. command -v is a shell builtin.

https://github.com/koalaman/shellcheck/wiki/SC2230

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2020-01-17 14:38:19 -08:00 committed by Petr Štetiar
parent dec9ae6d9e
commit 8e6f2c029f

View File

@ -176,7 +176,7 @@ default_prerm() {
ret=$? ret=$?
fi fi
local shell="$(which bash)" local shell="$(command -v bash)"
for i in $(grep -s "^/etc/init.d/" "$root/usr/lib/opkg/info/${pkgname}.list"); do for i in $(grep -s "^/etc/init.d/" "$root/usr/lib/opkg/info/${pkgname}.list"); do
if [ -n "$root" ]; then if [ -n "$root" ]; then
${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" disable ${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" disable
@ -264,7 +264,7 @@ default_postinst() {
rm -f /tmp/luci-indexcache rm -f /tmp/luci-indexcache
fi fi
local shell="$(which bash)" local shell="$(command -v bash)"
for i in $(grep -s "^/etc/init.d/" "$root$filelist"); do for i in $(grep -s "^/etc/init.d/" "$root$filelist"); do
if [ -n "$root" ]; then if [ -n "$root" ]; then
${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" enable ${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" enable