1#!/bin/sh
2#
3#       srecord - manipulate eprom load files
4#       Copyright (C) 1998, 2003, 2006, 2007 Peter Miller
5#
6#       This program is free software; you can redistribute it and/or modify
7#       it under the terms of the GNU General Public License as published by
8#       the Free Software Foundation; either version 3 of the License, or
9#       (at your option) any later version.
10#
11#       This program is distributed in the hope that it will be useful,
12#       but WITHOUT ANY WARRANTY; without even the implied warranty of
13#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14#       GNU General Public License for more details.
15#
16#       You should have received a copy of the GNU General Public License
17#       along with this program. If not, see
18#       <http://www.gnu.org/licenses/>.
19#
20case $# in
212)
22        ;;
23*)
24        echo "Usage: $0 tmp-dir tarball" 1>&2
25        exit 1
26        ;;
27esac
28
29tmp=$1
30tarball=$2
31
32mkdir -p $tmp/BUILD $tmp/BUILD_ROOT $tmp/RPMS/i386 \
33        $tmp/SOURCES $tmp/SPECS $tmp/SRPMS
34
35mac=`rpm --showrc | awk '/^macrofile/{print $3}'`
36cat > $tmp/rpmrc << fubar
37macrofiles: ${mac}:$tmp/macros
38fubar
39
40here=`pwd`/$tmp
41cat > $tmp/macros << fubar
42%_builddir      $here/BUILD
43%_buildroot     $here/BUILD_ROOT
44%_rpmdir        $here/RPMS
45%_sourcedir     $here/SOURCES
46%_specdir       $here/SPECS
47%_srcrpmdir     $here/SRPMS
48fubar
49
50rpmbuild -ta --target i386-pc-linux --rcfile $tmp/rpmrc -vv $2
51test $? -eq 0 || exit 1
52
53exit 0
54