#! /bin/sh -
#
# Multi-user mode with X11 session manager
#
# Copyright (c) 2018, 2020-2021 Matias Fonzo, <selk@dragora.org>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# To reflect the name of this script
RC="[${0##*/}]"

umask 022
IFS='
 	'
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/opt/trinity/bin
LC_ALL=C

echo ""
echo "${RC}: Looking for a graphical session manager ..."

command -v gdm && exec gdm -nodaemon
command -v kdm && exec kdm -nodaemon
command -v tdm && exec tdm -nodaemon
command -v xdm && exec xdm -nodaemon

# Setback to INIT 3 in case of failure

echo ""
echo "    If this message appears, it means that you do not have any"
echo "of the following combinations of session managers installed:"
echo "GDM, KDM, TDM, or XDM."
echo ""
exec telinit 3

