Skip to content

Instantly share code, notes, and snippets.

@adamsimp
Created June 23, 2016 13:25
Show Gist options
  • Save adamsimp/d9ec4f8090654436205df195f1b494d2 to your computer and use it in GitHub Desktop.
Save adamsimp/d9ec4f8090654436205df195f1b494d2 to your computer and use it in GitHub Desktop.
#! /bin/bash
for config in Flavors/*/config.json; do
URL=$(jq -r .CONFIG_URL "$config")
if [ "$URL" != "null" ] && [ -n "$URL" ]; then
echo $URL
diff=$( curl "$URL" -s | diff "$config" - )
if [ -n "$diff" ]; then
echo
printf "Diff of $URL and $config\n\n"
printf "${diff//%/%%}"
echo; echo
read -p "Do you want to upload this file?" -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
bucket_path=$(echo "$URL" | cut -c `echo https://s3.amazonaws.com/ | wc -c`-)
echo "Writing to s3://$bucket_path"
aws s3 cp "$config" s3://$bucket_path --acl public-read --profile $AWSPROFILE
fi
else
echo "No differences found between $URL and $config"
fi
else
echo "No URL found in $config, continuing"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment