[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Package management with cfengine
From: |
Brendan Strejcek |
Subject: |
Re: Package management with cfengine |
Date: |
Fri, 7 Nov 2003 15:40:34 -0600 |
User-agent: |
Mutt/1.3.28i |
My solution is to move the list of packages out of cfagent.conf. I
examine classes in a module and then do package adds based on that.
Currently, the package lists are written into the module (which is just
Bourne script) but I may change that at some point.
Here are some sections from my module to give you an idea of how I do
things. PKG, BASE_SERVICES, &c. are just lists of packages in the form
of shell variables. Oh, also note this is for Debian machines.
I don't know if I being at all clear, but...
# CFALLCLASSES has the form class1:class2:class3:etc
test_class() {
echo $CFALLCLASSES | sed 's/^/:/' | egrep :"${1}": >/dev/null 2>&1
}
# This module is only intended for Debian machines
test_class debian_3_0 || exit 0
# Define packages to install based on host classes
test_class any &&
PKG="$PKG
$ADMIN
$BASE_SERVICES
$OTHER
"
# Example of how to add a package contingent upon a class
test_class asdf &&
PKG="$PKG
some-lame-package
"
LOG='logger -p daemon.err -t cfengine:dpkg'
# Silence; concise output will go to the logs
exec >/dev/null 2>&1
apt-get update
for i in $PKG; do
if ( dpkg -s $i | grep ^Status | grep not-installed ); then
if ( $ENV apt-get -y install $i ); then
$LOG installed $i
else
$LOG error installing $i
fi
fi
done
apt-get clean