]> git.sur5r.net Git - bacula/bacula/blob - bacula/release/makedocsrel
38b9dd613f302ebc358ce152d8672485a1cbd94f
[bacula/bacula] / bacula / release / makedocsrel
1 #!/bin/sh
2 #
3 #
4 # This script is used to make a Bacula docs release
5 #   docs
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_dir=docs
16 base_pkg=bacula-$base_dir
17 remote=$3
18 branch=$4
19 if [ $# != 4 ] ; then
20   echo "Need $0 <bacula-source-directory> <docs-source-directory> <remote-name> <branch>"
21   echo "e.g. $0 bacula-source docs-source bee 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 bacula
30 if [ $?  -ne 0 ]; then
31    echo "Directory: $1 does not exist"
32    exit 1
33 fi
34 bcurrent=`git branch | awk '/*/ { print $2 }'`
35 git checkout ${branch}
36 if [ $? -ne 0 ]; then
37    echo "Checkout of branch ${branch} in $1/bacula failed."
38    exit 1
39 fi
40 git pull ${remote} ${branch}
41 bsrc=`pwd` 
42 cd ${cwd}
43 cd $2
44 if [ $? -ne 0 ]; then
45    echo "Directory: $2 does not exist"
46    exit 1
47 fi
48 cd $base_dir
49 if [ $?  -ne 0 ]; then
50    echo "Directory: $2 does not exist"
51    exit 1
52 fi
53 current=`git branch | awk '/*/ { print $2 }'`
54 src=`pwd` 
55 git checkout ${branch}
56 if [ $? -ne 0 ]; then
57    echo "Checkout of branch ${branch} in ${src} failed."
58    exit 1
59 fi
60 git pull ${remote} ${branch}
61 ver=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' ${bsrc}/src/version.h`
62 fulltag=$tagbase$ver
63 echo " "
64 echo "Making $reltype for $base_pkg-$ver ..."
65 echo " "
66 echo "OK?  ctl-c to stop"
67 read a
68
69 git tag -d ${fulltag}
70 echo "Creating new tag -- $fulltag"
71 git tag $fulltag
72 if [ $? != 0 ] ; then
73   echo " "
74   echo "Non-zero return status from Git"
75   echo " "
76   exit 1
77 fi
78 echo "Create Tag $fulltag done"
79 cd ${cwd}
80 rm -rf $base_pkg-$ver $base_pkg-$ver.tar.gz $base_pkg-$ver.tar.gz.sig
81 rm -rf $fulltag
82 cd ${src}
83 git archive --format=tar --prefix=$base_pkg-$ver/ $fulltag | gzip >${cwd}/$base_pkg-$ver.tar.gz
84 if [ $? != 0 ] ; then
85   echo " "
86   echo "Non-zero return status from Git"
87   echo " "
88   exit 1
89 fi
90 echo "Exported release into ${cwd}/$base_pkg-$ver.tar.gz"
91 cd ${cwd}
92 tar xfz $base_pkg-$ver.tar.gz 
93 cd $base_pkg-$ver/
94 mv docs $base_pkg-$ver
95 cd $base_pkg-$ver
96 ./configure --with-bacula=$bsrc
97 make en
98 cd ${cwd}
99 echo "Tarring docs ..."
100 tar cf $base_pkg-$ver.tar $base_pkg-$ver
101 rm -rf $base_pkg-$ver $base_pkg-$ver.tar.*
102 echo "bzip2 docs ..."
103 bzip2 $base_pkg-$ver.tar
104 ./sign $base_pkg-$ver.tar.bz2
105 ls -l $base_pkg-$ver.tar.*
106
107 if [ a$push != ano ]; then
108    cd ${src}
109    git push ${remote} ${branch}
110    git push ${remote} tag ${fulltag}
111    echo "Pushed ${remote} and push tag ${fulltag}"
112 fi
113
114 cd ${src}
115 git checkout ${current}
116
117 cd ${bsrc}
118 git checkout ${bcurrent}