#!/bin/ksh 
#####################################################################
###  File:              sessionetc
###
###  Default Location:  /usr/dt/config/sessionetc
###
###  Purpose:		 To start additional programs under user's id at login
### 			 time after all user saved session applications have
###			 been started.
###
###       		 The /usr/dt/config location can be overwritten by 
###			 system software upgrades.  If you want to start 
###			 additional programs specific to a this workstation and
###			 not be effected by system upgrades, instead create a 
###			 similar executable file at /etc/dt/config/sessionetc.
###
###  Invoked by:        CDE SessionMgr (dtsession)
###
###  Revision:          @(#)sessionetc.src 1.8 98/06/17 
###
###  (c) Copyright 1997 Sun Microsystems, Inc.
###
#####################################################################

if [ "$DTXSERVERLOCATION" != "remote" ]
then
    if [ -x /usr/dt/bin/sdtvolcheck ]
    then
	/usr/dt/bin/sdtvolcheck -d -z 5 cdrom &
	echo $! | /bin/cat > /var/dt/tmp/$DTUSERSESSION/sdtvolcheck_pid
    fi
fi

#
# This code initalises the workspace menu the first time the user
# logs in to a locale.
#
if [    -f $HOME/.dt/$LANG/dtwmrc -a ! -f $HOME/.dt/$LANG/prewsmenu.dtwmrc \
     -o -f $HOME/.dt/dtwmrc -a ! -f $HOME/.dt/prewsmenu.dtwmrc ]
then
	# dtwmrc and no prewsmenu.dtwmrc: preserve user's customizations
	:
else
	if [ ! -d $HOME/.dt/$LANG ]
	then
		mkdir $HOME/.dt/$LANG
	fi
	if [ ! -d $HOME/.dt/wsmenu ]
	then
		dtaction RestoreWsmenuDir;
	fi
	if [ ! -f $HOME/.dt/$LANG/dtwmrc ]
	then
		dtaction RestoreDtwmrc;
		dtaction UpdateWorkspaceMenu;
	elif [ $HOME/.dt/wsmenu -nt $HOME/.dt/$LANG/dtwmrc ]
	then
		dtaction UpdateWorkspaceMenu;
	fi
fi
