4 CHOWNUSER
="cdfrey:cdfrey"
6 if [ -z "$1" -o -z "$2" -o -z "$3" -o -z "$4" ] ; then
8 echo "Usage: ./make-rpm.sh tarball specfile chroot_target short_form"
10 echo "Copies the tarball to the chroot target's redhat SOURCES dir, and"
11 echo "the spec file to SPEC dir, then enters the chroot system"
12 echo "and runs rpmbuild."
14 echo "short_form is the tag to rename the resulting RPM's with,"
15 echo "such as fc5 or fc6."
17 echo "Available chroot targets:"
18 find $CHROOT -maxdepth 1 -type d
-print |
sed "s/^.*\// /"
25 TARNAME
=`basename "$TARPATH"`
31 cp "$TARPATH" "$CHROOT/$TARGET/usr/src/redhat/SOURCES"
32 cp "$SPECPATH" "$CHROOT/$TARGET/usr/src/redhat/SPECS/barry.spec"
33 chroot
"$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"
34 mkdir
-p "build/$TARGET"
35 cp "$CHROOT/$TARGET/usr/src/redhat/RPMS/i386/"* "build/$TARGET"
36 cp "$CHROOT/$TARGET/usr/src/redhat/SRPMS/"* "build/$TARGET"
38 # We do this manually in a for loop, since the rename command is
39 # not the same across various linux distros...
42 for f
in *.src.rpm
; do
43 mv "$f" "$(echo $f | sed "s
/.src.rpm$
/.
$TAG.src.rpm
/")"
45 for f
in *.i386.rpm
; do
46 mv "$f" "$(echo $f | sed "s
/.i386.rpm$
/.
$TAG.i386.rpm
/")"
50 chown
-R $CHOWNUSER "build/$TARGET"