From 1e269f4d6e5451f4ca593d13f33f30c73dfe87bc Mon Sep 17 00:00:00 2001 From: Paul Wise Date: Fri, 12 May 2023 14:20:45 +0800 Subject: [PATCH] Use `command -v` instead of `which` for finding programs which is non-standard and prints warnings when programs are not installed, but pass-otp already handles programs not being installed properly. Still use which in the tests because it usefully prints the $PATH too. --- default.nix | 3 +-- otp.bash | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/default.nix b/default.nix index 794b1e7..0e54bbd 100644 --- a/default.nix +++ b/default.nix @@ -8,7 +8,6 @@ , gnupg , pass , shellcheck -, which }: stdenv.mkDerivation { @@ -33,7 +32,7 @@ stdenv.mkDerivation { doCheck = true; patchPhase = '' - sed -i -e 's|OATH=\$(which oathtool)|OATH=${oathToolkit}/bin/oathtool|' otp.bash + sed -i -e 's|OATH=\$(command -v oathtool)|OATH=${oathToolkit}/bin/oathtool|' otp.bash ''; checkPhase = '' diff --git a/otp.bash b/otp.bash index 3d37698..ff61411 100755 --- a/otp.bash +++ b/otp.bash @@ -17,8 +17,8 @@ # [] VERSION="1.1.2" -OATH=$(which oathtool) -OTPTOOL=$(which otptool) +OATH=$(command -v oathtool) +OTPTOOL=$(command -v otptool) if [[ $PASSAGE == 1 ]]; then EXT="age"