help-cfengine
[Top][All Lists]
Advanced

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

Re: running modules in %post section of a redhat ES3 kickstart?


From: Ed Brown
Subject: Re: running modules in %post section of a redhat ES3 kickstart?
Date: Wed, 26 Jan 2005 09:01:43 -0700

Change to vt3 at the top of %post so you can see things as they happen
there:
----------------
%post
chvt 3
exec < /dev/tty3 > /dev/tty3
....
----------------
After cfengine runs, (or after every command in %post), check 
the return code, or otherwise verify success (not every failure
within cfengine results in an error exit code).  If there is a
problem, start a shell within %post.  You can try re-running the 
command by hand, piping the output to 'more' or a file (avoid 
'less' in %post).  When you are ready, exit the shell and 
kickstart continues:
--------------------------------------
#####  Install and run cfengine  #####
# First, get the cfengine rpm
echo
echo
echo Installing cfengine rpm...
sleep 2
rpm -Uvh ${URL}/cfengine-2.1*
if ! rpm -q cfengine >/dev/null 2>&1
then
        echo
        echo There was a problem installing the cfengine rpm.
        echo Starting a shell for manual intervention.
        echo Hint: try manually installing:
        echo "e.g.:  rpm -Uvh $URL/cfengine-2.1* "
        echo
        echo Exit the shell to continue with the install.
        sh
else
        sleep 3  # Give time to see result of cfengine rpm install
fi

# Second, get the initial cfengine config files...
pushd /var/cfengine/inputs
echo
echo
echo Retrieving update.conf, the initial cfengine bootstrap file...
sleep 2
wget -nv ${URL}/kickstart/update.conf
if [ ! -f update.conf ]
then
        echo
        echo "There was a problem getting the cfengine 'update.conf' initial 
config file."
        echo Starting a shell for manual intervention.
        echo Hint: try manually installing:
        echo e.g.:  wget $URL/kickstart/update.conf
        echo
        echo Exit the shell to continue with the install.
        sh
else
        sleep 3   # Allow time to see result of file retrieval
fi
popd
                                                                                
# Third, run cfengine...
# Need to have these set to run cfengine
hostname `grep HOSTNAME /etc/sysconfig/network |cut -d'=' -f2`
export CFINPUTS=/var/cfengine/inputs
/usr/bin/rdate -s ip.of.time.server
echo
echo
echo
echo "Running cfagent with '-f update.conf' (gets config files common to all)"
echo
sleep 3 
cfagent -qv -f update.conf 
if [ $? -ne 0 -o ! -f /var/cfengine/inputs/cfagent.conf ]
then
        echo
        echo There was a problem running cfengine for the first time.
        echo Changing directory to /var/cfengine/inputs, and starting a shell.
        echo Exit shell to continue with install.
        echo 'Hints:'
        echo ' Try running "cfagent -qvf update.conf"'
        sleep 5
        cd /var/cfengine/inputs
        sh
fi
...
-------------------------------------------------
I run cfengine a couple of more times with '--just' certain actions
or '--avoid' certain actions.  Depending on how you bootstrap things,
you might be able to simply run cfengine once.  With this kind of 
%post section, you can often work through any problems and finish the
install successfully, rather than having to start over every time.

hope this helps,
Ed 



On Wed, 2005-01-26 at 07:42, Don Harper wrote:
> Has anyone done this?
> Everything else works for me but the modules, which set up some needed
> vars. :(  Works perfectly once I boot up after the install.
> 
> Any hints for debugging purposes?
> 
> Thanks!
> 
> Don




reply via email to

[Prev in Thread] Current Thread [Next in Thread]