3 if [ -z "$1" -o -z "$2" -o -z "$3" -o -z "$CHROOTUSER" -o -z "$CHOWNUSER" ] ; then
5 echo "Usage: ./make-rpm.sh tarball chroot_target short_form [deb_targets]"
7 echo "Copies the tarball to the chroot target's /home/$CHROOTUSER/binarybuild dir,"
8 echo "then enters the chroot system and runs the build."
10 echo "short_form is the tag to rename the resulting DEB's with,"
11 echo "such as ubuntu710, etc."
13 echo "deb_targets is a set of additional debian/rules makefile targets"
14 echo "that you wish to build on this round, such as os22-binary or"
17 echo "Expects CHROOTUSER to be set appropriately in the environment."
23 TARNAME
=`basename "$TARPATH"`
31 cp "$TARPATH" "$TARGET/home/$CHROOTUSER"
33 chroot
"$TARGET" su
- "$CHROOTUSER" -c /bin
/sh
-lc "rm -rf binarybuild && mkdir binarybuild && cd binarybuild && tar xjvf ../$TARNAME && cd * && fakeroot -- debian/rules binary $DEBTARGETS"
36 cp "$TARGET/home/$CHROOTUSER/binarybuild/"*.deb
"build/$TAG"
37 # this may fail, if no sub debtargets are set, so avoid set -e issues
38 if cp "$TARGET/home/$CHROOTUSER/binarybuild/"barry
*/*.deb
"build/$TAG" ; then
39 echo "make-deb.sh: Copied subtarget packages"
41 echo "make-deb.sh: No subtarget packages available"
43 rm "$TARGET/home/$CHROOTUSER/$TARNAME"
45 # We do this manually in a for loop, since the rename command is
46 # not the same across various linux distros...
49 for f
in *_i386.deb
; do
50 mv "$f" "$(echo $f | sed "s
/_i386.deb$
/_
${TAG}_i386.deb
/")"
54 chown
-R "$CHOWNUSER" "build/$TAG"