Browse Source

Removed debugging and cleaned up script

expose_links
Drew Short 5 years ago
parent
commit
ae882d74db
  1. 14
      assets/common.sh
  2. 10
      assets/out

14
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
}

10
assets/out

@ -15,7 +15,7 @@ source "$(dirname $0)/common.sh"
source=$1
if [ -z "$source" ]; then
if [[ -z "$source" ]]; then
echo "usage: $0 <path/to/source>"
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

Loading…
Cancel
Save