need spec file example to replace files from various packages

Nigel Wade nmw at ion.le.ac.uk
Wed Dec 6 10:16:44 UTC 2006


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.  For example, I want/need to
> replace things like
> 
> /etc/gdm/PreSession/Default
> /etc/gdm/PostSession/Default
> /etc/pam.d/system-auth
> /etc/hosts.allow
> /etc/hosts.deny
> 
> One brute force option is to install with rpm --replacefiles, but yum
> does not like that.
> So can  you point me at a spec file or two that will give example
> syntax on how I can create a backup of those files and replace them
> with the ones I want.
> 
> Please?
> 

Do you want to do it via packages, or would you rather have a custom kickstart 
configuration?

Kickstart can perform various operations pre-, during and post-install. I've not 
used it since RH 7.2 so I've no idea how it's progressed since then. In the 
%post section of a kickstart configuration you could run pretty much any command 
you like. This is an example from a KS file which I have used to install a 
custom RH CD for a dedicated firewall:

%post
# copy bridge/firewall files from the floppy to disk
mkdir /tmp/floppy
mount /dev/fd0 /tmp/floppy
cd /
tar xf /tmp/floppy/firewall_files.tar
umount /dev/fd0
cd /root
make
make install


What happens is that I boot the system with the custom CD and a floppy disk. 
When the installation is complete this section mounts the floppy, extracts the 
files from it (which contain the iptables rules, the networking setup etc).

With kickstart you can specify the disk partition layout, select the packages 
you want installed etc. I think you could make your own kickstart setup which 
would replace those files for you after the installation is complete.


-- 
Nigel Wade, System Administrator, Space Plasma Physics Group,
             University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw at ion.le.ac.uk
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555




More information about the fedora-list mailing list