Last active
November 5, 2015 09:02
-
-
Save abyssluke/a8b26c671055f6aae611 to your computer and use it in GitHub Desktop.
rita.xyz update script
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 | |
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