Files
blackbox/bin/blackbox_deregister_file
Tyler Akins 792d11e85a Removing the multiple calls to determine VCS type
This removed the subshell from _determine_vcs_base_and_type so it can
set environment variables.

Because this always runs at the beginning of the scripts, there's no
need to do checking if REPOBASE is unset or if VCS_TYPE is not yet
determined, thus I simplified one function and eliminated which_vcs.
2015-06-16 14:11:46 -05:00

35 lines
1011 B
Bash
Executable File

#!/usr/bin/env bash
#
# blackbox_deregister_file -- Remove a file from the blackbox system.
#
# Takes an encrypted file and removes it from the blackbox system. The
# encrypted file will also be removed from the filesystem.
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")
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"
vcs_notice "$unencrypted_file"
vcs_remove "$BB_FILES"
vcs_commit "Removing from blackbox: ${unencrypted_file}"
echo "========== UPDATING VCS: DONE"
echo "Local repo updated. Please push when ready."
echo " $VCS_TYPE push"