} # write buffer to disk
magicParseRecipientDir() {
# Desc: Updates recPubKeysValid with pubkeys in dir specified by '-R' option ("recipient directory")
- # Inputs: vars: OPTION_RECDIR, argRecDir,
- # arry: recPubKeysValid
- # Outputs: arry: recPubKeysValid (modified with pubkeys in argRecDir if pubkeys valid)
+ # Inputs: vars: OPTION_RECDIR, argRecDir, OPTION_ENCRYPTION
+ # arry: recPubKeysValid
+ # Outputs: arry: recPubKeysValid
# Depends: processArguments,
local recFileLine updateRecipients recipientDir
declare -a candRecPubKeysValid
-
- if [[ "$OPTION_RECDIR" = "true" ]]; then
+
+ # Check that '-e' and '-R' set
+ if [[ "$OPTION_ENCRYPTION" = "true" ]] && [[ "$OPTION_RECDIR" = "true" ]]; then
### Check that argRecDir is a directory.
if [[ -d "$argRecDir" ]]; then
recipientDir="$argRecDir";
yell "ERROR:$0:Recipient directory $argRecDir does not exist. Exiting."; exit 1;
fi;
fi;
+ # Handle case if '-e' set but '-R' not set
+ if [[ "$OPTION_ENCRYPTION" = "true" ]] && [[ ! "$OPTION_RECDIR" = "true" ]]; then
+ yell "ERROR: \'-e\' set but \'-R\' is not set."; fi;
+ # Handle case if '-R' set but '-e' not set
+ if [[ ! "$OPTION_ENCRYPTION" = "true" ]] && [[ "$OPTION_RECDIR" = "true" ]]; then
+ yell "ERROR: \'-R\' is set but \'-e\' is not set."; fi;
} # Update recPubKeysValid with argRecDir
magicParseRecipientArgs() {
# Desc: Parses recipient arguments specified by '-r' option
processArguments "$@";
## Act upon arguments
### Determine working directory
- magicInitWorkingDir;
+ magicInitWorkingDir; # Sets DIR_TMP
### Set output encryption and compression option strings
#### React to "-r" ("encryption recipients") option
- magicParseRecipientArgs;
+ magicParseRecipientArgs; # Updates recPubKeysValid, CMD_ENCRYPT[_SUFFIX]
#### React to "-c" ("compression") option
- magicParseCompressionArg;
+ magicParseCompressionArg; # Updates CMD_COMPRESS[_SUFFIX]
#### React to "-R" ("recipient directory") option
- magicParseRecipientDir;
+ magicParseRecipientDir; # Updates recPubKeysValid
# Check that critical apps and dirs are available, display missing ones.
if ! checkapp gpspipe tar && ! checkdir "$DIR_OUT" "DIR_TMP"; then