#!/bin/sh
######################################################################
#
#   Xfailsafe
#
#   Common Desktop Environment
#
#   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/Xfailsafe 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 
#   failsafeClient resource in /etc/dt/config/Xconfig.
#
#   $XConsortium: Xfailsafe.src /main/cde1_maint/2 1995/08/29 19:50:38 gtsang $
######################################################################
#
#
#  This file contains commands to invoke a simple session for repairs of
#  a dysfunctional environment. 
#
#  All clients should be run in the background with the exception of the
#  last client.  When the last client is terminated by the user, the session
#  will be terminated and the login screen will be presented.
#

#  This simple session consists of a single terminal emulator.
# 
#  If Trusted Extensions is enabled, session must run as root.
#  If not root, an authorized user may assume the root role.



   /usr/dt/bin/dtsession_res -load -system
   if [ `/usr/xpg4/bin/id -u` != 0 ]; then
      if [ -x /usr/bin/plabel ]; then
	  /usr/bin/plabel > /dev/null 2>&1
          if [ $? = 0 ]; then
              roles=`/usr/bin/roles|/usr/bin/tr , " "`;
              for role in $roles; do
                  if [ $role = root ]; then
                      /usr/dt/bin/dtterm -C -ls -bg white -fg black -xrm "*menuBar:False" -xrm "*menuPopup:False" -e su
                      break
                  fi
              done
	      exit
          fi
      fi
   fi
   /usr/dt/bin/dtterm -C -ls -bg white -fg black -xrm "*menuBar:False" -xrm "*menuPopup:False"

