-r | --recipient) OPTION_RECIPIENTS="true"; argRecPubKeys+=("$2"); vbm "STATUS:pubkey added:""$2"; shift;; # Add recipients
-c | --compress) OPTION_COMPRESS="true"; vbm "DEBUG:Compressed output mode enabled.";; # Enable compression
-z | --time-zone) try setTimeZoneEV "$2"; shift;; # Set timestamp timezone
- -t | --temp-dir) OPTION_TMPDIR="true" && argTmpDirPriority="$2"; shift;; # Set time zone
+ -t | --temp-dir) OPTION_TMPDIR="true" && argTempDirPriority="$2"; shift;; # Set time zone
-R | --recipient-dir) OPTION_RECIPIENTS="true"; OPTION_RECDIR="true" && argRecDir="$2"; shift;; # Add recipient watch dir
*) echoerr "ERROR: Unrecognized argument: $1"; echoerr "STATUS:All arguments:$*"; exit 1;; # Handle unrecognized options.
esac
} # 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
} # Form compression cmd string and filename suffix
magicInitWorkingDir() {
# Desc: Determine temporary working directory from defaults or user input
- # Input: vars: OPTION_TEMPDIR, argTmpDirPriority, DIR_TMP_DEFAULT
+ # Usage: magicInitWorkignDir
+ # Input: vars: OPTION_TEMPDIR, argTempDirPriority, DIR_TMP_DEFAULT
# Input: vars: SCRIPT_TIME_START
# Output: vars: DIR_TMP
# Depends: processArguments(), vbm(), yell()
if [[ -d "$argTempDirPriority" ]]; then
DIR_TMP_PARENT="$argTempDirPriority";
else
- yell "WARNING:Specified temporary working directory not valid:$OPTION_TMPDIR";
+ yell "WARNING:Specified temporary working directory not valid:$argTempDirPriority";
exit 1; # Exit since user requires a specific temp dir and it is not available.
fi;
else
processArguments "$@";
## Act upon arguments
### Determine working directory
- magicInitWorkingDir;
+ magicInitWorkingDir; # Sets DIR_TMP from argTempDirPriority
### 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