1#! /bin/sh
2# $OpenLDAP$
3## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4##
5## Copyright 1998-2011 The OpenLDAP Foundation.
6## All rights reserved.
7##
8## Redistribution and use in source and binary forms, with or without
9## modification, are permitted only as authorized by the OpenLDAP
10## Public License.
11##
12## A copy of this license is available in the file LICENSE in the
13## top-level directory of the distribution or, alternatively, at
14## <http://www.OpenLDAP.org/license.html>.
15#
16# Make a release
17#
18
19#
20# This script MUST NOT add files to the export nor modify
21# any file in the export, exceptions:
22#	make guide.html
23#
24
25set -e 		# exit immediately if any errors occur
26
27if test $# != 3 ; then
28	echo 'usage: mkrelease REPO RELNAME TAG'
29	exit 1
30fi
31
32REPO=$1
33shift
34RELNAME=openldap-$1
35shift
36TAG=$1
37shift
38
39if test -e $RELNAME ; then
40	echo "error: $RELNAME exists"
41	exit 1
42fi
43
44echo Release: $RELNAME
45echo Tag: $TAG
46
47git archive --format=tar --prefix="${RELNAME}/" --remote="${REPO}" "$TAG" |  tar xvf -
48
49if test ! -d $RELNAME ; then
50	echo "error: $RELNAME doesn't exists"
51	exit 1
52fi
53
54if test -e $RELNAME/doc/guide/admin/guide.sdf ; then
55	echo "build guide..."
56	( cd $RELNAME/doc/guide/admin ; make guide.html )
57else
58	echo "No guide"
59fi
60
61if test -e $RELNAME/libraries/liblunicode/ucdata/uctable.h ; then
62	echo "touching uctable.h..."
63	touch $RELNAME/libraries/liblunicode/ucdata/uctable.h
64fi
65
66if test ! -e $RELNAME/build/version.sh ; then
67	echo "No build version"
68	OL_STRING="something"
69else
70	eval `$RELNAME/build/version.sh`
71fi
72
73echo "Rolling up $OL_STRING ..."
74
75
76tar cf $RELNAME.tar $RELNAME
77gzip -9 -c $RELNAME.tar > $RELNAME.tgz
78md5 $RELNAME.tgz > $RELNAME.md5
79sha1 $RELNAME.tgz > $RELNAME.sha1
80rm -f $RELNAME.tar
81
82ls -l $RELNAME.*
83
84echo "Made $OL_STRING as $RELNAME.tgz"
85