supress errors on console when files don't exist (equivalent of rm -f)

This commit is contained in:
Thierry Laurion 2019-02-21 20:16:02 -05:00
parent 0722d42d65
commit 14c76d062c
No known key found for this signature in database
GPG Key ID: 79C78E6659DB658F
5 changed files with 11 additions and 11 deletions

View File

@ -38,7 +38,7 @@ for tries in 1 2 3; do
-hk 40000000 \
; then
# should be okay if this fails
shred -n 10 -z -u /tmp/secret/sealed || true
shred -n 10 -z -u /tmp/secret/sealed 2> /dev/null || true
exit 0
fi

View File

@ -28,9 +28,9 @@ tpm unsealfile \
-of "$HOTP_SECRET" \
|| die "Unable to unseal HOTP secret"
shred -n 10 -z -u "$HOTP_SEALED"
shred -n 10 -z -u "$HOTP_SEALED" 2> /dev/null
secret="`cat $HOTP_SECRET`"
shred -n 10 -z -u "$HOTP_SECRET"
shred -n 10 -z -u "$HOTP_SECRET" 2> /dev/null
# Store counter in file instead of TPM for now, as it conflicts with Heads
# config TPM counter as TPM 1.2 can only increment one counter between reboots

View File

@ -43,7 +43,7 @@ if ! tpm sealfile2 \
-ix 4 0000000000000000000000000000000000000000 \
-ix 7 X \
; then
shred -n 10 -z -u "$TOTP_SECRET"
shred -n 10 -z -u "$TOTP_SECRET" 2> /dev/null
die "Unable to seal secret"
fi
@ -79,7 +79,7 @@ if ! tpm nv_writevalue \
|| die "Unable to write sealed secret to NVRAM"
fi
shred -n 10 -z -u "$TOTP_SEALED"
shred -n 10 -z -u "$TOTP_SEALED" 2> /dev/null
url="otpauth://totp/$HOST?secret=$secret"
secret=""

View File

@ -28,7 +28,7 @@ tpm unsealfile \
-of "$HOTP_SECRET" \
|| die "Unable to unseal HOTP secret"
shred -n 10 -z -u "$HOTP_SEALED"
shred -n 10 -z -u "$HOTP_SEALED" 2> /dev/null
# Store counter in file instead of TPM for now, as it conflicts with Heads
# config TPM counter as TPM 1.2 can only increment one counter between reboots
@ -51,11 +51,11 @@ fi
#counter_value=$(printf "%d" 0x${counter_value})
if ! hotp $counter_value < "$HOTP_SECRET"; then
shred -n 10 -z -u "$HOTP_SECRET"
shred -n 10 -z -u "$HOTP_SECRET" 2> /dev/null
die 'Unable to compute HOTP hash?'
fi
shred -n 10 -z -u "$HOTP_SECRET"
shred -n 10 -z -u "$HOTP_SECRET" 2> /dev/null
#increment_tpm_counter $counter > /dev/null \
#|| die "Unable to increment tpm counter"

View File

@ -18,12 +18,12 @@ tpm unsealfile \
-of "$TOTP_SECRET" \
|| die "Unable to unseal totp secret"
shred -n 10 -z -u "$TOTP_SEALED"
shred -n 10 -z -u "$TOTP_SEALED" 2> /dev/null
if ! totp -q < "$TOTP_SECRET"; then
shred -n 10 -z -u "$TOTP_SECRET"
shred -n 10 -z -u "$TOTP_SECRET" 2> /dev/null
die 'Unable to compute TOTP hash?'
fi
shred -n 10 -z -u "$TOTP_SECRET"
shred -n 10 -z -u "$TOTP_SECRET" 2> /dev/null
exit 0