It isn't much.
The init.d file is just:
doconfig() {
if [ -f ${CNF_HOME}/$1.proto ]; then
${CNF_HOME}/config.sh ${CNF_HOME}/$1.proto > $2
fi
}
doconfig motd /etc/motd
doconfig yum.conf /etc/yum.conf
doconfig selinux-config /etc/selinux/config
etc.
(and the enabling/disabling of various services).
config.sh is:
sed 's/__HOSTNAME__/h1/g' $1 | \
sed 's/__DOMAIN__/d1/g' | \
sed 's/__DNS_RESOLVER__/172.16.1.22/g' | \
sed 's/__NTP_SERVER__/172.16.1.22/g' | \
sed 's/__WAN_GATEWAY__/172.16.1.1/g' | \
etc.
This allows us to have a master config file so that one parameter changed
in one place updates the various necessary config files (e.g., the
hostname can be set in /etc/hosts and /etc/sysconfig/network, the domain
in resolv.conf and /etc/sysconfig/network, etc). Likewise, the firewall
script only allows access to NTP to NTP_SERVER, DNS to DNS_RESOLVER, SMTP
to the MAIL_SERVER, etc (belts and suspenders is easy when it doesn't take
any effort :-). The script also adds files to /etc/profile.d directly.
The specfile is just a checkout from CVS in build, copy of the files to
/etc/localconfig in install, the list of files (with only config.sh
being marked %config), and the list of required RPMs. The only wrinkle is
including in %post a script that updates config.sh with a new config
element (since config.sh won't be updated). For example,
if ! grep -q __AUTO_YUM_UPD__ config.sh; then
cp config.sh config.sh.rpmbackup
sed '/WAN_GATEWAY/s/\\$/\\\nsed %s\/__AUTO_YUM_UPD__\/yes\/g% |\
\\/' config.sh.rpmbackup | sed "s/%/'/g" > config.sh
fi
was needed in the migration to FC6 since yum-updatesd.conf was added.
The only problem with this solution is the makefiles that we have for
certain services (e.g., postfix or selinux) trigger on every update. I
need to clean this up so that doconfig doesn't update the file if there
wasn't a change.
Steve
On Tue, 5 Dec 2006, Craig White wrote:
If you were inclined to share, I would be inclined to look...that sounds
pretty sweet.
Craig
On Tue, 2006-12-05 at 18:11 -0500, Steve Friedman wrote:
We wrote an RPM that:
(a) Requires whatever other RPMs that we want to use (so a standard
install would work and we didn't need to spend time selecting the packages
to install and so that we could deploy a newly useful RPM quickly to all
machines)
(b) installs our config files to /etc/local-install
(c) includes an init.d script which runs at level 01 in rc2/3/4/5 to copy
the above files to their appropriate location (overwriting the RPM-owned
file) on each startup.
I couldn't think of a better way.
Steve Friedman
On Tue, 5 Dec 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?
--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list