1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
#!/bin/sh
if [ ! -f mk/version.mk ]
then
echo >&2 "error: make release should be run from the top directory"
exit 1
fi
if [ -z "$VERSION" ]
then
VERSION=`git describe --tags --dirty | tail -1| sed -e "s/v//"`
fi
if [ -z "$FORCE" ]
then
if [ -n "`git diff | head -10`" ]
then
echo >&2 "error: tree is not clean - changes would be lost. aborted"
exit 1
fi
# will become branch 'release' instead of master
TOPUSH=`git log master ^origin/master`
if [ -n "$TOPUSH" ]
then
echo >&2 "ERROR: unpushed changes - git push first"
git log master ^origin/master
exit 1
fi
fi
if [ -f release/libreswan-$VERSION.tar.gz ]
then
echo >&2 "ERROR: release already exists. Aborted"
exit 1
else
mkdir -p release
fi
git archive --format=tar --prefix=libreswan-$VERSION/ HEAD | gzip > release/libreswan-$VERSION.tar.gz
# subshell for easier path
(
cd release
tar zxf libreswan-$VERSION.tar.gz
cd libreswan-$VERSION
echo "IPSECBASEVERSION?=$VERSION" > mk/version.mk
sed -i "s/(unreleased)/(`C= LOCALE= LANG= date +"%B %d, %Y"`)/" CHANGES
for file in `find packaging -type f | xargs grep IPSECBASEVERSION |sed "s/:.*$//"`
do
sed -i "s/@IPSECBASEVERSION@/$VERSION/" $file
done
cd ..
tar zcf libreswan-$VERSION.tar.gz libreswan-$VERSION
)
ls -l release/libreswan-$VERSION.tar.gz
echo please sign the release now with GPG and upload it
|