Files
blackbox/bin/blackbox_edit_end
Warren Gray beefbfb912 - Fix blackbox commands so that they work when called with absolute paths.
- Fix confidence_test.sh so that it's not hardcoded to a specific dev environment path.
2015-01-13 14:42:58 -05:00

28 lines
790 B
Bash
Executable File

#!/usr/bin/env bash
#
# blackbox_edit_end -- Re-encrypt file after edits.
#
set -e
blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source ${blackbox_home}/_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"
_determine_vcs_base_and_type
echo "========== UPDATED ${encrypted_file}"
echo "Likely next step:"
echo " $VCS_TYPE commit -m\"${encrypted_file} updated\" $encrypted_file"