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

feat: Make TPM state persistent (#595)

parent 3169e883
Loading
Loading
Loading
Loading
+16 −18
Original line number Diff line number Diff line
@@ -89,14 +89,11 @@ esac

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

  rm -rf /run/shm/tpm
  rm -f /var/run/tpm.pid
  mkdir -p /run/shm/tpm
  chmod 755 /run/shm/tpm

  if ! swtpm socket -t -d --tpmstate dir=/run/shm/tpm --ctrl type=unixio,path=/run/swtpm-sock --pid file=/var/run/tpm.pid --tpm2; then
    error "Failed to start TPM emulator, reason: $?" && exit 19
  fi
  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: $?"
  else

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

@@ -116,6 +113,7 @@ if [[ "$TPM" == [Yy1]* ]]; then
      BOOT_OPTS+=" -chardev socket,id=chrtpm,path=/run/swtpm-sock"
      BOOT_OPTS+=" -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0"
    fi
  fi

fi