Merge pull request #31 from harrisonpage/master
Created blackbox_cat: Decrypt a file, cat it, shred it. Changed blackbox_shred_all_files to cd to root of repo before shredding.
This commit is contained in:
@@ -390,3 +390,17 @@ function vcs_remove_git() {
|
|||||||
function vcs_remove_svn() {
|
function vcs_remove_svn() {
|
||||||
svn delete """$@"""
|
svn delete """$@"""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function change_to_root() {
|
||||||
|
# If BASEDIR is not set, use REPOBASE.
|
||||||
|
if [[ "$BASEDIR" = "" ]]; then
|
||||||
|
BASEDIR="$REPOBASE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$BASEDIR" = "/dev/null" ]]; then
|
||||||
|
echo 'WARNING: Not in a VCS repo. Not changing directory.'
|
||||||
|
else
|
||||||
|
echo "CDing to $BASEDIR"
|
||||||
|
cd "$BASEDIR"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|||||||
20
bin/blackbox_cat
Executable file
20
bin/blackbox_cat
Executable file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# blackbox_cat.sh -- Decrypt a file, cat it, shred it
|
||||||
|
#
|
||||||
|
set -e
|
||||||
|
. _blackbox_common.sh
|
||||||
|
|
||||||
|
for param in """$@""" ; do
|
||||||
|
shreddable=0
|
||||||
|
unencrypted_file=$(get_unencrypted_filename "$param")
|
||||||
|
if [[ ! -e "$unencrypted_file" ]]; then
|
||||||
|
blackbox_edit_start "$param"
|
||||||
|
shreddable=1
|
||||||
|
fi
|
||||||
|
cat "$unencrypted_file"
|
||||||
|
if [[ $shreddable = 1 ]]; then
|
||||||
|
shred_file "$unencrypted_file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
@@ -22,18 +22,7 @@ else
|
|||||||
FILE_GROUP="$1"
|
FILE_GROUP="$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If BASEDIR is not set, use REPOBASE.
|
change_to_root
|
||||||
if [[ "$BASEDIR" = "" ]]; then
|
|
||||||
BASEDIR="$REPOBASE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$BASEDIR" = "/dev/null" ]]; then
|
|
||||||
echo 'WARNING: Not in a VCS repo. Not changing directory.'
|
|
||||||
else
|
|
||||||
echo "CDing to $BASEDIR"
|
|
||||||
cd "$BASEDIR"
|
|
||||||
fi
|
|
||||||
|
|
||||||
prepare_keychain
|
prepare_keychain
|
||||||
|
|
||||||
# Decrypt:
|
# Decrypt:
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
set -e
|
set -e
|
||||||
. _blackbox_common.sh
|
. _blackbox_common.sh
|
||||||
|
|
||||||
|
change_to_root
|
||||||
|
|
||||||
echo '========== FILES BEING SHREDDED:'
|
echo '========== FILES BEING SHREDDED:'
|
||||||
for i in $(<$BB_FILES) ; do
|
for i in $(<$BB_FILES) ; do
|
||||||
unencrypted_file=$(get_unencrypted_filename "$i")
|
unencrypted_file=$(get_unencrypted_filename "$i")
|
||||||
|
|||||||
Reference in New Issue
Block a user