tzwrapper.cc: fixed use of iterator after erase
[barry.git] / maintainer / release-bm.sh
blob9cacbf2aba9f1083818dd7b39bf574b44ea29f20
1 #!/bin/bash
3 if [ -z "$1" -o -z "$2" -o -z "$3" ] ; then
4 echo
5 echo "Usage: ./release-bm.sh builddir binary-meta-tarball target1 [target2...]"
6 echo
7 echo "Uses the given binary-meta tarball, and builds it on the"
8 echo "the target systems using the [target] script."
9 echo
10 echo "target is an optional filename containing binary package"
11 echo "build instructions. See bmchroots, bmlocal, and"
12 echo "bmremote for more information. The filename must have"
13 echo "the word 'root' in it if you wish it to run as root."
14 echo
15 echo "You can run this multiple times at the same time, for example"
16 echo "to build both remote and chroot scripts at once."
17 echo
18 echo "Note: You may wish to direct the output to a file, for"
19 echo " later examination."
20 echo
21 echo "Example: ./release-bm.sh bmbuild binary-meta.tar.bz2 bmlocal"
22 echo
23 exit 1
26 set -e
28 BUILDDIR="$1"
29 shift
31 TARBALL="$1"
32 TARBASE="$(basename "$1")"
33 shift
35 TARGETFILE="$1"
36 while shift ; do
37 if echo "$TARGETFILE" | grep root > /dev/null ; then
38 # needs root
39 su - -c "export BMTARBALL=$TARBALL && \
40 export BMTARBASE=$TARBASE && \
41 export BMBUILDDIR=$BUILDDIR && \
42 export THEMODE=release && \
43 export CHOWNUSER=$(whoami) && \
44 cd $(pwd) && \
45 source $TARGETFILE"
46 else
47 export BMTARBALL=$TARBALL
48 export BMTARBASE=$TARBASE
49 export BMBUILDDIR=$BUILDDIR
50 export THEMODE=release
51 export CHOWNUSER="$(whoami)"
53 source $TARGETFILE
56 # next!
57 TARGETFILE="$1"
58 done
60 echo
61 echo "Current build directory:"
62 ls "$BUILDDIR"
63 echo
64 echo "release-bm.sh done"