purple: update status type list
[siplcs.git] / git-snapshot.sh
blob3c5d222fc69de9ecf51be438c347051af5a5c4d5
1 #!/bin/sh
3 # Take a snapshot of the current pidgin-sipe git HEAD from the mob branch.
5 # You can specify the path to a local repository to speed up the cloning
6 # process. The output will be a bzip2 compressed tarball whose name includes
7 # the current date and the abbreviated commit object name of HEAD.
9 # Adapted from several examples found on the Internet.
11 # Configuration
12 PROJECT=pidgin-sipe
13 REPOSITORY="git+ssh://mob@repo.or.cz/srv/git/siplcs.git"
14 BRANCH=mob
16 # Create clone
17 set -e
18 TODAY=$(date +%Y%m%d)
19 CLONEDIR=${PROJECT}-${TODAY}
20 echo "Clone directory '$CLONEDIR'."
21 REFERENCE=${1:+--reference $1}
22 if [ -n "$1" ]; then
23 echo "Using local repository under '$1'."
25 if [ -n "$2" ]; then
26 REPOSITORY=$2
28 echo "Cloning from repository URL '$REPOSITORY'."
29 rm -rf $CLONEDIR
30 git clone -n $REFERENCE $REPOSITORY $CLONEDIR
31 cd $CLONEDIR
32 git checkout -q -b $CLONEDIR origin/$BRANCH
34 # Create archive
35 COMMIT=$(git log -n 1 --abbrev-commit --pretty=oneline | cut -d' ' -f1| sed -e 's/\.//g')
36 PREFIX=${PROJECT}-${TODAY}git${COMMIT}
37 ARCHIVE=${PREFIX}.tar.bz2
38 echo "Creating archive '$ARCHIVE'..."
39 git archive --format=tar --prefix=$PREFIX/ HEAD | bzip2 >../${PREFIX}.tar.bz2
41 # Cleanup
42 echo "Cleanup..."
43 cd ..
44 rm -rf $CLONEDIR
45 echo "DONE."