Re: How to write a spec file to revise various config files?

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

 



On Friday, 08 December 2006, at 23:12:11 (-0600),
Paul Johnson wrote:

> After installing Fedora, I want to replace various configuration
> files on lab computers. If I can learn how to do this in the post
> section of an RPM spec file, I will be happy.

There are two basic scenarios:  replacing existing files with new
ones, or editing files in place.  Choice #2 is *very* tricky; #1 is by
far the better option.  It's still not great, but better.

I don't have any examples to show you, but the basic idea is to
install your versions into a secondary tree and create
backups/symlinks in the %post section which get removed in the %preun
section.  Make sure you check $1 so that these actions only happen for
install/erase, NOT upgrades!  Upgrades need only replace the existing
config files in your package.

For example, you have a package called "ukansascfg" which installs
your configs into /etc/ukansascfg/gdm/Foo and so forth.  Your %post
section would loop through those files, moving the original
/etc/gdm/Foo to /etc/gdm/Foo.pre_ukansascfg_20061210 and creating
/etc/gdm/Foo as a symlink to /etc/ukansascfg/gdm/Foo.

You must understand that rpm cannot and will not track this "hostile
takeover" of config files, and rpm -V will report numerous problems
for each one.  You will probably also have to write %triggers for each
package whose config files are being replaced so that upgrades to
those packages don't overwrite your changes.

You can always have your yum repository provide versions of those
packages that are "newer" and have your custom config changes already
in them.  You'll have to track the upstream Fedora package carefully,
but tools like Mezzanine (http://beta.kainx.org/wiki/view/Mezzanine)
make that job a whole lot easier than doing what I described above.

Michael

-- 
Michael Jennings (a.k.a. KainX)  http://www.kainx.org/  <mej@xxxxxxxxx>
n + 1, Inc., http://www.nplus1.net/       Author, Eterm (www.eterm.org)
-----------------------------------------------------------------------
 Many things in life are highly overrated.  Chief among them is love.
 No matter what anyone else tells you, nice guys do finish last.
                                          -- Rules of Life #96 and #97

_______________________________________________
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