ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
Michal Schmidt 591106
#!/bin/bash
Michal Schmidt 591106
set -e
Michal Schmidt 591106
Michal Schmidt 591106
NAME=systemd
Michal Schmidt 591106
UPSTREAM=git://anongit.freedesktop.org/systemd/systemd
Michal Schmidt 591106
REFDIR="$HOME/git/systemd"  # for faster cloning, if available
Michal Schmidt 591106
Michal Schmidt 591106
Michal Schmidt 591106
[ -n "$1" ] && HEAD="$1" || HEAD="HEAD"
Michal Schmidt 591106
Michal Schmidt 591106
WORKDIR="$(mktemp -d --tmpdir "$NAME.XXXXXXXXXX")"
Michal Schmidt 591106
trap 'rm -rf $WORKDIR' exit
Michal Schmidt 591106
Michal Schmidt 591106
[ -d "$REFDIR" ] && REFERENCE="--reference $REFDIR"
Michal Schmidt 591106
git clone $REFERENCE "$UPSTREAM" "$WORKDIR"
Michal Schmidt 591106
Michal Schmidt 591106
pushd "$WORKDIR" > /dev/null
Michal Schmidt da70c2
git branch to-archive $HEAD
Michal Schmidt da70c2
read COMMIT_SHORTID COMMIT_TITLE <
Michal Schmidt da70c2
$(git log to-archive^..to-archive --pretty='format:%h %s')
Michal Schmidt 591106
EOGIT
Michal Schmidt 591106
popd > /dev/null
Michal Schmidt 591106
Michal Schmidt 591106
echo "Making git snapshot using commit: $COMMIT_SHORTID $COMMIT_TITLE"
Michal Schmidt 591106
Michal Schmidt 591106
DIRNAME="$NAME-git$COMMIT_SHORTID"
Michal Schmidt da70c2
git archive --remote="$WORKDIR" --format=tar --prefix="$DIRNAME/" to-archive | xz -9 > "$DIRNAME.tar.xz"
Michal Schmidt 591106
Michal Schmidt 591106
echo "Written $DIRNAME.tar.xz"