Tom Brown wrote: > Hi > > I am scripting some post install bits on a kickstart machine that > downloads certain configuration files depending on the network the > machine is in. > > I am trying to construct an if statement that will run something > like > > > > ADDR=`ifconfig | grep "inet addr" | head -2 | awk '{print$2'} | cut -c > 14,15` > > if [ "$ADDR" = "11" ] ; then > echo "downloading bar" > fi > > if [ "$ADDR" = "12" ] ; then > echo "downloading foo" > > fi > > etc > > and there are 5 different configs - If none of the configs are found > then it downloads a default - Am i going about this the right way? Well, not really a direct answer to your question, but... have you looked at puppet[1]? It can be used to do this sort of thing very nicely. You can tell puppet to serve up different files to different clients based on their hostname. Something like this (taken from the puppet docs) would do almost exactly what you're after: class foo { file { "/path/to/my/file": source => [ "/nfs/files/file.$host", "/nfs/files/file" ] } } This would try first to use file.$host and if that wasn't found, would fall back to using file. [1] http://reductivelabs.com/trac/puppet -- Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Learn from the mistakes of others--you can never live long enough to make them all yourself. -- John Luther
Attachment:
pgpQS4tw6mZw9.pgp
Description: PGP signature