| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# Copyright (C) 2000-2017 Kern Sibbald |
| 4 |
# License: BSD 2-Clause; see file LICENSE-FOSS |
| 5 |
# |
| 6 |
# This script is used to make a Bacula docs release |
| 7 |
# docs |
| 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 |
# source ./config |
| 15 |
. ./config |
| 16 |
|
| 17 |
tagbase=Release- |
| 18 |
base_dir=docs |
| 19 |
base_pkg=bacula-$base_dir |
| 20 |
remote=$3 |
| 21 |
branch=$4 |
| 22 |
ver=$5 |
| 23 |
fulltag=$tagbase$ver |
| 24 |
|
| 25 |
if [ $# != 5 ] ; then |
| 26 |
echo "Need $0 <bacula-source-directory> <docs-source-directory> <remote-name> <branch> <version>" |
| 27 |
echo "e.g. $0 bacula-source docs-source bee Branch-4.0 4.0.3" |
| 28 |
exit 1 |
| 29 |
fi |
| 30 |
cd $1 |
| 31 |
if [ $? -ne 0 ]; then |
| 32 |
echo "Directory: $1 does not exist" |
| 33 |
exit 1 |
| 34 |
fi |
| 35 |
cd bacula |
| 36 |
if [ $? -ne 0 ]; then |
| 37 |
echo "Directory: $1 does not exist" |
| 38 |
exit 1 |
| 39 |
fi |
| 40 |
bcurrent=`git branch | awk '/*/ { print $2 }'` |
| 41 |
git checkout ${branch} |
| 42 |
if [ $? -ne 0 ]; then |
| 43 |
echo "Checkout of branch ${branch} in $1/bacula failed." |
| 44 |
exit 1 |
| 45 |
fi |
| 46 |
git pull ${remote} ${branch} |
| 47 |
bsrc=`pwd` |
| 48 |
cd ${cwd} |
| 49 |
cd $2 |
| 50 |
if [ $? -ne 0 ]; then |
| 51 |
echo "Directory: $2 does not exist" |
| 52 |
exit 1 |
| 53 |
fi |
| 54 |
cd $base_dir |
| 55 |
if [ $? -ne 0 ]; then |
| 56 |
echo "Directory: $2 does not exist" |
| 57 |
exit 1 |
| 58 |
fi |
| 59 |
current=`git branch | awk '/*/ { print $2 }'` |
| 60 |
src=`pwd` |
| 61 |
git checkout ${branch} |
| 62 |
if [ $? -ne 0 ]; then |
| 63 |
echo "Checkout of branch ${branch} in ${src} failed." |
| 64 |
exit 1 |
| 65 |
fi |
| 66 |
git pull ${remote} ${branch} |
| 67 |
echo " " |
| 68 |
echo "Making $reltype for $base_pkg-$ver ..." |
| 69 |
echo " " |
| 70 |
#echo "OK? ctl-c to stop" |
| 71 |
#read a |
| 72 |
|
| 73 |
git tag -d ${fulltag} 2>/dev/null 1>/dev/null |
| 74 |
echo "Creating new tag -- $fulltag" |
| 75 |
git tag $fulltag |
| 76 |
if [ $? != 0 ] ; then |
| 77 |
echo " " |
| 78 |
echo "Non-zero return status from Git" |
| 79 |
echo " " |
| 80 |
exit 1 |
| 81 |
fi |
| 82 |
echo "Create Tag $fulltag done" |
| 83 |
cd ${cwd} |
| 84 |
rm -rf $base_pkg-$ver $base_pkg-$ver.tar.gz $base_pkg-$ver.tar.gz.sig |
| 85 |
rm -rf $fulltag |
| 86 |
cd ${src} |
| 87 |
git archive --format=tar --prefix=$base_pkg-$ver/ $fulltag | gzip >${cwd}/$base_pkg-$ver.tar.gz |
| 88 |
if [ $? != 0 ] ; then |
| 89 |
echo " " |
| 90 |
echo "Non-zero return status from Git" |
| 91 |
echo " " |
| 92 |
exit 1 |
| 93 |
fi |
| 94 |
echo "Exported release into ${cwd}/$base_pkg-$ver.tar.gz" |
| 95 |
cd ${cwd} |
| 96 |
tar xfz $base_pkg-$ver.tar.gz |
| 97 |
cd $base_pkg-$ver/ |
| 98 |
mv docs $base_pkg-$ver |
| 99 |
cd $base_pkg-$ver |
| 100 |
./update_version |
| 101 |
rm -rf home-page cvt.scr presentations send techlogs upload rss_web.php |
| 102 |
make |
| 103 |
make mini-clean |
| 104 |
cd ${cwd} |
| 105 |
echo "Tarring docs ..." |
| 106 |
tar cf $base_pkg-$ver.tar $base_pkg-$ver |
| 107 |
rm -rf $base_pkg-$ver $base_pkg-$ver.tar.* |
| 108 |
echo "bzip2 docs ..." |
| 109 |
bzip2 $base_pkg-$ver.tar |
| 110 |
./sign $base_pkg-$ver.tar.bz2 |
| 111 |
|
| 112 |
if [ a$push != ano ]; then |
| 113 |
cd ${src} |
| 114 |
git push ${remote} ${branch} |
| 115 |
git push ${remote} tag ${fulltag} |
| 116 |
echo "Pushed ${remote} and push tag ${fulltag}" |
| 117 |
fi |
| 118 |
|
| 119 |
cd ${src} |
| 120 |
git checkout ${current} |
| 121 |
|
| 122 |
cd ${bsrc} |
| 123 |
git checkout ${bcurrent} |