#! /usr/pkg/bin/ksh93
# ##########################################################################
#
#  Xstartup
#
#  Common Desktop Environment (CDE)
#
#  Configuration file for the Login Manager
#
#  (c) Copyright 1993, 1994 Hewlett-Packard Company
#  (c) Copyright 1993, 1994 International Business Machines Corp.
#  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
#  (c) Copyright 1993, 1994 Novell, Inc.
#
#      ************** DO NOT EDIT THIS FILE **************
#
#  /usr/pkg/dt/config/Xstartup is a factory-default file and will
#  be unconditionally overwritten upon subsequent installation.
#  Before making changes to the file, copy it to the configuration 
#  directory, /usr/pkg/usr/pkg/etc/dt/config. You must also update the startup
#  resource in /usr/pkg/usr/pkg/etc/dt/config/Xconfig.
#
#  $XConsortium: Xstartup.src /main/6 1996/08/15 16:52:10 rswiston $
#
#  This file is typically a shell script. It is run as "root" and should be
#  very careful about security. This is the place to put commands that
#  display the message of the day or do other system-level functions on
#  behalf of the user. The following are the environment variables set for 
#  use in the script:
#
#    DISPLAY, HOME, PATH, USER, SHELL, TZ (timeZone)
#
#  System Administrators are encouraged to use this file as a base to run 
#  system-wide initialization commands with good security.
#
# ##########################################################################
#
# This script is run as root after the user is verified...
#
# dtdbcache file's directory should match
# _DTDTSMMTEMPDIR in DtSvc/DtUtil1/DtsMM.h
DTDBFILE=/tmp/dtdbcache_$DISPLAY
if [ -f $DTDBFILE ]
then
  /bin/rm -f $DTDBFILE
fi
if [ "$DTXSERVERLOCATION" = "local" ]
then
  if [[ ! -z "$ITE" && "$ITE" != "??" && -a "/dev/$ITE" ]]
  then
        /usr/sbin/chown $USER /dev/$ITE
        /usr/bin/chgrp $USER_GID /dev/$ITE
  fi
fi
wtmp_flag=-w\ /var/log/wtmp
utmp_flag=-u\ /var/run/utmp
exec sessreg -a $wtmp_flag $utmp_flag -l $DISPLAY $USER
