#! /bin/ksh
#############################################################################
#
#   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/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/cde1_maint/3 1995/10/03 17:50:05 gtsang $
#
#   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...
#

if [ -f /tmp/dtdbcache_$DISPLAY ]
then
  DSTDBFILE=`/bin/echo /tmp/dtdbcache_$DISPLAY | /bin/sed 's/\..*//'`
  DSTDBFILEOWNER=`/bin/ls -l $DSTDBFILE | /bin/awk '{print $3}'`
  if [ $USER != $DSTDBFILEOWNER ]
  then
	/bin/rm -rf $DSTDBFILE
  fi
fi


if [ "$DTXSERVERLOCATION" = "local" ]
then
  if [[ ! -z "$ITE" && "$ITE" != "dtlocal" && -a "/dev/$ITE" ]]
  then
        /bin/chown $USER /dev/$ITE
        /bin/chgrp  tty  /dev/$ITE
  fi
fi
