Skip to content

Instantly share code, notes, and snippets.

@rjmackay
Created July 25, 2012 21:27
Show Gist options
  • Save rjmackay/3178808 to your computer and use it in GitHub Desktop.
Save rjmackay/3178808 to your computer and use it in GitHub Desktop.
Gen update with commandline params
#!/bin/bash
# To check tags, run this in the browser
# https://api.github.com/repos/ushahidi/Ushahidi_Web/tags
if [[ $# -lt 2 ]]
then
echo "Usage: gen_updates.sh [previous-tag] [current-tag]"
exit 1
fi
CURRENT_TAG=$2
PREVIOUS_TAG=$1
TMPDIR=`mktemp -d -t ushahidi-upgrade.XXXXXXXXXX`
git checkout $CURRENT_TAG
mkdir $TMPDIR/ushahidi/
# Copy updated files with rsync so we preserve directory structure
rsync -Rva $(git diff $PREVIOUS_TAG $CURRENT_TAG --name-only) $TMPDIR/ushahidi/
# Add list of deleted files
git diff $PREVIOUS_TAG $CURRENT_TAG --diff-filter=D > $TMPDIR/ushahidi/upgrader_removed_files.txt
# Zip everything up
rm -f ~/ushahidi_${PREVIOUS_TAG}_${CURRENT_TAG}.zip
pushd $TMPDIR
zip -r ~/ushahidi_${PREVIOUS_TAG}_${CURRENT_TAG}.zip ushahidi
# Back to where we were
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment