samples: swtpm-create-tpmca: Check for missing tpmtool
Recent GnuTLS does not package tpmtool anymore. Check for
the missing tpmtool and report an error as appropriate.
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
diff --git a/samples/swtpm-create-tpmca b/samples/swtpm-create-tpmca
index 77c1057..7a9b439 100755
--- a/samples/swtpm-create-tpmca
+++ b/samples/swtpm-create-tpmca
@@ -57,6 +57,11 @@
run_tpmtool() {
local prg out rc
+ if [ -z "$(type -P tpmtool)" ]; then
+ echo "Could not find tpmtool in PATH (${PATH})."
+ return 1
+ fi
+
prg="spawn tpmtool "$@"
expect {
\"Enter SRK password:\" {
@@ -404,6 +409,8 @@
{
local tmp
+ [ -z "$(type -P tpmtool)" ] && return 1
+
tmp=$(tpmtool --help | grep "srk-well-known")
[ -z "${tmp}" ] && return 1
return 0