Re: Simple scripted example?

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

 



Erik Slagter wrote:
Can someone point me to a trivial example
of how to write a spec file and use rpmbuild
to install a single binary /bin/foobar
and its init script, /etc/init.d/foobar
without touching any files in my home directory
(e.g. no twiddling ~/.rpmmacros, etc)?


It's actually quite simple (note: I do not recommend this, it's against
all RPM filosophy, I repeat: not recommended!) (although sometimes
unavoidable ;-))

The trick is to not "make" anything during the "build" stage. Put your
files into a tarball to be used as "source tarball". During the
"install" stage simply copy these files to the appropriate locations in
your build root (assuming you use one). Then mark these files as %files
and voila.

I use it for rpms that consist solely of config files etc.

Thanks for the quick reply.

I'm installing a package several hundred megabytes
in size, e.g. a complete gcc-3.4.1/glibc-2.3.2 cross toolchain
with multiple language support.  Half of my uses demand a
binary tarball, and half demand .rpm files.

For what it's worth,
http://kegel.com/crosstool/current/contrib/crosstool-mipsel.spec
probably does everything I need it to do; I just need
to generate it from a script to plug in the parameters
it currently hardcodes, and (if I insist on doing things the
non-RPM way) do the little shuffle you suggested to make
the binary tarball the 'source' tarball.

I did this once upon a time, and did get it to work, but
seem to remember I had to twiddle with files in my home
directory (.rpmmacros etc).   Looking at rpm.c now, I see
that the --macros flag can be used to specify a directory
to read those from, so maybe dotfiles aren't really an issue.

Another annoyance was that the resulting packages installed
much more slowly than a simple tar -xz.  In fact, the install
time was in the tens of minutes, way beyond the pain threshold
of my users.  Thus I would like to minimize the number of copies
made of the data during the install, if possible.  Would
it be faster to list each file individually (possible, since
I'm generating the spec file from a script)?  That might get
rid of one copy of the data...
- Dan

--
My technical stuff: http://kegel.com
My politics: see http://www.misleader.org for examples of why I'm for regime change


_______________________________________________ Rpm-list mailing list Rpm-list@xxxxxxxxxx https://www.redhat.com/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