[lug] RPM System Package

Rob Nagler nagler at bivio.biz
Wed Dec 17 20:29:26 MST 2003


Joseph McDonald writes:
> I'd just like to build an RPM for kicks. Any recomendations from
> those who may have done something similar?

Yes, and I highly recommend it.  One thing we've learned is that you
shouldn't overwrite system files with copies, rather edit them.  For
example, if you want to add values to /etc/hosts.allow, write a little
program that appends lines, and does nothing if those lines are
already appended.  Test this program outside the RPM using unit tests
so that you don't blow away your system files. :-)   Here's the
program we use:
http://www.bivio.biz/f/bOP/lib/Bivio/Util/LinuxConfig.pm

Here's a sample usage:

%post
b-linux-config add_bashrc_d
b-linux-config allow_any_sendmail_smtp
%define sendmail_class_lines trusted-users apache mail
b-linux-config add_sendmail_class_line %{sendmail_class_lines}
b-linux-config rhn_up2date_param pkgSkipList 'apache*;'
#TODO: backward compatibility, remove this line sometime
rm -f /etc/hosts.allow /etc/hosts.deny
b-linux-config append_lines /etc/hosts.allow root root 0644 \
    'ipop3d imapd sendmail sshd: ALL'
b-linux-config append_lines /etc/hosts.deny root root 0644 \
    'ALL: ALL : spawn (/usr/sbin/safe_finger -l @%h | /bin/mail -s %d-%h root) &'

We have been using RPMs for this purpose for about 5 years now.  We've
evolved the system to our needs, and have a wrapper program that makes
it easier for us to write spec files:
http://www.bivio.biz/f/bOP/lib/Bivio/Util/Release.pm

There are other tools like cfengine, but what I've found is that the
hardest part is getting the editing programs right.  What cfengine
offers is a categorization mechanism, but the editing tool is quite
primitive imo.

Rob



More information about the LUG mailing list