s3-resource-simple/assets/out

32 lines
708 B
Text
Raw Normal View History

2016-03-10 08:16:03 +01:00
#!/bin/sh
2016-03-10 07:32:05 +01:00
set -e
exec 3>&1 # make stdout available as fd 3 for the result
exec 1>&2 # redirect all output to stderr for logging
source=$1
if [ -z "$source" ]; then
echo "usage: $0 </full/path/to/dir>"
exit 1
fi
source "$(dirname $0)/common.sh"
2016-03-10 09:57:41 +01:00
payload=`cat`
bucket=$(get_bucket)
2018-10-30 01:56:37 +01:00
prefix=$(get_prefix)
options=$(echo "$payload" | jq -r '.params.options // [] | join(" ")')
source_dir=$(echo "$payload" | jq -r '.params.source_dir // "."')
test -z "$source_dir" && { echo "Must supply params.source_dir" >&2; exit 1; }
export_aws_vars
cd $source/$source_dir
echo "Uploading to S3 from '$source_dir'..."
eval aws s3 sync $source/$source_dir "s3://$bucket/$prefix" $options
echo "Done."
emit_version