diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2022-06-08 21:30:56 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2022-06-08 21:30:56 +0300 |
commit | 34446c246219980918d038725f7ceecefacb6bb7 (patch) | |
tree | 1fbe1c616aa9b4a7f04905399c284b409fdf1b58 | |
parent | 6cbe6e11ae592c36f2798317206236a2ddfc2f0e (diff) |
lrpb: fix config validation
-rwxr-xr-x | lrpb | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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 ;; |