From e75e5879c0e8d232a2e8f045685beeb8c965aba4 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 6 Dec 2015 14:03:35 +0100 Subject: replace "which" with "command -v" for portability which is a debian specific tool packaged in debianutils (essential) while command is a shell builtin defined by POSIX. Closes: 807144 Thanks: Mingye Wang for the suggestion. --- cmdline/apt-key.in | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-key.in b/cmdline/apt-key.in index c2e8d176c..3c2e2663f 100644 --- a/cmdline/apt-key.in +++ b/cmdline/apt-key.in @@ -112,7 +112,7 @@ net_update() { fi # in theory we would need to depend on wget for this, but this feature # isn't useable in debian anyway as we have no keyring uri nor a master key - if ! which wget >/dev/null 2>&1; then + if ! command -v wget >/dev/null 2>&1; then echo >&2 "ERROR: an installed wget is required for a network-based update" exit 1 fi @@ -472,11 +472,11 @@ create_gpg_home() { prepare_gpg_home() { eval $(apt-config shell GPG_EXE Apt::Key::gpgcommand) - if [ -n "$GPG_EXE" ] && which "$GPG_EXE" >/dev/null 2>&1; then + if [ -n "$GPG_EXE" ] && command -v "$GPG_EXE" >/dev/null 2>&1; then true - elif which gpg >/dev/null 2>&1; then + elif command -v gpg >/dev/null 2>&1; then GPG_EXE="gpg" - elif which gpg2 >/dev/null 2>&1; then + elif command -v gpg2 >/dev/null 2>&1; then GPG_EXE="gpg2" else echo >&2 "Error: gnupg or gnupg2 do not seem to be installed," @@ -569,9 +569,9 @@ case "$command" in verify) GPGV='' eval $(apt-config shell GPGV Apt::Key::gpgvcommand) - if [ -n "$GPGV" ] && which "$GPGV" >/dev/null 2>&1; then true; - elif which gpgv >/dev/null 2>&1; then GPGV='gpgv'; - elif which gpgv2 >/dev/null 2>&1; then GPGV='gpgv2'; + if [ -n "$GPGV" ] && command -v "$GPGV" >/dev/null 2>&1; then true; + elif command -v gpgv >/dev/null 2>&1; then GPGV='gpgv'; + elif command -v gpgv2 >/dev/null 2>&1; then GPGV='gpgv2'; else echo >&2 'ERROR: gpgv or gpgv2 required for verification' exit 29 -- cgit v1.2.3