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 user rpmbuild SOURCES dir, and"
8 echo "the spec file to SPEC dir, then enters the chroot system"
9 echo "and runs rpmbuild as the default user."
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/home/$CHROOTUSER/rpmbuild/SOURCES"
28 cp "$SPECPATH" "$TARGET/home/$CHROOTUSER/rpmbuild/SPECS/barry.spec"
29 USERCMD
="rm -f /home/$CHROOTUSER/rpmbuild/RPMS/i386/* /home/$CHROOTUSER/rpmbuild/SRPMS/* && cd /home/$CHROOTUSER/rpmbuild/SPECS && rpmbuild --target i386 -ba barry.spec --with gui --with opensync && cd /home/$CHROOTUSER/rpmbuild/RPMS/i386"
30 chroot
"$TARGET" su
-c "$USERCMD" - $CHROOTUSER
32 cp "$TARGET/home/$CHROOTUSER/rpmbuild/RPMS/i386/"* "build/$TAG"
33 cp "$TARGET/home/$CHROOTUSER/rpmbuild/SRPMS/"* "build/$TAG"
35 # We do this manually in a for loop, since the rename command is
36 # not the same across various linux distros...
39 for f
in *.src.rpm
; do
40 mv "$f" "$(echo $f | sed "s
/.src.rpm$
/.
$TAG.src.rpm
/")"
42 for f
in *.i386.rpm
; do
43 mv "$f" "$(echo $f | sed "s
/.i386.rpm$
/.
$TAG.i386.rpm
/")"
47 chown
-R "$CHOWNUSER" "build/$TAG"