Circa 2001-Dec-06 17:52:39 +0900 dixit Alexius Luke:
: Hi All,
:
: I am new to RPM package building.I have written a spec file for
: packaging my software.The software is a servlets based webserver.In the
: %install tag I place the installation script of my servlet programs.And then
: change some details in the apache and tomcat configuration files since it is
: needed by my servlets.
: When I build the package with the rpm -ba mypfg.spec command the
: instructions under the %install tag executes and the rpm file is
: generated.But when I use the generated rpm file to install it using the
: rpm -ivh mypkg.rpm then the %install portion is not executed.
: Is this how rpm works or am I missing out anything.Please do explain me
: how the %install part works during building(rpm -ba specfile) and
: installing(rpm -ivh genrpmfile).
Yes, that's how RPM works. Briefly:
%prep unpacks sources, applies patches, and does other preparation.
%build configures, compiles, and links.
%install installs files into a "model" directory tree
%files lists the files in the "model" directory tree, so that
they get included in the binary package at 'rpm -ba' time.
At 'rpm --install' time, the files listed in %files get unpacked into
the corresponding locations in the filesystem. Also at 'rpm --install'
time, RPM runs the scripts listed in the %pre and %post sections (see
the Maximum RPM book available online at www.rpmdp.org).
For example:
Name: blah
Version: 1.0
Release: 1
Source0: blah.tar.gz
BuildRoot: /tmp/%{name}-%{version}-%{release}-pkgroot
...
%prep
# Unpack "${RPM_SOURCE_DIR}/blah.tar.gz", then
# change directory to "${RPM_BUILD_DIR}/%{name}-%{version}".
%setup
%build
# Configure using './configure' with predefined --prefix, --bindir,
# etc.
%configure
# Compile and link.
make
%install
# Install into /tmp/blah-1.0-1-pkgroot/...
# This creates, for example, /tmp/blah-1.0-1-pkgroot/usr/bin/blah,
# /tmp/blah-1.0-1-pkgroot/usr/share/blah,
# etc.
%makeinstall
%files
# Make sure the files in the resulting package are owned by root.
%defattr(-,root,root)
# List the files in the package without the BuildRoot prefix.
/usr/bin/blah
/usr/share/blah
# The '*' at the end catches man pages that RPM automagically
# compresses.
/usr/share/man/man1/blah.1*
If you wish, you can use, for example, '%{_bindir}' instead of
'/usr/bin' in the %files list. This helps keep your specfile resilient
against changes in the location of directories (for example, /usr/man
-> /usr/share/man). The complete list of these macros, along with
their defaults is available in /usr/lib/rpm/macros (search for the
string "configure macros"). You can override them in your specfile
using, for example:
%define _exec_prefix /usr/X11R6
Good luck.
--
jim knoble | jmknoble@pobox.com | http://www.pobox.com/~jmknoble/
(GnuPG fingerprint: 31C4:8AAC:F24E:A70C:4000::BBF4:289F:EAA8:1381:1491)
Attachment:
pgp00001.pgp
Description: PGP signature