2015-06-12 13:23:45 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# blackbox_deregister_file -- Remove a file from the blackbox system.
|
|
|
|
|
#
|
2015-06-20 15:39:32 +00:00
|
|
|
# Takes an encrypted file and removes it from the blackbox system.
|
|
|
|
|
# The encrypted file will also be removed from the filesystem.
|
|
|
|
|
# The unencrypted file, if it exists, will be left alone.
|
2015-06-12 13:23:45 -05:00
|
|
|
|
|
|
|
|
set -e
|
2015-06-16 13:21:51 -05:00
|
|
|
source "${0%/*}/_blackbox_common.sh"
|
2015-06-12 13:23:45 -05:00
|
|
|
|
|
|
|
|
unencrypted_file=$(get_unencrypted_filename "$1")
|
|
|
|
|
encrypted_file=$(get_encrypted_filename "$1")
|
|
|
|
|
|
|
|
|
|
if [[ "$1" == "$unencrypted_file" ]]; then
|
|
|
|
|
echo ERROR: Please only deregister encrypted files.
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo ========== PLAINFILE "$unencrypted_file"
|
|
|
|
|
echo ========== ENCRYPTED "$encrypted_file"
|
|
|
|
|
|
|
|
|
|
fail_if_not_exists "$encrypted_file" "Please specify an existing file."
|
|
|
|
|
|
|
|
|
|
prepare_keychain
|
|
|
|
|
remove_filename_from_cryptlist "$unencrypted_file"
|
2015-06-20 15:39:32 +00:00
|
|
|
vcs_remove "$encrypted_file"
|
2015-12-16 15:54:28 -06:00
|
|
|
vcs_notice "$unencrypted_file"
|
2015-06-20 15:39:32 +00:00
|
|
|
vcs_add "$BB_FILES"
|
2015-06-12 13:23:45 -05:00
|
|
|
|
2019-01-09 16:43:24 +01:00
|
|
|
vcs_commit "Removing from blackbox: ${unencrypted_file}" "$BB_FILES" "$encrypted_file" "$(vcs_ignore_file_path)"
|
2015-06-12 13:23:45 -05:00
|
|
|
echo "========== UPDATING VCS: DONE"
|
|
|
|
|
echo "Local repo updated. Please push when ready."
|
2015-06-16 14:02:54 -05:00
|
|
|
echo " $VCS_TYPE push"
|