tzwrapper.cc: fixed use of iterator after erase
[barry.git] / maintainer / release.sh
blob14e8adeef03b0f1ef74c6d787b683b785e3afb61
1 #!/bin/bash
3 if [ -z "$1" -o -z "$2" ] ; then
4 echo
5 echo "Usage: ./release.sh builddir target1 [target2...]"
6 echo
7 echo "Builds release binaries using the tar release in builddir."
8 echo
9 echo "target is a filename containing binary package"
10 echo "build instructions. See barrychroots, barrylocal, and"
11 echo "barryremote for more information. The filename must have"
12 echo "the word 'root' in it if you wish it to run as root."
13 echo
14 echo "You can run this multiple times at the same time, for example"
15 echo "to build both remote and chroot scripts at once."
16 echo
17 echo "Note: You may wish to direct the output to a file, for"
18 echo " later examination."
19 echo
20 echo "Example: ./release.sh barrybuild barrychroots"
21 echo
22 exit 1
25 set -e
27 BUILDDIR="$1"
28 shift
30 TARBALL=$(echo $BUILDDIR/barry-*.*.*.tar.bz2)
31 BASENAME=$(basename $TARBALL)
33 # Make sure tarball exists
34 if [ -f $TARBALL ] ; then
35 echo "Tarball already exists... continuing..."
36 sleep 2s
37 else
38 echo "Tarball does not exist, run release-tar.sh first."
39 exit 1
42 TARGETFILE="$1"
43 while shift ; do
44 # Build the binary packages by running the target script
45 if echo "$TARGETFILE" | grep root > /dev/null ; then
46 # needs root
47 su - -c "export BARRYTARBALL=$TARBALL && \
48 export BARRYTARBASE=$BASENAME && \
49 export BARRYBUILDDIR=$BUILDDIR && \
50 export THEMODE=release && \
51 export CHOWNUSER=$(whoami) && \
52 cd $(pwd) && \
53 source $TARGETFILE"
54 else
55 export BARRYTARBALL=$TARBALL
56 export BARRYTARBASE=$BASENAME
57 export BARRYBUILDDIR=$BUILDDIR
58 export THEMODE=release
59 export CHOWNUSER="$(whoami)"
61 source $TARGETFILE
64 # next!
65 TARGETFILE="$1"
66 done
68 echo
69 echo "Current build directory:"
70 ls "$BUILDDIR"
71 echo
72 echo "release.sh done"