Created
June 23, 2016 13:25
-
-
Save adamsimp/d9ec4f8090654436205df195f1b494d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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