#!/bin/sh
#
# Solaris pkg pre-install script.
#	Keep in step with "%pre" section of "heartbeat.spec".
#
# (c) 2004 David Lee <t.d.lee@durham.ac.uk>

if
  getent group @HA_APIGROUP@ >/dev/null
then
  : OK group @HA_APIGROUP@ already present
else
  GROUPOPT="-g @HA_APIGID@"
  if
    /usr/sbin/groupadd $GROUPOPT @HA_APIGROUP@ 2>/dev/null
  then
    : OK we were able to add group @HA_APIGROUP@
  else
    /usr/sbin/groupadd @HA_APIGROUP@
  fi
fi

if
  getent passwd @HA_CCMUSER@ >/dev/null
then
  : OK user @HA_CCMUSER@ already present
else
  USEROPT="-g @HA_APIGROUP@ -u @HA_CCMUID@ -d @HA_COREDIR@/@HA_CCMUSER@"
  if
    /usr/sbin/useradd $USEROPT @HA_CCMUSER@ 2>/dev/null
  then
    : OK we were able to add user @HA_CCMUSER@
  else
    /usr/sbin/useradd @HA_CCMUSER@
  fi
fi


syntax highlighted by Code2HTML, v. 0.9.1