Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuxillo/82d4df037f71616747a6e58217c1163a to your computer and use it in GitHub Desktop.
Save tuxillo/82d4df037f71616747a6e58217c1163a to your computer and use it in GitHub Desktop.
[PATCH] pki: Do not use 'which' for finding gnutls certool path.
From 8e5048730ebdc38d56f662e7d44f91b047a44dce Mon Sep 17 00:00:00 2001
From: Antonio Huete Jimenez <tuxillo@quantumachine.net>
Date: Sun, 15 Jan 2017 19:21:51 +0000
Subject: [PATCH] pki: Do not use 'which' for finding gnutls certool path.
- Use 'command -v' which should be more portable.
- http://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html
---
pki/generate.ca | 2 +-
pki/generate.client | 2 +-
pki/generate.crl | 2 +-
pki/generate.server | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/pki/generate.ca b/pki/generate.ca
index 8c7e29a..5bdc8e2 100755
--- a/pki/generate.ca
+++ b/pki/generate.ca
@@ -1,7 +1,7 @@
#!/bin/sh
# Take the correct binary to create the certificates
-CERTTOOL=$(which gnutls-certtool 2>/dev/null || which certtool 2>/dev/null)
+CERTTOOL=$(command -v gnutls-certtool 2>/dev/null || command -v certtool 2>/dev/null)
if [ -z "$CERTTOOL" ]
then
echo "ERROR: No certtool found" >&2
diff --git a/pki/generate.client b/pki/generate.client
index f470a27..63b2ffb 100755
--- a/pki/generate.client
+++ b/pki/generate.client
@@ -1,7 +1,7 @@
#!/bin/sh
# Take the correct binary to create the certificates
-CERTTOOL=$(which gnutls-certtool 2>/dev/null || which certtool 2>/dev/null)
+CERTTOOL=$(command -v gnutls-certtool 2>/dev/null || command -v certtool 2>/dev/null)
if [ -z "$CERTTOOL" ]
then
echo "ERROR: No certtool found" >&2
diff --git a/pki/generate.crl b/pki/generate.crl
index ed0f6b5..6a9daa8 100755
--- a/pki/generate.crl
+++ b/pki/generate.crl
@@ -1,7 +1,7 @@
#!/bin/sh
# Take the correct binary to create the certificates
-CERTTOOL=$(which gnutls-certtool 2>/dev/null || which certtool 2>/dev/null)
+CERTTOOL=$(command -v gnutls-certtool 2>/dev/null || command -v certtool 2>/dev/null)
if [ -z "$CERTTOOL" ]
then
echo "ERROR: No certtool found" >&2
diff --git a/pki/generate.server b/pki/generate.server
index 94dea1c..681bf43 100755
--- a/pki/generate.server
+++ b/pki/generate.server
@@ -1,7 +1,7 @@
#!/bin/sh
# Take the correct binary to create the certificates
-CERTTOOL=$(which gnutls-certtool 2>/dev/null || which certtool 2>/dev/null)
+CERTTOOL=$(command -v gnutls-certtool 2>/dev/null || command -v certtool 2>/dev/null)
if [ -z "$CERTTOOL" ]
then
echo "ERROR: No certtool found" >&2
--
2.10.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment