Here is the correspondance between Jim Hall and me. I leave it here for you, because you might get a clearer understanding of how to build an rpm. It is also worth checking what he says for the sake of accuracy. In other words, I may have got some information mixed up and you can go to the source on what can/cannot and needs/doesn't need to be done. He gives a different example than what I gave in the HOWTO, so that also might clarify things a little.
Just an FYI on building RPM files. I couldn't find the doc I'd written
for my work on how to build RPM files - it's not on my home computer,
and I never remembered to look for it when I was at work. :/
Anyway, it's very simple. I just reproduced the method in about 10
minutes' time for research. This example uses a home-spun version of
`lint' but it applies equally well to creating an RPM of an hdimage.
This is the method I know we use at work, where we package up an entire
directory tree into an RPM so it can be installed onto other Linux-based
web servers.
First, before you build any RPM files, you need to have a current
version of the `rpm' program (I have version 3.0.3) and an ~/.rpmmacros
file. Note that if you use `rpm' version 2.x or previous, you can't use
this .rpmmacros file.
Here's mine:
%_topdir /home/jhall/src/rpm
And my /home/jhall/src/rpm directory has this structure:
/home/jhall/src/rpm/
/home/jhall/src/rpm/BUILD/
/home/jhall/src/rpm/RPMS/
/home/jhall/src/rpm/RPMS/i386/
/home/jhall/src/rpm/RPMS/i686/
/home/jhall/src/rpm/RPMS/noarch/
/home/jhall/src/rpm/SOURCES/
/home/jhall/src/rpm/SPECS/
/home/jhall/src/rpm/SRPMS/
Okay, let's assume you have a file that you just want to dump into an
RPM file. You need to create a Spec file. Here's a Spec file I just
wrote for a simple `lint' shell script wrapper for Linux
(/home/jhall/src/rpm/lint.spec, but it can be anywhere):
Summary: A shell script wrapper that pretends to be UNIX Lint
Name: lint
Version: 1.0
Release: 1
Copyright: GPL
Group: Development/Tools
Source: ftp://ftp.foo.com/home/jhall/sh/lint.tar.gz
%description
This is just a simple shell script wrapper that pretends to be UNIX
Lint. Uses gcc.
%files
/usr/local/bin/lint
You should be able to figure this one out just by looking at it. It's
not a very difficult syntax.
Then, just create an RPM file out of it. We aren't interested in
creating a Source RPM (SRPM) so we'll just build binary (-bb):
$ rpm -bb lint.spec
Processing files: lint
Finding Provides: (using /usr/lib/rpm/find-provides)...
Finding Requires: (using /usr/lib/rpm/find-requires)...
Requires: /bin/sh
Wrote: /home/jhall/src/rpm/RPMS/i386/lint-1.0-1.i386.rpm
I'll post this RPM at the end of this email. It's not large (about 1k).
Querying for package information, we see the information I typed
rinto my lint.spec file:
$ rpm -qpi /home/jhall/src/rpm/RPMS/i386/lint-1.0-1.i386.rpm
Name : lint Relocations: (not
relocateable)
Version : 1.0 Vendor: (none)
Release : 1 Build Date: Sun 25 Jun
2000
05:00:51 PM CDT
Install date: (not installed) Build Host:
localhost.localdomain
Group : Development/Tools Source RPM:
lint-1.0-1.src.rpm
Size : 218 License: GPL
Summary : A shell script wrapper that pretends to be UNIX Lint
Description :
This is just a simple shell script wrapper that pretends to be UNIX
lint. Uses gcc.
Note that you can specify a Vendor in your .rpmmacros file.
Querying for package listing shows only one file:
$ rpm -qpl /home/jhall/src/rpm/RPMS/i386/lint-1.0-1.i386.rpm
/usr/local/bin/lint
So now I become root, and first make sure I don't have
a /usr/local/bin/lint and then I install the new RPM file:
# rpm -iv /home/jhall/src/rpm/RPMS/i386/lint-1.0-1.i386.rpm
lint-1.0-1
And lo! There it is:
# ls -lF /usr/local/bin/lint
-rwxr-xr-x 1 root root 218 Jun 25 16:49
/usr/local/bin/lint*
# rpm -qa|grep lint
lint-1.0-1
And I can just as easily remove it:
# rpm -e lint-1.0-1
# rpm -qa|grep lint
# ls -l /usr/local/bin/lint
/bin/ls: /usr/local/bin/lint: No such file or directory
And it's just as easy to create an RPM file for
/var/lib/dosemu/freedos.beta4
-jh
################################################
In another email:
Eugene Wong wrote:
>
> --- Jim Hall wrote:
> > Just an FYI on building RPM files.
>
> make an rpm with only 1 file>
>
> That's good news. If I recall correctly, while I was
> waiting for you to send the explanation, I tried to do
> it. Fortunately I managed to it. I think I found the
> how-to.
>
> My 3 questions are: do we want FreeDOS to distribute
> rpms with dependencies [such as which version of
> DOSEmu]? if so, how to we do that [I couldn't find it
> in the how-to]?
I don't know how to make a dependency on a version of
something, but I think you can force a prereq of
/usr/bin/dos (DOSEmu) with this in the top header of
the spec file:
Prereq: /usr/bin/dos
But there's probably a RedHat RPM HOWTO out there
somewhere that tells you how to enforce a package/version
be previously installed. My recollection was that version
3.0.3 wasn't well documented for all the big changes
that went into it.
But I'm not going to worry about it right now. If
someone installs a "dosemu-freedos*.rpm" package and
they don't already have DOSEmu installed, then that's
their problem. ;)
> Jim, do we want to post your
> explanation on the web site [I'd be willing to turn it
> into a web page]? I'd just hate to see that infomation
> go to waste. It might even be worth putting in the rpm
> how-to, using the freedos hdimage as an example.
Yes! Please turn this into an html FreeDOS HOWTO
for me, and I'll post it on the web site.
-jh