Unverified Commit daa14fe1 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

fix: Do not mask swtmp exit code (#1043)

Refactor TPM emulator startup command to capture exit code.
parent fe26783f
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -147,8 +147,10 @@ rm -f /var/run/tpm.pid

if [[ "$TPM" == [Yy1]* ]]; then

  if ! swtpm socket -t -d --tpmstate "backend-uri=file://$STORAGE/${BOOT_MODE,,}.tpm" --ctrl type=unixio,path=/run/swtpm-sock --pid file=/var/run/tpm.pid --tpm2; then
    error "Failed to start TPM emulator, reason: $?"
  { swtpm socket -t -d --tpmstate "backend-uri=file://$STORAGE/${BOOT_MODE,,}.tpm" --ctrl type=unixio,path=/run/swtpm-sock --pid file=/var/run/tpm.pid --tpm2; rc=$?; } || :

  if (( rc != 0 )); then
    error "Failed to start TPM emulator, reason: $rc"
  else

    for (( i = 1; i < 20; i++ )); do