#! /usr/local/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/local/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, /etc/dt/config. You must also update the startup
#  resource in /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
        /sbin/chown $USER /dev/$ITE
        /bin/chgrp $USER_GID /dev/$ITE
        if [ -c /dev/dri/card0 ]; then
            chown $USER:$USER_GID /dev/dri/card0
        fi
        if [ -c /dev/dri/renderD128 ]; then
            chown $USER:$USER_GID /dev/dri/renderD128
        fi
  fi
fi
wtmp_flag=-w\ /var/log/wtmp
utmp_flag=-u\ /var/run/utmp
exec sessreg -a $wtmp_flag $utmp_flag -l $DISPLAY -x /usr/local/dt/config/Xservers $USER
