lib: fixed endless loop in IConverter if exceptions are off
[barry.git] / maintainer / make-rpm.sh
blobcb3ee0ee15553840921a12885e990a17db0097a1
1 #!/bin/sh
3 if [ -z "$1" -o -z "$2" -o -z "$3" -o -z "$4" -o -z "$CHROOTUSER" -o -z "$CHOWNUSER" ] ; then
4 echo
5 echo "Usage: ./make-rpm.sh tarball specfile chroot_target short_form"
6 echo
7 echo "Copies the tarball to the chroot target's redhat SOURCES dir, and"
8 echo "the spec file to SPEC dir, then enters the chroot system"
9 echo "and runs rpmbuild."
10 echo
11 echo "short_form is the tag to rename the resulting RPM's with,"
12 echo "such as fc5 or fc6."
13 echo
14 echo "Expects CHROOTUSER to be set appropriately in the environment."
15 echo
16 exit 1
19 TARPATH="$1"
20 SPECPATH="$2"
21 TARNAME=`basename "$TARPATH"`
22 TARGET="$3"
23 TAG="$4"
25 set -e
27 cp "$TARPATH" "$TARGET/usr/src/redhat/SOURCES"
28 cp "$SPECPATH" "$TARGET/usr/src/redhat/SPECS/barry.spec"
29 chroot "$TARGET" /bin/sh -lc "rm -f /usr/src/redhat/RPMS/i386/* /usr/src/redhat/SRPMS/* && cd /usr/src/redhat/SPECS && rpmbuild --target i386 -ba barry.spec --with gui --with opensync && cd /usr/src/redhat/RPMS/i386"
30 mkdir -p "build/$TAG"
31 cp "$TARGET/usr/src/redhat/RPMS/i386/"* "build/$TAG"
32 cp "$TARGET/usr/src/redhat/SRPMS/"* "build/$TAG"
34 # We do this manually in a for loop, since the rename command is
35 # not the same across various linux distros...
37 cd "build/$TAG"
38 for f in *.src.rpm ; do
39 mv "$f" "$(echo $f | sed "s/.src.rpm$/.$TAG.src.rpm/")"
40 done
41 for f in *.i386.rpm ; do
42 mv "$f" "$(echo $f | sed "s/.i386.rpm$/.$TAG.i386.rpm/")"
43 done
46 chown -R "$CHOWNUSER" "build/$TAG"