help-cfengine
[Top][All Lists]
Advanced

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

Re: another mysterious segfault


From: Ed Brown
Subject: Re: another mysterious segfault
Date: Mon, 29 Aug 2005 17:10:11 -0600

On Mon, 2005-08-29 at 15:49, Lars Damerow wrote:
> I really wish there were a better way to debug cfengine during kickstart.

To make a kickstart script more robust and versatile, you can
error-check every significant step, and if failure is detected, start a
sub-shell.  This gives you the opportunity to debug and work around
one-time problems, probably resulting in a successful install without
starting all over.  Here's some excerpts by way of suggestion.  (A
subroutine could make the error-checking 
routine easier, I just haven't got around to re-writing this...)

----------------------------------------------------------
%post
# Change virtual terminal and bring along keyboard input
chvt 3
exec < /dev/tty3 > /dev/tty3 2>/dev/tty3
clear
...
# 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  #(don't have ntp confs yet)
...
echo "Running cfagent with '-f update.conf' (gets config files common to all)"
echo
sleep 3 
cfagent -qvf 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
...
echo "Running cfengine with all actions, please be patient!!"
echo "(This may include installing additional rpms with yum.)"
echo
sleep 5
cfagent -qv -DNewBuild --avoid mountall
if [ $? -ne 0 ]
then
   echo
   echo There was a problem running cfengine.  Changing directory to
   echo /var/cfengine/inputs, and starting a shell. Exit shell to
   echo continue with install.         
   echo 'Hints:'
   echo ' Try running "cfagent -qv -DNewBuild --avoid mountall" '
   sleep 5
   cd /var/cfengine/inputs
  sh
fi
...
# (At the end, I like to give one more opportunity to start a shell 
# before rebooting, for whatever reason.)
echo
echo
echo 'All done!'
echo
echo Press Enter to exit the installation.
echo "          or"
echo Type s to start a shell. When you exit the shell,
echo the machine will reboot.
echo
echo Don\'t forget to remove the cd.
read x
if [ "$x" == "s" ]
then
        sh
fi
------------------------------------------------------------

It could be prettier, with dialog windows etc, but the basic idea 
is 'error-check/interactive opportunity' throughout and kickstart
gets a lot easier to work with.  

Hope this helps,
Ed






reply via email to

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