]> git.sur5r.net Git - bacula/bacula/blob - bacula/release/makerescuerel
Backport from Bacula Enterprise
[bacula/bacula] / bacula / release / makerescuerel
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6 # This script is used to make a Bacula rescue release
7 #   rescue
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, export the release, make a release tar.
13 #
14 cwd=`pwd`
15 reltype=release
16 tagbase=Release-
17 base_pkg=bacula-rescue
18 base_dir=rescue
19 branch=$2
20
21 if [ $# != 2 ] ; then
22   echo "Need $0 <rescue-source-directory> <branch>"
23   echo "e.g. $0 rescue-source master"
24   exit 1
25 fi
26 cd $1
27 if [ $? -ne 0 ]; then
28    echo "Directory: $1 does not exist"
29    exit 1
30 fi
31 cd $base_dir
32 if [ $?  -ne 0 ]; then
33    echo "Directory: $1 does not exist"
34    exit 1
35 fi
36
37 src=`pwd` 
38 git checkout ${branch}
39 if [ $? -ne 0 ]; then
40    echo "Checkout of branch ${branch} in ${src} failed."
41    exit 1
42 fi
43 git pull origin ${branch}
44 ver=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' version.h`
45 fulltag=$tagbase$ver
46 echo " "
47 echo "Making $reltype for $base_pkg-$ver ..."
48 echo " "
49 echo "OK?  ctl-c to stop"
50 read a
51
52 git tag -d ${fulltag}
53 echo "Creating new tag -- $fulltag"
54 git tag $fulltag
55 if [ $? != 0 ] ; then
56   echo " "
57   echo "Non-zero return status from Git"
58   echo " "
59   exit 1
60 fi
61 echo "Create Tag $fulltag done"
62 cd ${cwd}
63 rm -rf $base_pkg-$ver $base_pkg-$ver.tar.gz $base_pkg-$ver.tar.gz.sig
64 rm -rf $fulltag
65 cd ${src}
66 git archive --format=tar --prefix=$base_pkg-$ver/ $fulltag | gzip >${cwd}/$base_pkg-$ver.tar.gz
67 if [ $? != 0 ] ; then
68   echo " "
69   echo "Non-zero return status from Git"
70   echo " "
71   exit 1
72 fi
73 echo "Exported release into ${cwd}/$base_pkg-$ver.tar.gz"
74 git checkout master
75 cd ${cwd}
76 ./sign $base_pkg-$ver.tar.gz
77 ls -l $base_pkg-$ver.tar.*
78
79 if [ a$push != ano ]; then
80    cd ${src}
81    git push origin $branch
82    git push origin tag $fulltag
83 fi