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 AmadeusGhost
parent e768b5bb9a
commit 09c716e76a

View File

@ -160,7 +160,7 @@ default_prerm() {
ret=$?
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
if [ -n "$root" ]; then
${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" disable
@ -242,7 +242,7 @@ default_postinst() {
[ -n "$root" ] || rm -f /tmp/luci-indexcache 2>/dev/null
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
if [ -n "$root" ]; then
${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" enable