Files
blackbox/bin/blackbox_shred_all_files
tlimoncelli@stackexchange.com 225d38ee11 BACKWARDS INCOMPATIBLE CHANGES:
* Using $BASEDIR to pass the location of the repo hasn't worked for a
  while. It has been removed.  Simply cd into the vcs repo before
  running a command.
BUG FIXES:
* .gitignore was being created in subdirectories instead of VCS root.
MINOR CHANGES
* _blackbox_common.sh: Replace change_to_root with change_to_vcs_root
* confidence_test.sh: Added more assertions and tests.
2015-03-10 21:16:27 +00:00

35 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# blackbox_shred_all_files -- shred all decrypted versions of encrypted files
#
# Shred: To securely delete a file.
#
# Typical uses:
# After running blackbox_edit_start, deciding not to edit the file.
# A developer that wants to securely clean up a workspace before deleting it.
# An automated process that doesn't want to leave
# plaintext (unencrypted) files laying around.
#
# NOTE: The output lists files that were decrypted and are being
# shredded. For example, if you have many encrypted files but none
# have been decrypted for editing, you will see an empty list.
set -e
blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source "${blackbox_home}/_blackbox_common.sh"
change_to_vcs_root
echo '========== FILES BEING SHREDDED:'
for i in $(<"$BB_FILES") ; do
unencrypted_file=$(get_unencrypted_filename "$i")
encrypted_file=$(get_encrypted_filename "$i")
if [[ -f "$unencrypted_file" ]]; then
echo " $unencrypted_file"
shred_file "$unencrypted_file"
fi
done
echo '========== DONE.'