diff mbox series

run-postinsts: Replace which by command -v

Message ID cfc0fd54a4efc5ba57ecf7a84980be54169ca07a.1776357492.git.joerg.sommer@navimatix.de
State Accepted, archived
Commit 4af3b2219bc87e21a8738e51f9fe1bca27a61706
Headers show
Series run-postinsts: Replace which by command -v | expand

Commit Message

Jörg Sommer April 16, 2026, 4:38 p.m. UTC
From: Jörg Sommer <joerg.sommer@navimatix.de>

The command *which* can be provided by the packages which, debianutils,
busybox, or zsh. But if none of these are installed, the call fails. The
POSIX way to check for a command is `command -v` and suppress the output in
case of success.

Signed-off-by: Jörg Sommer <joerg.sommer@navimatix.de>
---
 meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
index e8c31e04ce..be752a95f0 100755
--- a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
+++ b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
@@ -41,7 +41,7 @@  for pm in $backend_list; do
 done
 
 remove_rcsd_link () {
-	if [ -n "`which update-rc.d`" ]; then
+	if command -v update-rc.d >/dev/null; then
 		update-rc.d -f run-postinsts remove
 	fi
 }