#!/sbin/sh

# This script is used during swinstall (on HP-UX) to initialize Wind/U registry with 
# default values. Additional check for platform type (e.g. Solaris, Linux, etc.)
# should be added in the future if needed.

# Now this script is also used within pkgadd on Solaris. The postinstall 
# script of CC will call this script.

# BC keys will be replaced with brand related strings.
# That's for BC (Branding Changes)

REGIMPORT="REGEDIT4\n 																\
[HKEY_LOCAL_MACHINE\\<<<BC_REG>>>]\n				\
[HKEY_LOCAL_MACHINE\\<<<BC_REG>>>\\Gui]\n		\
[HKEY_LOCAL_MACHINE\\<<<BC_REG>>>\\Gui\\Monitor]\n	\
\"MessagesReadInterval\" = dword:000001f4\n											\
[HKEY_LOCAL_MACHINE\\<<<BC_REG>>>\\Common]\n		\
\"HomeDir\"=\"/opt/omni\""

REGFILE="/tmp/__regimport.reg"

echo ${REGIMPORT} > ${REGFILE}

if [ ! -s ${REGFILE} ]
then
	echo "WARNING:  Could not create a temporary file on /tmp mount point (out\n"	>&2
	echo "          of disk space?). Registry initialization for GUI has failed."	>&2
else
	if [ ! -x "/opt/omni/bin/xregedit" ]
	then
		echo "WARNING:  Could not import GUI registry file - registry import program\n"	>&2
		echo "          not found (/opt/omni/bin/xregedit)!"							>&2
	else
                /opt/omni/bin/xregedit ${REGFILE} -s -nodisplay
                rm ${REGFILE}
	fi
fi

