summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-06-08 21:30:56 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-06-08 21:30:56 +0300
commit34446c246219980918d038725f7ceecefacb6bb7 (patch)
tree1fbe1c616aa9b4a7f04905399c284b409fdf1b58
parent6cbe6e11ae592c36f2798317206236a2ddfc2f0e (diff)
lrpb: fix config validation
-rwxr-xr-xlrpb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lrpb b/lrpb
index 85d17e3..5515b5c 100755
--- a/lrpb
+++ b/lrpb
@@ -228,12 +228,19 @@ read_config
case "$command" in
upload)
[ -z "$file" ] && die "file is not specified"
- check_config "upload_host upload_port upload_user upload_path name signify_path seckey_path"
+
+ config_keys="upload_host upload_port upload_user upload_path signify_path seckey_path"
+ if [ -z "$name" ]; then config_keys="$config_keys name"; fi
+ check_config "$config_keys"
+
do_upload "$(realpath "$file")"
;;
exec)
- check_config "url name pubkey_path signify_path cwd cache_file"
+ config_keys="url pubkey_path signify_path cwd cache_file"
+ if [ -z "$name" ]; then config_keys="$config_keys name"; fi
+ check_config "$config_keys"
+
[ -d "${config[cwd]}" ] || die "invalid ${BOLD}cwd${RST}: no such directory"
do_exec
;;