1640668269.v18-17-gad61841.use-command-v-instead-of-which.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. Subject: Use `command -v` instead of `which`
  2. Origin: v18-17-gad61841 <https://github.com/latchset/clevis/commit/v18-17-gad61841>
  3. Upstream-Author: Rohan Jain <crodjer@pm.me>
  4. Date: Tue Dec 28 10:41:09 2021 +0530
  5. On debian `/usr/bin/which` results in deprecated messages, recommending
  6. `command -v` instead.
  7. They look like:
  8. ```
  9. at 10:35:36 ❯ sudo update-initramfs -u -k 'all'
  10. update-initramfs: Generating /boot/initrd.img-5.15.0-2-amd64
  11. I: The initramfs will attempt to resume from /dev/dm-2
  12. I: (/dev/mapper/sys-swap)
  13. I: Set the RESUME variable to override this.
  14. /usr/bin/which: this version of `which' is deprecated; use `command -v' in scripts instead.
  15. /usr/bin/which: this version of `which' is deprecated; use `command -v' in scripts instead.
  16. /usr/bin/which: this version of `which' is deprecated; use `command -v' in scripts instead.
  17. /usr/bin/which: this version of `which' is deprecated; use `command -v' in scripts instead.
  18. /usr/bin/which: this version of `which' is deprecated; use `command -v' in scripts instead.
  19. /usr/bin/which: this version of `which' is deprecated; use `command -v' in scripts instead.
  20. /usr/bin/which: this version of `which' is deprecated; use `command -v' in scripts instead.
  21. /usr/bin/which: this version of `which' is deprecated; use `command -v' in scripts instead.
  22. ```
  23. --- a/src/initramfs-tools/hooks/clevis.in
  24. +++ b/src/initramfs-tools/hooks/clevis.in
  25. @@ -42,7 +42,7 @@
  26. find_binary() {
  27. bin_name="$1"
  28. - resolved=$(which ${bin_name})
  29. + resolved=$(command -v ${bin_name})
  30. [ -z "$resolved" ] && die 1 "Unable to find ${bin_name}"
  31. echo "$resolved"
  32. }