RE: Deploying config files revisited

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

 



> -----Original Message-----
> From: rpm-list-bounces@xxxxxxxxxx 
> [mailto:rpm-list-bounces@xxxxxxxxxx]On
> Behalf Of W. Eric Trull
> Sent: Wednesday, August 11, 2004 12:55 PM
> To: rpm-list@xxxxxxxxxx
> Subject: Deploying config files revisited
> 
> 
> Back in July there was a "Deploying config files" thread 
> about installing
> configuration files using RPM.  One of the questions asked 
> was whether these
> files are owned by another package.  I have a similar 
> situation in which the
> config files *are* owned by another package.
> 
> I'm setting up a cluster of Linux nodes in which I want to 
> configure the ntp
> settings after the OS has been installed (kickstart install). 
>  I already have
> an RPM that installs other configuration files (i.e. /etc/hosts,
> /etc/resolv.conf) and want to add our environment specific 
> /etc/ntp.conf and
> /etc/ntp/step-tickers.  However, these two files are already 
> owned by the ntp
> package.
> 
> During the installation of my package I'd like to move the current
> /etc/ntc.conf and /etc/ntp/step-tickers aside and then 
> install my versions. 
> Anybody know how to get around the fact that the files are 
> owned by another
> package and suggestions on how to move the current files 
> before installing
> mine?

Eric -

I don't know if this helps, but we overwrite existing config files like the (obfuscated) example below.  WARNING:  This is an ugly hack and there are probably better ways to do it.  This just works for me.

%define name foo
%define version 1.0
Name: %{name}
Version: %{version}
Release: 0
License: Commercial
Group: System Environment/Base
URL: http://obfuscated.bankofamerica.com
Source: foo-1.0.tgz
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-root

Summary: Package to set foo to use Bank of America's foo infrastructure.

%description
Package to set foo to use Bank of America's foo infrastructure.

%prep
# nothing to see here, move along

%setup -q -n %{name}-%{version}
# nothing to see here, move along

%clean
# nothing to see here, move along

%build
# nothing to see here, move along

%install
# nothing to see here, move along

%files
# nothing to see here, move along

%post
# make a backup of the existing config file
cp -a /path/to/foo.cfg /path/to/foo.cfg.`date +%m.%d.%Y`

# now overwrite the config file with the text below.
cat << EOF > /path/to/foo.cfg
# Put the contents of your config file, 
# shell script or whatever in here
foo=bar
bar=baz
EOF

%changelog
* Wed Jul 07 2004 Thomas Cameron <thomas.cameron@xxxxxxxxxxxxxxxxx>
- First Build

Hope this is helpful!
Thomas Cameron, RHCE, CNE, MCSE, MCT
Assistant Vice President
Linux Design and Engineering
Bank of America
(972) 997-9641

The opinions expressed in this message to not necessarily reflect those of my employer, Bank of America.  No warranty is offered.  If you follow any advice given here and your system breaks, you get to keep all the pieces.


_______________________________________________
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