glad to share it.

i'm basically using a specific file to determine whether this is the first boot 
or not and touching the file after my first pass.  then each subsequent run 
will notice the existence of the file and skip the first boot portion of the 
script.  you'll also notice some RHEL registration code, i did this in rc.local 
and not with the builtin snippets because we have a satellite server and RHN 
(with different keys no doubt) so I use a ksmeta variable to build a file 
containing the necessary registration info.  this allows me to register 
different systems with different RHN / satellite keys.  the section of the 
script that runs at every boot simply checks to see if the VMware tools need to 
be rebuilt, typically due to a kernel upgrade.  that last bit was taken pretty 
much verbatim from a post found on the wild wild web, i can't take credit for 
it.

byron

-------------rc.local-------------
# run some stuff on the first boot
if [ ! -e /etc/sysconfig/blah/firstboot ]; then

        # install vmware tools if this is a VM and it's the first boot
        if [ ! -e /etc/vmware-tools/ ] && /usr/sbin/dmidecode | grep -iq 
"product name: vmware virtual platform"; then
                echo "VMware detected"
                wget "http://X.X.X.X/prov/pkgs/vmwaretools.tgz"; 
--output-document=/tmp/vmwaretools.tgz
                echo "Installing VMware tools"
                cd /tmp
                tar zxf vmwaretools.tgz
                cd vmware-tools-distrib/
                /usr/bin/perl vmware-install.pl -d
        fi

        # if cobbler created the rhel_reg file let's register this system
        if [ -e /etc/sysconfig/swrx/rhel_reg ] && grep -iq "red.hat" 
/etc/redhat-release; then

                # the haldaemon needs to be running in order to register
                if /sbin/pidof hald; then

                        # source the register variables
                        . /etc/sysconfig/swrx/rhel_reg
                        # register the system
                        /usr/sbin/rhnreg_ks --serverUrl=$RHEL_URL 
--sslCACert=$RHEL_CERT --activationkey=$RHEL_KEY
                        # update the system
                        yum -y update

                fi

        fi

        # touch the firstboot file so the above code doesn't run anymore
        mkdir -p /etc/sysconfig/blah
        touch /etc/sysconfig/blah/firstboot
        # reboot system with new packages and kernel modules
        reboot

else
# code below this point will run every boot after the first

        # reinstall vmware tools if the kernel has updated on subsequent boots
        rkernel=`uname -r`
        if [ -e /etc/vmware-tools/not_configured ]; then
                echo "vmware-tools not configured for running kernel $rkernel"
                echo "running vmware-config-tools.pl"
                /usr/bin/vmware-config-tools.pl -d
                echo "vmware-tools now compiled for running kernel $rkernel"
                echo "restarting networking"
                /etc/init.d/network restart
                echo "network restarted"

        fi

fi

exit 0
-------------rc.local-----------------

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Joe Wulf
Sent: Tuesday, February 23, 2010 3:39 PM
To: cobbler mailing list
Subject: Re: How to find out the MAC address of a system

Byron,

I am interested, thank you.


_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler

Reply via email to