diff options
author | Paul Spooren <mail@aparcar.org> | 2020-08-09 15:33:37 -1000 |
---|---|---|
committer | Adrian Schmutzler <freifunk@adrianschmutzler.de> | 2020-08-12 11:08:05 +0200 |
commit | 1fdf6b745cc3d85be3743837817a360121554134 (patch) | |
tree | 6396426c1b63ceb0b21c486a3158ded303eebe3e /include/rootfs.mk | |
parent | 4165232c45df224f32a94f43b9938d13d643b2a8 (diff) | |
download | upstream-1fdf6b745cc3d85be3743837817a360121554134.tar.gz upstream-1fdf6b745cc3d85be3743837817a360121554134.tar.bz2 upstream-1fdf6b745cc3d85be3743837817a360121554134.zip |
treewide: replace `which` with `command -v`
Fix shellcheck SC2230
> which is non-standard. Use builtin 'command -v' instead.
Using `command -v` is POSIX compliant while `which` is not. Also to
mention, `command -v` is a shell builtin whereas `which` is a separate
busybox applet.
Once applied to everything concerning OpenWrt we can disable the busybox
feature `which` and save 3.8kB.
Acked-by: Stijn Tintel <stijn@linux-ipv6.be>
Signed-off-by: Paul Spooren <mail@aparcar.org>
[also replace cases in zram-swap]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Diffstat (limited to 'include/rootfs.mk')
-rw-r--r-- | include/rootfs.mk | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/rootfs.mk b/include/rootfs.mk index b6775c7e15..18ada3cd43 100644 --- a/include/rootfs.mk +++ b/include/rootfs.mk @@ -69,7 +69,7 @@ define prepare_rootfs @( \ cd $(1); \ for script in ./usr/lib/opkg/info/*.postinst; do \ - IPKG_INSTROOT=$(1) $$(which bash) $$script; \ + IPKG_INSTROOT=$(1) $$(command -v bash) $$script; \ ret=$$?; \ if [ $$ret -ne 0 ]; then \ echo "postinst script $$script has failed with exit code $$ret" >&2; \ @@ -79,10 +79,10 @@ define prepare_rootfs for script in ./etc/init.d/*; do \ grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \ if ! echo " $(3) " | grep -q " $$(basename $$script) "; then \ - IPKG_INSTROOT=$(1) $$(which bash) ./etc/rc.common $$script enable; \ + IPKG_INSTROOT=$(1) $$(command -v bash) ./etc/rc.common $$script enable; \ echo "Enabling" $$(basename $$script); \ else \ - IPKG_INSTROOT=$(1) $$(which bash) ./etc/rc.common $$script disable; \ + IPKG_INSTROOT=$(1) $$(command -v bash) ./etc/rc.common $$script disable; \ echo "Disabling" $$(basename $$script); \ fi; \ done || true \ |