diff --git a/assets/common.sh b/assets/common.sh index 9d48e06..8e385b4 100644 --- a/assets/common.sh +++ b/assets/common.sh @@ -11,9 +11,6 @@ load_config() { if [ -s "$config_path" ]; then mkdir -p $rclone_config_path mv "$config_path" $rclone_config_file - # TODO: Remove Me - DEBUGGING - echo "Config file:" - cat $rclone_config_file chmod 500 $rclone_config_file else echo "No config provided" @@ -31,14 +28,13 @@ load_files() { # TODO: Remove Me - DEBUGGING echo "Files:" echo "$files" - if [[ ! -z "${files}" ]]; then + if [[ -n "${files}" ]]; then for fileName in $files; do - local jq_path=".source.files.${fileName}" - local content=$(jq -r "${jq_path}" < "$1") + local jq_path + local content + jq_path=".source.files.${fileName}" + content=$(jq -r "${jq_path}" < "$1") echo "$content" > "/tmp/${fileName}" - # TODO: Remove Me - DEBUGGING - echo "File /tmp/${fileName}" - cat "/tmp/${fileName}" done fi } \ No newline at end of file diff --git a/assets/out b/assets/out index 77ab6c9..5f757ed 100644 --- a/assets/out +++ b/assets/out @@ -15,7 +15,7 @@ source "$(dirname $0)/common.sh" source=$1 -if [ -z "$source" ]; then +if [[ -z "$source" ]]; then echo "usage: $0 " exit 1 fi @@ -26,22 +26,18 @@ PATH=/usr/local/bin:$PATH payload=$(mktemp "$TMPDIR/rclone-resource-request.XXXXXX") cat > "$payload" <&0 -# TODO: Remove Me - DEBUGGING -echo "Payload:" -cat "$payload" - load_config "$payload" load_files "$payload" rclone_source_directory=$(jq -r '.params.source // ""' < "$payload") rclone_destinations=$(jq -r '.params.destination[]? | .dir // ""' < "$payload") -if [ -z "$rclone_source_directory" ]; then +if [[ -z "$rclone_source_directory" ]]; then echo "invalid source directory (missing source)" exit 1 fi -if [ -z "$rclone_destinations" ]; then +if [[ -z "$rclone_destinations" ]]; then echo "invalid destination (missing destination)" exit 1 fi