Added / Pruned quotes and separated local variable declaration from assignment.
This commit is contained in:
@@ -105,7 +105,7 @@ function fail_if_not_on_cryptlist() {
|
|||||||
|
|
||||||
if ! is_on_cryptlist "$name" ; then
|
if ! is_on_cryptlist "$name" ; then
|
||||||
echo "ERROR: $name not found in $BB_FILES" >&2
|
echo "ERROR: $name not found in $BB_FILES" >&2
|
||||||
echo "PWD="$(/bin/pwd) >&2
|
echo "PWD=""$(/bin/pwd)" >&2
|
||||||
echo 'Exiting...' >&2
|
echo 'Exiting...' >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -131,12 +131,12 @@ function get_pubring_path() {
|
|||||||
|
|
||||||
# Output the unencrypted filename.
|
# Output the unencrypted filename.
|
||||||
function get_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.
|
# Output the encrypted filename.
|
||||||
function get_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.
|
# Prepare keychain for use.
|
||||||
@@ -150,7 +150,8 @@ function prepare_keychain() {
|
|||||||
function add_filename_to_cryptlist() {
|
function add_filename_to_cryptlist() {
|
||||||
# If the name is already on the list, this is a no-op.
|
# If the name is already on the list, this is a no-op.
|
||||||
# However no matter what the datestamp is updated.
|
# 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
|
if file_contains_line "$BB_FILES" "$name" ; then
|
||||||
echo "========== File is registered. No need to add to list."
|
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
|
# Removes a file from the list of encrypted files
|
||||||
function remove_filename_from_cryptlist() {
|
function remove_filename_from_cryptlist() {
|
||||||
# If the name is not already on the list, this is a no-op.
|
# 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
|
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
|
else
|
||||||
echo ========== Removing file from list.
|
echo "========== Removing file from list."
|
||||||
remove_line "$BB_FILES" "$name"
|
remove_line "$BB_FILES" "$name"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print out who the current BB ADMINS are:
|
# Print out who the current BB ADMINS are:
|
||||||
function disclose_admins() {
|
function disclose_admins() {
|
||||||
echo ========== blackbox administrators are:
|
echo "========== blackbox administrators are:"
|
||||||
cat "$BB_ADMINS"
|
cat "$BB_ADMINS"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +190,7 @@ function encrypt_file() {
|
|||||||
encrypted="$2"
|
encrypted="$2"
|
||||||
|
|
||||||
echo "========== Encrypting: $unencrypted" >&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
|
echo '========== Encrypting: DONE' >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +202,7 @@ function decrypt_file() {
|
|||||||
encrypted="$1"
|
encrypted="$1"
|
||||||
unencrypted="$2"
|
unencrypted="$2"
|
||||||
|
|
||||||
echo '========== EXTRACTING ''"'$unencrypted'"' >&2
|
echo "========== EXTRACTING $unencrypted" >&2
|
||||||
|
|
||||||
old_umask=$(umask)
|
old_umask=$(umask)
|
||||||
umask "$DECRYPT_UMASK"
|
umask "$DECRYPT_UMASK"
|
||||||
|
|||||||
Reference in New Issue
Block a user