#!/bin/sh
#
# Component Name: TivoliPlus
#
# $Source: /tivoli/development/src/2.0/plus/Link/src/wcrtsol,v $
#
# $Revision: 1.3 $
#
# Description:
#
# (C) COPYRIGHT Tivoli Systems, Inc. 1995-1999.
# Unpublished Work
# All Rights Reserved
# Licensed Material - Property of Tivoli Systems, Inc.
#


#This script will create the policy region and collection for a new solution
#product

[ "$DEBUG" = true ] && set -xv

if [ $# -lt 3 ] ; then
	echo Usage: $0 solution-name state-name bitmap [ icondsl ]
	exit 1
fi
NAME=$1
STATE=$2
BITMAP=$3
ICONDSL=$4
#Determine the name of the top level PolicyRegion to use
if [ x"$TOP_PR_TO_USE" = x ] ; then
	TIVOLI_SOLUTIONS="TivoliPlus"
else
	TIVOLI_SOLUTIONS="$TOP_PR_TO_USE"
fi

TEMP=/tmp
if [ x"$OS" = x"Windows_NT" ]; then
	TEMP=$DBDIR/tmp
else
	TEMP=/tmp
fi
export TEMP

if [ ! -d $TEMP ]; then
	mkdir -p $TEMP
fi

if [ ! "$WINSTRUCTED" = true ]; then
  #Create Policy Region for this module
  wcrtspr "$NAME"
fi

# If a override was not specified dump GenericCollection dialog file
if [ -n "$ICONDSL" ]; then
	ICONDLG=$ICONDSL
else
	ICONDLG=$TEMP/dialog.d
	wgetdialog -I normal -r GenericCollection > $ICONDLG
fi

#Add a state to Generic Collection for this Solution
waddstate GenericCollection "$STATE" $ICONDLG "$BITMAP"

# Only delete this if it's the temporary dialog from the generic collection
if [ -z "$ICONDSL" ]; then
	rm $ICONDLG
fi

#Create Solutions Collection
wcrtscoll "$NAME" "$TIVOLI_SOLUTIONS" "$STATE"

exit 0
 
