Skip to content

Instantly share code, notes, and snippets.

@abyssluke
Last active November 5, 2015 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abyssluke/a8b26c671055f6aae611 to your computer and use it in GitHub Desktop.
Save abyssluke/a8b26c671055f6aae611 to your computer and use it in GitHub Desktop.
rita.xyz update script
#!/bin/bash
SYNCPATH=/path/to/rita.xyz
S3BUCKET=rita.xyz
if [ ! -z $1 ]; then
if [ $1 != "--force" ]; then
echo "${0##*/} : Invalid options"
echo "${0##*/} : To force update, please use --force option."
exit 1
fi
fi
git --work-tree=${SYNCPATH} --git-dir=${SYNCPATH}/.git add --all
git --work-tree=${SYNCPATH} --git-dir=${SYNCPATH}/.git commit -a
COMMITRET=$?
if [ -z $1 ]; then
if [ ${COMMITRET} -eq 1 ]; then
echo "${0##*/} : No change or commit cancelled."
exit 1
fi
elif [ $1 = "--force" ]; then
echo "${0##*/} : Force updating..."
fi
/path/to/s3cmd --exclude="${SYNCPATH}/.git/" --no-mime-magic --delete-removed sync ${SYNCPATH}/ s3://${S3BUCKET}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment