X-Git-Url: https://zdv2.bktei.com/gitweb/EVA-2020-02.git/blobdiff_plain/17d49005a89922e344cd6904f96b8fb1d6ebab78..77361307addc164bf6470f62d376629f3eeb940e:/exec/bkgpslog?ds=inline diff --git a/exec/bkgpslog b/exec/bkgpslog index b97f250..21c5fc0 100755 --- a/exec/bkgpslog +++ b/exec/bkgpslog @@ -15,6 +15,7 @@ declare -Ag appRollCall # Associative array for storing app status declare -Ag fileRollCall # Associative array for storing file status declare -Ag dirRollCall # Associative array for storing dir status declare -a recPubKeys # for processArguments function +declare recipients # for main function #===BEGIN Declare local script functions=== checkapp() { @@ -192,7 +193,7 @@ processArguments() { -o | --output) if [ -d "$2" ]; then DIROUT="$2"; vbm "DEBUG:DIROUT:$DIROUT"; shift; fi ;; # Define output directory. -e | --encrypt) OPTION_ENCRYPT="true"; vbm "DEBUG:Encrypted output mode enabled.";; -r | --recipient) # Add 'age' recipient via public key string - recPubKeys+=("$2"); shift;; + recPubKeys+=("$2"); vbm "pubkey added:""$2"; shift;; *) echoerr "ERROR: Unrecognized argument."; exit 1;; # Handle unrecognized options. esac shift @@ -276,8 +277,15 @@ main() { for pubkey in "${recPubKeys[@]}"; do # Validate recipient pubkey strings by forming test message vbm "DEBUG:Testing pubkey string:$pubkey" if ! echo "butts" | age -a -r "$pubkey" 1>/dev/null; then - yell "ERROR:Exit code ""$?"". Invalid recipient pubkey string. Exiting."; exit 1; fi + yell "ERROR:Exit code ""$?"". Invalid recipient pubkey string. Exiting."; exit 1; + else + # Form age recipient string + recipients="$recipients""-r $pubkey "; + vbm "Added pubkey:""$pubkey"; + vbm "DEBUG:recipients:""$recipients"; + fi done + vbm "DEBUG:Finished processing recPubKeys array"; else yell "ERROR:Encryption enabled but \"age\" not found. Exiting."; exit 1; fi