#! /sbin/sh
###############
# Product: VMMIGRATE
# Fileset: VMMIGRATE-RUN
# configure
# @(#) $Revision: 7655 $
################
#
# (c) Copyright Hewlett-Packard Company, 2005-2006
#
########################################################################

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

###############################################################################
# If you have to perform an operation such as converting a file format to a
# new form, that operation can be done as part of the configure script.  You
# must be able to detect that the conversion has been done so the conversion
# is not attempted more than once.
###############################################################################
# If you start a daemon, set your system configuration file's startup
# parameter to also start it at subsequent reboots. If SW_CONFIG_AFTER_REBOOT
# is set do NOT start your daemon.
# If vmm_cdio is unused in the kern, then do NOT start hpvm deamon.
# We need to check with dev. to see when /etc/rc.config.d/hpvm gets updated
# if hpvm is installed, but the kern module is "unused" or not configured.
# For now, if the kern module is NOT configured, we are not starting or
# setting rc.config.d/hpvm to run hpvm on reboots.
###############################################################################

#
# New "hpvmsys" group creation with conversion of a old
# obsolete hpvmoper group if it exists.
#
exist=
cp /etc/group /etc/group.prehpvm
# Does the hpvmsys group already exist?
if /usr/bin/grget -n hpvmsys >/dev/null 2>&1 ; then
    exist=TRUE
fi

#
# if hpvmsys group still does not exist create it
#
if [ -z "$exist" ] ; then
    groupadd hpvmsys >/dev/null 2>/dev/null
    cp /etc/group /etc/group.hpvmnew
    sed 's/hpvmsys::\([0-9]*\):/hpvmsys:*:\1:root/' /etc/group.hpvmnew >/etc/group 
    rm /etc/group.hpvmnew
fi 
rm /etc/group.prehpvm

# Change the group on directories and files owned by hpvmsys

chmog 0755 root hpvmsys /var/opt/hpvm/common/vmmigrate
IPD_addfile /var/opt/hpvm/common/vmmigrate

exit $exitval
