2012-01-22 19:46:35 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
NAME=systemd
|
|
|
|
UPSTREAM=git://anongit.freedesktop.org/systemd/systemd
|
|
|
|
REFDIR="$HOME/git/systemd" # for faster cloning, if available
|
|
|
|
|
|
|
|
|
|
|
|
[ -n "$1" ] && HEAD="$1" || HEAD="HEAD"
|
|
|
|
|
|
|
|
WORKDIR="$(mktemp -d --tmpdir "$NAME.XXXXXXXXXX")"
|
|
|
|
trap 'rm -rf $WORKDIR' exit
|
|
|
|
|
|
|
|
[ -d "$REFDIR" ] && REFERENCE="--reference $REFDIR"
|
|
|
|
git clone $REFERENCE "$UPSTREAM" "$WORKDIR"
|
|
|
|
|
|
|
|
pushd "$WORKDIR" > /dev/null
|
2012-02-10 08:34:36 +00:00
|
|
|
git branch to-archive $HEAD
|
|
|
|
read COMMIT_SHORTID COMMIT_TITLE <<EOGIT
|
|
|
|
$(git log to-archive^..to-archive --pretty='format:%h %s')
|
2012-01-22 19:46:35 +00:00
|
|
|
EOGIT
|
|
|
|
popd > /dev/null
|
|
|
|
|
|
|
|
echo "Making git snapshot using commit: $COMMIT_SHORTID $COMMIT_TITLE"
|
|
|
|
|
|
|
|
DIRNAME="$NAME-git$COMMIT_SHORTID"
|
2012-02-10 08:34:36 +00:00
|
|
|
git archive --remote="$WORKDIR" --format=tar --prefix="$DIRNAME/" to-archive | xz -9 > "$DIRNAME.tar.xz"
|
2012-01-22 19:46:35 +00:00
|
|
|
|
|
|
|
echo "Written $DIRNAME.tar.xz"
|