diff --git a/bin/_blackbox_common.sh b/bin/_blackbox_common.sh index 4e9ecf5..eaf4bd3 100755 --- a/bin/_blackbox_common.sh +++ b/bin/_blackbox_common.sh @@ -390,3 +390,17 @@ function vcs_remove_git() { function vcs_remove_svn() { 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 +} diff --git a/bin/blackbox_postdeploy b/bin/blackbox_postdeploy index 8e285ae..18c9fe1 100755 --- a/bin/blackbox_postdeploy +++ b/bin/blackbox_postdeploy @@ -22,18 +22,7 @@ else FILE_GROUP="$1" fi -# 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 - +change_to_root prepare_keychain # Decrypt: diff --git a/bin/blackbox_shred_all_files b/bin/blackbox_shred_all_files index 636633c..74bbfc7 100755 --- a/bin/blackbox_shred_all_files +++ b/bin/blackbox_shred_all_files @@ -18,6 +18,8 @@ set -e . _blackbox_common.sh +change_to_root + echo '========== FILES BEING SHREDDED:' for i in $(<$BB_FILES) ; do unencrypted_file=$(get_unencrypted_filename "$i")