diff options
author | Dave Heller <hellerda@linux.vnet.ibm.com> | 2017-12-21 11:23:07 -0500 |
---|---|---|
committer | Dave Heller <hellerda@linux.vnet.ibm.com> | 2017-12-21 11:23:07 -0500 |
commit | 1b073143dd46950ba63e8bc6c13d29733d1b54a5 (patch) | |
tree | d50a87b142523ebd6b0545855841be51e795eb9d /crtSignedContainer.sh | |
parent | f9fdae07fe30ddb83867e5f958861d3c4a9ab63f (diff) | |
download | sb-signing-utils-1b073143dd46950ba63e8bc6c13d29733d1b54a5.tar.gz sb-signing-utils-1b073143dd46950ba63e8bc6c13d29733d1b54a5.zip |
Check return code from executables and fail on error
Signed-off-by: Dave Heller <hellerda@linux.vnet.ibm.com>
Diffstat (limited to 'crtSignedContainer.sh')
-rwxr-xr-x | crtSignedContainer.sh | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/crtSignedContainer.sh b/crtSignedContainer.sh index c0f1859..9ba5868 100755 --- a/crtSignedContainer.sh +++ b/crtSignedContainer.sh @@ -534,7 +534,10 @@ then -epwd "$SF_EPWD" -comments "Requesting $SF_PROJECT" \ -url sftp://$SF_USER@$SF_SERVER -pkey "$SF_SSHKEY" \ -o "$T/$KEYFILE" - # TODO Check return code, fail on error... + rc=$? + + test $rc -ne 0 && die "Call to sf_client failed with error: $rc" + echo "--> $P: Retrieved public key for HW key $(to_upper $KEY)." fi fi @@ -571,7 +574,10 @@ then -epwd "$SF_EPWD" -comments "Requesting $SF_PROJECT" \ -url sftp://$SF_USER@$SF_SERVER -pkey "$SF_SSHKEY" \ -o "$T/$KEYFILE" - # TODO Check return code, fail on error... + rc=$? + + test $rc -ne 0 && die "Call to sf_client failed with error: $rc" + echo "--> $P: Retrieved public key for SW key $(to_upper $KEY)." fi fi @@ -594,6 +600,9 @@ create-container $HW_KEY_ARGS $SW_KEY_ARGS \ --dumpPrefixHdr "$T/prefix_hdr" --dumpSwHdr "$T/software_hdr" \ $DEBUG_ARGS \ $ADDL_ARGS +rc=$? + +test $rc -ne 0 && die "Call to create-container failed with error: $rc" # # Prepare the HW and SW key signatures @@ -688,7 +697,10 @@ then -comments "Requesting sig for $SF_PROJECT" \ -url sftp://$SF_USER@$SF_SERVER -pkey "$SF_SSHKEY" \ -payload "$T/prefix_hdr" -o "$T/$SIGFILE" - # TODO Check return code, fail on error... + rc=$? + + test $rc -ne 0 && die "Call to sf_client failed with error: $rc" + echo "--> $P: Retrieved signature for HW key $(to_upper $KEY)." fi fi @@ -719,7 +731,10 @@ then -comments "Requesting sig for $LABEL from $SF_PROJECT" \ -url sftp://$SF_USER@$SF_SERVER -pkey "$SF_SSHKEY" \ -payload "$T/software_hdr.sha512.bin" -o "$T/$SIGFILE" - # TODO Check return code, fail on error... + rc=$? + + test $rc -ne 0 && die "Call to sf_client failed with error: $rc" + echo "--> $P: Retrieved signature for SW key $(to_upper $KEY)." fi @@ -739,6 +754,9 @@ if [ -n "$HW_SIG_ARGS" -o -n "$SW_SIG_ARGS" ]; then $CONTR_HDR_OUT_OPT "$SB_CONTR_HDR_OUT" \ $DEBUG_ARGS \ $ADDL_ARGS + rc=$? + + test $rc -ne 0 && die "Call to create-container failed with error: $rc" test -n "$SB_CONTR_HDR_OUT" && \ echo "--> $P: Container header saved to: $SB_CONTR_HDR_OUT" |