From 48d4b06013ae3d80b95cf72efaf9a5e7468de965 Mon Sep 17 00:00:00 2001 From: Ville Skyttä Date: Thu, 4 Nov 2021 00:02:41 +0200 Subject: Use `command -v` instead of `which` `which` has been deprecated in debianutils 5.0+. The recommended replacement, `command -v`, is mandated by Debian policy these days, in addition to being required by POSIX and its predecessor specs at least since 1994. Not found commands cause no output from `command -v` per POSIX, so remove the redundant 2>&1's while at it. --- cmdline/apt-key.in | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-key.in b/cmdline/apt-key.in index baf3df5c3..137546de3 100644 --- a/cmdline/apt-key.in +++ b/cmdline/apt-key.in @@ -92,18 +92,7 @@ requires_root() { command_available() { if [ -x "$1" ]; then return 0; fi - # command -v "$1" >/dev/null 2>&1 # not required by policy, see #747320 - # which "$1" >/dev/null 2>&1 # is in debianutils (essential) but not on non-debian systems - local OLDIFS="$IFS" - IFS=: - for p in $PATH; do - if [ -x "${p}/${1}" ]; then - IFS="$OLDIFS" - return 0 - fi - done - IFS="$OLDIFS" - return 1 + command -v "$1" >/dev/null # required by policy, see #747320 } escape_shell() { -- cgit v1.2.3-70-g09d2