#!/bin/ksh

# Component: prior
#
# Description:
#  Control script of component prior
#
# Last Updated     : $Author$
# Update Date Time : $Date$
# RCS File Name    : $RCSfile$
# RCS Revision     : $Revision$
# Locked by        : $Locker$
# Symbolic name    : $Name$
# State            : $State$

#--- INIT ------------------------------
#needs $HOME
. $HOME/etc/ctrl.main.shi

[ -f $HOME/etc/setenv.sh ] && . $HOME/etc/setenv.sh

#--- FUNC ------------------------------
do_shell_()
{
	cat <<-EndOfInlineData
		PRIOR_HOME=$HOME/component/prior
		PRIOR_VAR=\$VAR/prior

	EndOfInlineData

} #do_shell_()

do_start_()
{
	# Creating data directories
	#[ ! -d "$PRIOR_VAR" ] && mkdir $PRIOR_VAR 2>/dev/null
	# in V9 prior config files are moved to shared directory
	[ ! -d "$SHARED_CONF" ] && echo "$SHARED_CONF directory does not exist!" >&2
	# prior config
	[ ! -f "$SHARED_CONF/prior.cfg" ] && cp $PRIOR_HOME/prior.cfg $SHARED_CONF/

	# prior retrieve config
	[ ! -f "$SHARED_CONF/priorretrieve.cfg" ] && cp $PRIOR_HOME/priorretrieve.cfg $SHARED_CONF/

	# make prior.cfg and priorretrieve.cfg writeable
	chmod +w $SHARED_CONF/prior.cfg $SHARED_CONF/priorretrieve.cfg

} #do_start_()


#
# List files/tables to be backed up grouped by categories
#
# output lines should be in '<category> <type> <names>' format
#
do_listbackup_()
{
	cat <<-EOFLISTBACKUP
		config.system FILE ${PRIOR_VAR#$HOME/}
	EOFLISTBACKUP
}

#--- MAIN ------------------------------
check_action_ $1
if [ 0 = $? ]; then
	do_$1_

else
	echo "--- Component prior [ctrl $$]: Bad command: $1" >&2
	exit 1

fi
