Skip to content

Instantly share code, notes, and snippets.

@keithchambers
Last active August 29, 2015 14:06
Show Gist options
  • Save keithchambers/dde686fce70b426b8670 to your computer and use it in GitHub Desktop.
Save keithchambers/dde686fce70b426b8670 to your computer and use it in GitHub Desktop.
Sync s3 backed yum repo
#/bin/bash -e
readonly REPO_DIR="$1"
readonly S3_BUCKET="$2"
if [[ -z "$2" ]] ; then
echo "Usage: "$0" <repo-dir> <s3-bucket>"
exit 1
fi
mkdir -p "$REPO_DIR"
s3cmd get --recursive --skip-existing s3://"$S3_BUCKET"/ "$REPO_DIR"/
createrepo "$REPO_DIR"/
s3cmd sync --delete-removed "$REPO_DIR"/ s3://"$S3_BUCKET"/
# EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment