Re: First ever rpm, how are files extracted from the rpm and where do they go?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 10, 2009 at 11:01 PM, Ignacio Valdes <ivaldes@xxxxxxxxxx> wrote:
> Hi all,
>
> I have a package that I've built the rpm for that doesn't install.
> Let's call it myfirst.rpm. It consists of 3 tar.gz files, 2 doc files,
> and some shell scripts. The files are listed in %files and the package
> builds into a rpm that is consistent with the files being in the rpm.
> The desired behavior for the rpm is that rpm -i myfirst rpm results in
> the 3 tar.gz files, 2 doc files and some shell scripts are unpacked
> from the rpm and then the %post script goes to work on them to process
> and move them to their ultimate locations in /opt.
>
> I have the script that does the installation in %post but it is
> unclear to me how to unpack the files in the rpm package so tha tthe
> %post script can work on them. How does one do this and where do they
> go when they are unpacked. For instance, if I have myfirst.rpm in
> /root, and I do a rpm -i myfirst.rpm how does one direct the files in
> %files to come out of the rpm and on that first unpack from the rpm,
> where does rpm put them?
>
> I've read multiple fine manuals but it is unclear how to get rpm to
> extract the files and the location that the %post operates on those
> extracted files.
>
> -- IV

You are going at this wrong-headedly.  You do the work of installing
the files and then the rpm build process packages them for you. You do
not do builds in the post phase of the spec file.

Take any RPM from your distro and look in there "rpm -qilp
whatever.rpm" you'll see the list of files to be installed there.  Not
generally tar.gz files.

I recall learning how to do this from the Maximum RPM book, but if you
just download a few SRPM files from a distribution, install them, and
then experiment with building them, then you will see what's going on.
 At least you should look at some spec files.  They have "parts" where
the code is untarred, configured, made, installed, and packaged. The
setup and configure put stuff in to a build directory, and then when
you do the install part, the files are moved to a "target" location
(the "buildroot") where they sit until the "files" option in the spec
file is processed and the rpm itself is built.   Then when you install
the RPM, it handles that part of opening and positioning the files.

In case you have something as simple as just copying some files out of
a tarball, you can just use a cp command in the install section of the
spec file. I'm looking around for the simplest possible example of a
spec file, here's an old one from a file manager called "xfe".  The
makeinstall part puts files in the buildroot, and then the rpm
includes those files when it is done.

Name:           xfe
Version:        0.66
Summary: X File Explorer (Xfe) is a filemanager for X.
Release: 1fdr1
License: GPL
Group: File tools
Requires: fox >= 1.0 libpng >= 1.0
BuildRequires: fox-devel >= 1.0 libpng-devel >= 1.0
Source: %{name}-%{version}.tar.gz
Packager: Roland Baudin <roland65@xxxxxxx>
BuildRoot: %{_tmppath}/%{name}-buildroot

%description
X File Explorer (Xfe) is a filemanager for X. It is based on the
popular X Win Commander, which is
discontinued. Xfe is desktop independent and is written with the C++
Fox Toolkit. It has Windows Commander
or MS-Explorer look and is very fast and simple. The main features
are: file associations,
mount/umount devices, directory tree for quick cd, change file attributes, auto
save registry, compressed archives view/creation/extraction and much more.

%prep
%setup -q

%build
%configure --with-included-gettext --with-static=no
make

%install
rm -rf %{buildroot}
%makeinstall

if [ -f %{buildroot}%{_datadir}/locale/locale.alias ]; then
        rm %{buildroot}%{_datadir}/locale/locale.alias
fi

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc AUTHORS COPYING README TODO FAQ BUGS
%{_bindir}/*
%{_libdir}/foxicons
%{_libdir}/foxrc
%{_datadir}/pixmaps/*
%{_datadir}/locale/*/LC_MESSAGES/xfe.mo
%{_mandir}/man1/*






-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas
_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxxxxx
http://lists.rpm.org/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux