build-utils/dist.sh: reproducible builds (fixes shellcheck issues, adds usage) (#1983)

This commit is contained in:
Daniel Hahler 2017-08-31 21:20:08 +02:00 committed by GitHub
parent 8923df4a5f
commit cc2d4e9189
1 changed files with 24 additions and 12 deletions

View File

@ -4,20 +4,32 @@
set -e set -e
VERSION=$1 if [ -z "$1" ]; then
SVERSION=`echo $1 | sed 's/^v//'` echo "Usage: $0 <GIT_TAG>"
git archive --prefix=dist/awesome-$SVERSION/ $VERSION | tar -xf - exit 64
fi
GIT_TAG="$1"
SVERSION=$(echo "$GIT_TAG" | sed 's/^v//')
date=$(git log -1 --format=%cI "$GIT_TAG")
git archive --prefix "dist/awesome-$SVERSION/" "$GIT_TAG" | tar -xf -
cd dist cd dist
echo -n $VERSION > awesome-$SVERSION/.version_stamp version_stamp="awesome-$SVERSION/.version_stamp"
tar cjf awesome-$SVERSION.tar.bz2 awesome-$SVERSION printf '%s' "$GIT_TAG" > "$version_stamp"
tar cJf awesome-$SVERSION.tar.xz awesome-$SVERSION touch --date="$date" "$version_stamp" "awesome-$SVERSION"
gpg --armor --detach-sign awesome-$SVERSION.tar.bz2
gpg --armor --detach-sign awesome-$SVERSION.tar.xz tar cf "awesome-$SVERSION.tar" "awesome-$SVERSION"
bzip2 -c "awesome-$SVERSION.tar" > "awesome-$SVERSION.tar.bz2"
xz -c "awesome-$SVERSION.tar" > "awesome-$SVERSION.tar.xz"
rm "awesome-$SVERSION.tar"
gpg --armor --detach-sign "awesome-$SVERSION.tar.bz2"
gpg --armor --detach-sign "awesome-$SVERSION.tar.xz"
echo "Created the following files in dist/:" echo "Created the following files in dist/:"
echo "awesome-$SVERSION.tar.bz2" ls -l "awesome-$SVERSION.tar.bz2" "awesome-$SVERSION.tar.xz" \
echo "awesome-$SVERSION.tar.xz" "awesome-$SVERSION.tar.bz2.asc" "awesome-$SVERSION.tar.xz.asc"
echo "awesome-$SVERSION.tar.bz2.asc"
echo "awesome-$SVERSION.tar.xz.asc"
# vim: filetype=sh:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 # vim: filetype=sh:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80