author | Alan Coopersmith <Alan.Coopersmith@Oracle.COM> |
Mon, 31 Oct 2016 18:25:15 -0700 | |
changeset 7201 | bcc18175756d |
permissions | -rw-r--r-- |
7201
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
1 |
#!/bin/bash |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
2 |
# |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
3 |
# Script for starting a desktop session |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
4 |
# |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
5 |
# CDDL HEADER START |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
6 |
# |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
7 |
# The contents of this file are subject to the terms of the |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
8 |
# Common Development and Distribution License (the "License"). |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
9 |
# You may not use this file except in compliance with the License. |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
10 |
# |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
11 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
12 |
# or http://www.opensolaris.org/os/licensing. |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
13 |
# See the License for the specific language governing permissions |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
14 |
# and limitations under the License. |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
15 |
# |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
16 |
# When distributing Covered Code, include this CDDL HEADER in each |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
17 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
18 |
# If applicable, add the following below this CDDL HEADER, with the |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
19 |
# fields enclosed by brackets "[]" replaced with your own identifying |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
20 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
21 |
# |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
22 |
# CDDL HEADER END |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
23 |
# |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
24 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
25 |
# |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
26 |
# Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
27 |
# |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
28 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
29 |
MYNAME=$(basename $0) |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
30 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
31 |
usage() { |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
32 |
echo "Usage: $0 session_name" |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
33 |
echo " This script loads scripts in /etc/X11/xinit/xinitrc.d" |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
34 |
echo " and runs a session manager." |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
35 |
echo " session_name is gnome, twm or xdm" |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
36 |
} |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
37 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
38 |
if [ $# -ne 1 ]; then |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
39 |
usage |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
40 |
exit 1 |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
41 |
fi |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
42 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
43 |
case "$1" in |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
44 |
-h|--help|-\?) |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
45 |
usage |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
46 |
exit 0 |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
47 |
;; |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
48 |
esac |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
49 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
50 |
SESSION_NAME="$1" |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
51 |
shift |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
52 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
53 |
case "$SESSION_NAME" in |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
54 |
gdm|GDM|gnome|GNOME|jds|JDS) SESSION_MANAGER=/usr/bin/gnome-session ;; |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
55 |
twm|TWM) SESSION_MANAGER=/usr/bin/twm ;; |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
56 |
xdm|XDM) SESSION_MANAGER=/usr/lib/X11/xdm/Xsession ;; |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
57 |
console) exit 0 ;; |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
58 |
*) |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
59 |
if [ "x$SESSION_NAME" != x ] ; then |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
60 |
SESSION_MANAGER=$SESSION_NAME |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
61 |
fi |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
62 |
if [ ! -x $SESSION_NAME ] ; then |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
63 |
echo "Could not find session startup for $SESSION_NAME" |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
64 |
SESSION_MANAGER=/usr/bin/twm |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
65 |
fi |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
66 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
67 |
esac |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
68 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
69 |
# GDM session worker sets DESKTOP_SESSION environment from .desktop file. |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
70 |
export DESKTOP_SESSION=$SESSION_NAME |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
71 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
72 |
# run all system xinitrc shell scripts. |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
73 |
if [ -d /etc/X11/xinit/xinitrc.d ]; then |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
74 |
for i in /etc/X11/xinit/xinitrc.d/* ; do |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
75 |
if [ -x "$i" ]; then |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
76 |
. "$i" |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
77 |
fi |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
78 |
done |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
79 |
fi |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
80 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
81 |
exec $SESSION_MANAGER $@ |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
82 |