Files
blackbox/bin/blackbox_edit_end
tlimoncelli@stackexchange.com f387bc9f30 Remove ".sh" from file names.
Refactor so it does not rely on PWD being the repo basedir.
Fix assumptions about HG and GIT use.
2014-08-28 20:47:32 +00:00

24 lines
661 B
Bash
Executable File

#!/usr/bin/env bash
#
# blackbox_edit_end -- Re-encrypt file after edits.
#
. _blackbox_common.sh
unencrypted_file=$(get_unencrypted_filename "$1")
encrypted_file=$(get_encrypted_filename "$1")
echo ========== PLAINFILE "$unencrypted_file"
echo ========== ENCRYPTED "$encrypted_file"
fail_if_not_on_cryptlist "$unencrypted_file"
fail_if_not_exists "$unencrypted_file" "No unencrypted version to encrypt!"
fail_if_keychain_has_secrets
encrypt_file "$unencrypted_file" "$encrypted_file"
shred_file "$unencrypted_file"
echo "========== UPDATED ${encrypted_file}"
echo "Likely next step:"
echo " git commit -m\"${encrypted_file} updated\" $encrypted_file"