Forum: Cfengine Help
Subject: Re: how to compile on hp-ux 11.31
Author: Beto
Link to topic: https://cfengine.com/forum/read.php?3,22235,22251#msg-22251

...also a preinstall script for your package that will kill cfengine processes 
and uninstall any existing cfengine package (inlcuding cfengine2 crap installed 
with DSAU) before doing the install.  This is pointed to by cfengine.preinstall 
in the above psf.


#!/sbin/sh 
######## 
# Product: cfengine 
# Fileset: LATEST 
# preinstall 
# @(#) $Revision: 1.4 $ 
######## 
# 
# (c) Copyright 2002, Hewlett-Packard Company 
# 
########

UTILS="/usr/lbin/sw/control_utils" 
if [[ ! -f $UTILS ]] 
then 
  echo "ERROR: Cannot find $UTILS" 
  exit 1 
fi 
. $UTILS 
exitval=$SUCCESS

PATH=$SW_PATH:/usr/bin
export PATH

################################################################################
 
# FUNCTIONS 

######## 
# Remove_obsolete() 
# 
# Arg: The argument should be the full software specification of a single 
# product or fileset to be removed. 
# 
Remove_obsolete() 
{ 
  typeset sw=$1 
  typeset ropt 
  typeset swstatus 
  typeset -i retval

  swstatus=`get_install_state $sw`

  if [[ $swstatus != 'not found' ]]   
  then   
    msg NOTE "Removing obsolete fileset $sw"   
    ropt="-x logfile=0"   
    retval=$(swremove $ropt -x autoselect_dependents=false -x 
enforce_dependencies=false\
      "$sw" @ ${SW_ROOT_DIRECTORY} > /dev/null)
    if [ $retval -ne 0 ]   
    then   
      msg error "Could not remove "$sw   
    fi   
  fi   
  return $? 
}

PROCS="cf-agent cf-execd cf-monitord cf-serverd cfservd cfexecd cfagent"

FILESETS="
 cfengine
 DSAU.CSYNC-ENG-A-MAN
 DSAU.DSAU-CSYNC-SRC
 DSAU.DSAU-CSYNC-RUN
 DSAU.DSAU-CSYNC2-RUN
"
############################################################################## 
# MAIN 
#

####### 
# Stop daemons prior to updating them here. If the daemon MUST continue to run 
# for the health of the system (for example, "cron"), then do not kill it 
# here. The files to replace the running daemons will be in place when the 
# system reboots.

for pr in $PROCS
do
  kill_named_procs $pr SIGKILL 
  retval=$? 
  if [[ $retval -ne 0 ]] 
  then 
    echo "WARNING: Could not kill all "$pr" processes" 
    [[ $exitval -ne 1 && $retval -ne 0 ]] && exitval=$retval 
  fi
done

# Remove obsolete software structures that might be lingering on the system. 
for sw in $FILESETS
do 
  Remove_obsolete $sw 
  retval=$? 
  [[ $exitval -ne $FAILURE && $retval -ne $SUCCESS ]] && exitval=$retval 
  # Remove_obsolete has already reported an error if one occured 
done

# Remove the cfengine cached executables.
if [[ -d /var/cfengine/bin ]] ;
then
  rm -f /var/cfengine/bin/*
fi

# Remove any obsolete files.
rm -f /usr/local/lib/libpromises.* /usr/local/lib/hpux32/libpromises.*
rm -f /sbin/init.d/cfs* /etc/rc.config.d/cfs*

exit 0


_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to