Re: Script help

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

 



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: pgp4VjS76bZJO.pgp
Description: PGP signature

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux