3 if [ -z "$1" -o -z "$2" -o -z "$3" -o -z "$4" -o -z "$CHROOTUSER" -o -z "$CHOWNUSER" ] ; then
5 echo "Usage: ./make-rpm.sh tarball specfile chroot_target short_form"
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."
11 echo "short_form is the tag to rename the resulting RPM's with,"
12 echo "such as fc5 or fc6."
14 echo "Expects CHROOTUSER to be set appropriately in the environment."
21 TARNAME
=`basename "$TARPATH"`
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"
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...
38 for f
in *.src.rpm
; do
39 mv "$f" "$(echo $f | sed "s
/.src.rpm$
/.
$TAG.src.rpm
/")"
41 for f
in *.i386.rpm
; do
42 mv "$f" "$(echo $f | sed "s
/.i386.rpm$
/.
$TAG.i386.rpm
/")"
46 chown
-R "$CHOWNUSER" "build/$TAG"