Rev 1178 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1177 | dev | 1 | #!/bin/sh |
2 | |||
3 | # |
||
4 | # make a release (source code tar) of the project |
||
5 | # needs two params: major and minor version of the release |
||
6 | # |
||
7 | |||
8 | PROJ=rebootd |
||
9 | OUTDIR=output |
||
10 | PROG=${OUTDIR}/${PROJ} |
||
11 | SRCDIR=src |
||
12 | SRCS=${SRCDIR}/rebootd.c |
||
13 | |||
14 | VER_MAJOR=$1 |
||
15 | VER_MINOR=$2 |
||
16 | VER_REVISION=`svnversion .` |
||
17 | RELEASE_NAME=${PROJ}-${VER_MAJOR}.${VER_MINOR}.${VER_REVISION} |
||
18 | |||
19 | SAMPLES=${SRCDIR}/rebootd.conf |
||
20 | RELDIR=${OUTDIR}/release |
||
21 | COMMITDIR=releases |
||
22 | WEBDIR=26th.net:www/26th.net/html/public/projects/rebootd/bin # scp format |
||
23 | |||
24 | # check params |
||
25 | [ -n "${VER_MINOR}" ] || { echo "Version not specified" >> /dev/stderr; exit 1; } |
||
26 | |||
27 | # only commited revisions are allowed for release |
||
28 | if ( ! echo $VER_REVISION | grep -E '^[0-9]+$' > /dev/null ) ; then |
||
29 | echo "Cannot make release - current revision $VER_REVISION not commited" >> /dev/stderr |
||
30 | exit 1; |
||
31 | fi |
||
32 | |||
33 | # create the tar |
||
34 | rm -rf ${RELDIR} \ |
||
35 | || { echo "Cannot delete ${RELDIR} dir" >> /dev/stderr; exit 2; } |
||
36 | mkdir ${RELDIR} \ |
||
37 | || { echo "Cannot create ${RELDIR} dir" >> /dev/stderr; exit 2; } |
||
38 | cp -r ${SRCDIR} ${RELDIR}/${RELEASE_NAME} \ |
||
39 | || { echo "Cannot copy ${SRCDIR} to ${RELDIR}/${RELEASE_NAME}" >> /dev/stderr; exit 2; } |
||
40 | sed -e 's/%VER_MAJOR%/${VER_MAJOR}/' -e 's/%VER_MINOR%/${VER_MINOR}/' \ |
||
41 | -e 's/%VER_REVISION%/${VER_REVISION}/' ${SRCDIR}/Makefile \ |
||
42 | > ${RELDIR}/${RELEASE_NAME}/Makefile \ |
||
43 | || { echo "Cannot generate ${RELDIR}/${RELEASE_NAME}/Makefile" >> /dev/stderr; exit 2; } |
||
44 | tar cf - --exclude '*/.svn' -C ${RELDIR} ${RELEASE_NAME} | gzip > ${OUTDIR}/${RELEASE_NAME}.tar.gz \ |
||
45 | || { echo "Cannot create ${OUTDIR}/${RELEASE_NAME}.tar.gz" >> /dev/stderr; exit 2; } |
||
46 | rm -rf ${RELDIR} \ |
||
47 | || { echo "Cannot clear ${RELDIR} dir" >> /dev/stderr; exit 2; } |
||
48 | |||
49 | # commit the release |
||
50 | echo "Relase made successfully. Enter YES to commit it." |
||
51 | read confirm |
||
52 | if [ "$confirm" != "YES" ] ; then |
||
53 | echo "you have to answer 'YES' to continue" |
||
54 | exit 1 |
||
55 | fi |
||
56 | |||
57 | cp ${OUTDIR}/${RELEASE_NAME}.tar.gz ${COMMITDIR} \ |
||
58 | || { echo "Cannot copy ${OUTDIR}/${RELEASE_NAME}.tar.gz to releases" >> /dev/stderr; exit 2; } |
||
59 | svn add ${COMMITDIR}/${RELEASE_NAME}.tar.gz \ |
||
60 | || { echo "Cannot add ${COMMITDIR}/${RELEASE_NAME}.tar.gz to repository" >> /dev/stderr; exit 2; } |
||
61 | svn commit ${COMMITDIR}/${RELEASE_NAME}.tar.gz \ |
||
62 | -m "${PROJ}: auto commit of new release ${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}" \ |
||
63 | || { echo "Cannot commit ${COMMITDIR}/${RELEASE_NAME}.tar.gz" >> /dev/stderr; exit 2; } |
||
64 | |||
65 | # publish web |
||
66 | scp ${COMMITDIR}/${RELEASE_NAME}.tar.gz ${WEBDIR} \ |
||
67 | || { echo "Cannot publish ${COMMITDIR}/${RELEASE_NAME}.tar.gz to ${WEBDIR}" >> /dev/stderr; exit 2; } |
||
68 | |||
69 | echo "Release ${RELEASE_NAME} is commited and published" |
||
70 |