From beefbfb912c9c814851fcf1da39f03f107c471a1 Mon Sep 17 00:00:00 2001 From: Warren Gray Date: Tue, 13 Jan 2015 14:42:58 -0500 Subject: [PATCH] - 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. --- bin/blackbox_addadmin | 5 +++-- bin/blackbox_cat | 3 ++- bin/blackbox_edit | 3 ++- bin/blackbox_edit_end | 3 ++- bin/blackbox_edit_start | 3 ++- bin/blackbox_initialize | 3 ++- bin/blackbox_postdeploy | 3 ++- bin/blackbox_register_new_file | 3 ++- bin/blackbox_removeadmin | 5 +++-- bin/blackbox_shred_all_files | 3 ++- bin/blackbox_update_all_files | 3 ++- tools/confidence_test.sh | 3 ++- 12 files changed, 26 insertions(+), 14 deletions(-) diff --git a/bin/blackbox_addadmin b/bin/blackbox_addadmin index 8ccc7db..782d815 100755 --- a/bin/blackbox_addadmin +++ b/bin/blackbox_addadmin @@ -9,8 +9,9 @@ # set -e -. _blackbox_common.sh -. _stack_lib.sh +blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +source ${blackbox_home}/_blackbox_common.sh +source ${blackbox_home}/_stack_lib.sh fail_if_not_in_repo diff --git a/bin/blackbox_cat b/bin/blackbox_cat index e8893be..3dd81c4 100755 --- a/bin/blackbox_cat +++ b/bin/blackbox_cat @@ -4,7 +4,8 @@ # blackbox_cat.sh -- Decrypt a file, cat it, shred it # set -e -. _blackbox_common.sh +blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +source ${blackbox_home}/_blackbox_common.sh for param in """$@""" ; do shreddable=0 diff --git a/bin/blackbox_edit b/bin/blackbox_edit index 0af6222..06324ee 100755 --- a/bin/blackbox_edit +++ b/bin/blackbox_edit @@ -4,7 +4,8 @@ # blackbox_edit.sh -- Decrypt a file temporarily for edition, then re-encrypts it again # set -e -. _blackbox_common.sh +blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +source ${blackbox_home}/_blackbox_common.sh for param in """$@""" ; do unencrypted_file=$(get_unencrypted_filename "$param") diff --git a/bin/blackbox_edit_end b/bin/blackbox_edit_end index cbc12fd..826b8d3 100755 --- a/bin/blackbox_edit_end +++ b/bin/blackbox_edit_end @@ -5,7 +5,8 @@ # set -e -. _blackbox_common.sh +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") diff --git a/bin/blackbox_edit_start b/bin/blackbox_edit_start index e5c7827..30eee58 100755 --- a/bin/blackbox_edit_start +++ b/bin/blackbox_edit_start @@ -5,7 +5,8 @@ # set -e -. _blackbox_common.sh +blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +source ${blackbox_home}/_blackbox_common.sh for param in """$@""" ; do unencrypted_file=$(get_unencrypted_filename "$param") diff --git a/bin/blackbox_initialize b/bin/blackbox_initialize index b0ade03..c8062b8 100755 --- a/bin/blackbox_initialize +++ b/bin/blackbox_initialize @@ -9,7 +9,8 @@ # set -e -. _blackbox_common.sh +blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +source ${blackbox_home}/_blackbox_common.sh _determine_vcs_base_and_type # Sets VCS_TYPE diff --git a/bin/blackbox_postdeploy b/bin/blackbox_postdeploy index 18c9fe1..74152ee 100755 --- a/bin/blackbox_postdeploy +++ b/bin/blackbox_postdeploy @@ -14,7 +14,8 @@ export PATH=/usr/bin:/bin:"$PATH" set -e -. _blackbox_common.sh +blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +source ${blackbox_home}/_blackbox_common.sh if [[ "$1" == "" ]]; then FILE_GROUP="" diff --git a/bin/blackbox_register_new_file b/bin/blackbox_register_new_file index 4a76e7a..93e8c1b 100755 --- a/bin/blackbox_register_new_file +++ b/bin/blackbox_register_new_file @@ -11,7 +11,8 @@ # TODO(tlim): Add the unencrypted file to .hgignore set -e -. _blackbox_common.sh +blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +source ${blackbox_home}/_blackbox_common.sh _determine_vcs_base_and_type unencrypted_file=$(get_unencrypted_filename "$1") diff --git a/bin/blackbox_removeadmin b/bin/blackbox_removeadmin index 7bb092c..1863de8 100755 --- a/bin/blackbox_removeadmin +++ b/bin/blackbox_removeadmin @@ -10,8 +10,9 @@ # set -e -. _blackbox_common.sh -. _stack_lib.sh +blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +source ${blackbox_home}/_blackbox_common.sh +source ${blackbox_home}/_stack_lib.sh fail_if_not_in_repo diff --git a/bin/blackbox_shred_all_files b/bin/blackbox_shred_all_files index 74bbfc7..267603e 100755 --- a/bin/blackbox_shred_all_files +++ b/bin/blackbox_shred_all_files @@ -16,7 +16,8 @@ # have been decrypted for editing, you will see an empty list. set -e -. _blackbox_common.sh +blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +source ${blackbox_home}/_blackbox_common.sh change_to_root diff --git a/bin/blackbox_update_all_files b/bin/blackbox_update_all_files index 811568f..14184ef 100755 --- a/bin/blackbox_update_all_files +++ b/bin/blackbox_update_all_files @@ -5,7 +5,8 @@ # set -e -. _blackbox_common.sh +blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +source ${blackbox_home}/_blackbox_common.sh if [[ -z $GPG_AGENT_INFO ]]; then echo 'WARNING: You probably want to run gpg-agent as' diff --git a/tools/confidence_test.sh b/tools/confidence_test.sh index cd538f4..8205699 100755 --- a/tools/confidence_test.sh +++ b/tools/confidence_test.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash -export PATH="$HOME/gitwork/blackbox/bin":/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin +blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../bin +export PATH=${blackbox_home}:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin . _stack_lib.sh