]> git.sur5r.net Git - bacula/bacula/blob - bacula/release/makerescuerel
Tweak release scripts
[bacula/bacula] / bacula / release / makerescuerel
1 #!/bin/sh
2 #
3 #
4 # This script is used to make a Bacula rescue release
5 #   rescue
6 # It writes in the current directory, so we recommend that you
7 #  do not run it in the Bacula source or Git directory, but
8 #  in a special release directory.
9 #
10 # Commit all changes, export the release, make a release tar.
11 #
12 cwd=`pwd`
13 reltype=release
14 tagbase=Release-
15 base_pkg=bacula-rescue
16 base_dir=rescue
17 branch=$2
18
19 if [ $# != 2 ] ; then
20   echo "Need $0 <rescue-source-directory> <branch>"
21   echo "e.g. $0 rescue-source master"
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 cd $base_dir
30 if [ $?  -ne 0 ]; then
31    echo "Directory: $1 does not exist"
32    exit 1
33 fi
34
35 ver=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' version.h`
36 src=`pwd` 
37 git checkout ${branch}
38 if [ $? -ne 0 ]; then
39    echo "Checkout of branch ${branch} in ${src} failed."
40    exit 1
41 fi
42 git pull origin ${branch}
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
50 git tag -d ${fulltag}
51 echo "Creating new tag -- $fulltag"
52 git tag $fulltag
53 if [ $? != 0 ] ; then
54   echo " "
55   echo "Non-zero return status from Git"
56   echo " "
57   exit 1
58 fi
59 echo "Create Tag $fulltag done"
60 cd ${cwd}
61 rm -rf $base_pkg-$ver $base_pkg-$ver.tar.gz $base_pkg-$ver.tar.gz.sig
62 rm -rf $fulltag
63 cd ${src}
64 git archive --format=tar --prefix=$base_pkg-$ver/ $fulltag | gzip >${cwd}/$base_pkg-$ver.tar.gz
65 if [ $? != 0 ] ; then
66   echo " "
67   echo "Non-zero return status from Git"
68   echo " "
69   exit 1
70 fi
71 echo "Exported release into ${cwd}/$base_pkg-$ver.tar.gz"
72 git checkout master
73 cd ${cwd}
74 ./sign $base_pkg-$ver.tar.gz
75 ls -l $base_pkg-$ver.tar.*
76
77 if [ a$push != ano ]; then
78    cd ${src}
79    git push origin $branch
80    git push origin tag $fulltag
81 fi