From 34446c246219980918d038725f7ceecefacb6bb7 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Wed, 8 Jun 2022 21:30:56 +0300 Subject: lrpb: fix config validation --- lrpb | 11 +++++++++-- 1 file 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 ;; -- cgit v1.2.3