]> git.sur5r.net Git - bacula/bacula/blob - bacula/release/makebacularel
Tweak release scripts
[bacula/bacula] / bacula / release / makebacularel
1 #!/bin/sh
2 #
3 #
4 # This script is used to make a Bacula release
5 #   bacula
6 #   regress
7 #   gui
8 # It writes in the current directory, so we recommend that you
9 #  do not run it in the Bacula source or Git directory, but
10 #  in a special release directory.
11 #
12 # Commit all changes, update the language files, 
13 #    export the release, make a release tar.
14 #
15 cwd=`pwd`
16 reltype=release
17 tagbase=Release-
18 base_pkg=bacula
19 if [ $# != 2 ] ; then
20   echo "Need $0 <source-directory> <branch>"
21   echo "e.g. $0 release-source 3.0.3"
22   exit 1
23 fi
24 cd $1
25 if [ $? -ne 0 ]; then
26    echo "Directory: $1 does not exist"
27    exit 1
28 fi
29 src=`pwd` 
30 cd $base_pkg 
31 if [ $?  -ne 0 ]; then
32    echo "Directory: $1 does not exist"
33    exit 1
34 fi
35 branch=$2
36 git checkout ${branch}
37 git pull origin ${branch}
38 if [ $? -ne 0 ]; then
39    echo "Checkout of branch ${branch} failed."
40    exit 1
41 fi
42 ver=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' src/version.h`
43 fulltag=$tagbase$ver
44 echo " "
45 echo "Making $reltype for $base_pkg-$ver ..."
46 echo " "
47 echo "OK?  ctl-c to stop"
48 read a
49 rm -rf Release-$ver
50 if [ $reltype != "beta" ] ; then
51    cd src
52    cp -fp version.h 1
53    sed 's%^#define DEVELOPER 1%/* #define DEVELOPER 1 */%g' 1 >version.h
54    rm -f 1
55    cd ..
56 fi
57 if [ a$updatepo != ano ]; then
58    ./configure --enable-client-only
59    cd po
60    make update-po
61    cd ${src}   
62    git commit -am "Final po changes for ${fulltag}"
63 fi
64 git tag -d ${fulltag}
65 echo "Creating new tag -- $fulltag"
66 git tag $fulltag
67 if [ $? != 0 ] ; then
68   echo " "
69   echo "Non-zero return status from Git"
70   echo " "
71   exit 1
72 fi
73 echo "Create Tag $fulltag done"
74 cd ${cwd}
75 rm -rf $base_pkg-$ver $base_pkg-$ver.tar.gz $base_pkg-$ver.tar.gz.sig
76 rm -rf $fulltag
77 cd ${src}
78 git archive --format=tar --prefix=$base_pkg-$ver/ $fulltag | gzip >${cwd}/$base_pkg-$ver.tar.gz
79 if [ $? != 0 ] ; then
80   echo " "
81   echo "Non-zero return status from Git"
82   echo " "
83   exit 1
84 fi
85 echo "Exported release into ${cwd}/$base_pkg-$ver.tar.gz"
86 git checkout master
87 cd ${cwd}
88 tar xfz $base_pkg-$ver.tar.gz 
89 cd $base_pkg-$ver/
90 mv bacula $base_pkg-$ver
91 mv gui $base_pkg-gui-$ver
92 mv regress $base_pkg-regress-$ver
93 tar cvfz ../$base_pkg-$ver.tar.gz $base_pkg-$ver
94 tar cvfz ../$base_pkg-gui-$ver.tar.gz $base_pkg-gui-$ver
95 tar cvfz ../$base_pkg-regress-$ver.tar.gz $base_pkg-regress-$ver
96 cd ..
97 ./sign $base_pkg-$ver.tar.gz
98 ./sign $base_pkg-gui-$ver.tar.gz
99 ./sign $base_pkg-regress-$ver.tar.gz
100
101 if [ a$push != ano ]; then
102    cd ${src}
103    git push origin $branch
104    git push origin tag $fulltag
105 fi