doc: updated Fedora's RPM git repo URL
[barry.git] / maintainer / make-deb.sh
blobd6aa52f2868bd57416169434035ba869a1d6413e
1 #!/bin/sh
3 if [ -z "$1" -o -z "$2" -o -z "$3" -o -z "$CHROOTUSER" -o -z "$CHOWNUSER" ] ; then
4 echo
5 echo "Usage: ./make-rpm.sh tarball chroot_target short_form [deb_targets]"
6 echo
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."
9 echo
10 echo "short_form is the tag to rename the resulting DEB's with,"
11 echo "such as ubuntu710, etc."
12 echo
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"
15 echo "os4x-binary."
16 echo
17 echo "Expects CHROOTUSER to be set appropriately in the environment."
18 echo
19 exit 1
22 TARPATH="$1"
23 TARNAME=`basename "$TARPATH"`
24 TARGET="$2"
25 TAG="$3"
26 # optional arg
27 DEBTARGETS="$4"
29 set -e
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"
35 mkdir -p "build/$TAG"
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"
40 else
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...
48 cd "build/$TAG"
49 for f in *_i386.deb ; do
50 mv "$f" "$(echo $f | sed "s/_i386.deb$/_${TAG}_i386.deb/")"
51 done
54 chown -R "$CHOWNUSER" "build/$TAG"