Added / Pruned quotes and separated local variable declaration from assignment.

This commit is contained in:
Dan OBoyle
2015-06-28 19:26:47 -04:00
parent 85e1ea7ccc
commit a648fb8e46

View File

@@ -105,7 +105,7 @@ function fail_if_not_on_cryptlist() {
if ! is_on_cryptlist "$name" ; then
echo "ERROR: $name not found in $BB_FILES" >&2
echo "PWD="$(/bin/pwd) >&2
echo "PWD=""$(/bin/pwd)" >&2
echo 'Exiting...' >&2
exit 1
fi
@@ -131,12 +131,12 @@ function get_pubring_path() {
# Output the unencrypted filename.
function get_unencrypted_filename() {
echo $(dirname "$1")/$(basename "$1" .gpg) | sed -e 's#^\./##'
echo "$(dirname "$1")"/"$(basename "$1" .gpg)" | sed -e 's#^\./##'
}
# Output the encrypted filename.
function get_encrypted_filename() {
echo $(dirname "$1")/$(basename "$1" .gpg).gpg | sed -e 's#^\./##'
echo "$(dirname "$1")"/"$(basename "$1" .gpg)".gpg | sed -e 's#^\./##'
}
# Prepare keychain for use.
@@ -150,7 +150,8 @@ function prepare_keychain() {
function add_filename_to_cryptlist() {
# If the name is already on the list, this is a no-op.
# However no matter what the datestamp is updated.
local name=$(vcs_relative_path "$1")
local name
name=$(vcs_relative_path "$1")
if file_contains_line "$BB_FILES" "$name" ; then
echo "========== File is registered. No need to add to list."
@@ -164,19 +165,20 @@ function add_filename_to_cryptlist() {
# Removes a file from the list of encrypted files
function remove_filename_from_cryptlist() {
# If the name is not already on the list, this is a no-op.
local name=$(vcs_relative_path "$1")
local name
name=$(vcs_relative_path "$1")
if ! file_contains_line "$BB_FILES" "$name" ; then
echo ========== File is not registered. No need to remove from list.
echo "========== File is not registered. No need to remove from list."
else
echo ========== Removing file from list.
echo "========== Removing file from list."
remove_line "$BB_FILES" "$name"
fi
}
# Print out who the current BB ADMINS are:
function disclose_admins() {
echo ========== blackbox administrators are:
echo "========== blackbox administrators are:"
cat "$BB_ADMINS"
}
@@ -188,7 +190,7 @@ function encrypt_file() {
encrypted="$2"
echo "========== Encrypting: $unencrypted" >&2
$GPG --use-agent --yes --trust-model=always --encrypt -o "$encrypted" $(awk '{ print "-r" $1 }' < "$BB_ADMINS") "$unencrypted" >&2
$GPG --use-agent --yes --trust-model=always --encrypt -o "$encrypted" "$(awk '{ print "-r" $1 }' < "$BB_ADMINS")" "$unencrypted" >&2
echo '========== Encrypting: DONE' >&2
}
@@ -200,7 +202,7 @@ function decrypt_file() {
encrypted="$1"
unencrypted="$2"
echo '========== EXTRACTING ''"'$unencrypted'"' >&2
echo "========== EXTRACTING $unencrypted" >&2
old_umask=$(umask)
umask "$DECRYPT_UMASK"