~ubuntu-branches/ubuntu/raring/gdm/raring

« back to all changes in this revision

Viewing changes to debian/Xsession

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-17 11:41:35 UTC
  • mfrom: (1.4.32 upstream)
  • Revision ID: james.westby@ubuntu.com-20090717114135-1ql0hht1lumoiscv
Tags: 2.26.1git20090717-0ubuntu1
* Update to latest upstream git head:
  - Make greeter login window be a dock. Fixes metacity complaining about
    session management. (LP: #395324)
* Drop patches which are fixed upstream:
  - 00git-greeter-session-management.patch
  - 00git-invalid-dmrc-layout.patch
  - 00git-use-after-free.patch
  - 00git-xklavier4.patch
  - 02_dont_force_us_keyboard.patch
  - 04_polkit1.patch
* 80_workaround_incorrect_directories.patch: Update to new upstream version.
* Drop 01_xconfigoptions.patch; these configure variables are not used any
  more in the upstream code, and upstream supplies the X.org -br option by
  default now. Also drop the corresponding configure changes from
  17_update_default_xserver.patch.
* Apply 15_usplash.patch to debian/gdm.init and drop the patch.
* 17_update_default_xserver.patch: Update to new upstream version, add
  corresponding configure change, add patch tag header, forward upstream,
  and rename to 02_x_server_location.patch.
* Drop 99_autoreconf.patch. The only remaining build system change is the
  previous item.
* Drop 20_xdm-stuff.patch, it's just cruft.
* Drop debian/Xsession, and change debian/rules to install the upstream one.
* 01_xrdb_nocpp.patch: Add patch tag header, forward upstream.
* Rename 80_workaround_incorrect_directories.patch to
  04_fix_external_program_directories.patch and add patch tag header.
* Rename 81_initial_server_on_vt7.patch to 05_initial_server_on_vt7.patch.
* debian/rules: Remove /var/gdm (empty and nonstandard) and /var/run (will
  be created at runtime), thanks lintian.
* debian/copyright: Point to versioned GPL, thanks lintian.
* debian/gdm.postrm: Use "set -e" to conform to policy.
* Add debian/xterm.desktop: Reintroduce "failsafe xterm" session.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
#
3
 
# This is SORT OF LIKE an X session, but not quite.  You get a command as the
4
 
# first argument (it could be multiple words, so run it with "eval").  As a
5
 
# special case, the command can be:
6
 
#  failsafe - Run an xterm only
7
 
#  default - Run the appropriate Xclients startup (see the code below)
8
 
#  custom - Run ~/.xsession and if that's not available run 'default'
9
 
#
10
 
# (Note that other arguments could also follow, but only the command one is
11
 
# right now relevant and supported)
12
 
#
13
 
# The output is ALREADY redirected to .xsession-errors in GDM.  This way
14
 
# .xsession-errors actually gets more output such as if the PreSession script
15
 
# is failing.  This also prevents DoS attacks if some app in the users session
16
 
# can be prodded to dump lots of stuff on the stdout/stderr.  We wish to be
17
 
# robust don't we?  In case you wish to use an existing script for other DM's,
18
 
# you can just not redirect when GDMSESSION is set.  GDMSESSION will always
19
 
# be set from gdm.
20
 
#
21
 
# Also note that this is not run as a login shell, this is just executed.
22
 
#
23
 
# based on:
24
 
# $XConsortium: Xsession /main/10 1995/12/18 18:21:28 gildea $
25
 
 
26
 
PROGNAME=Xsession
27
 
 
28
 
message () {
29
 
  # pretty-print messages of arbitrary length; use xmessage if it
30
 
  # is available and $DISPLAY is set
31
 
  MESSAGE="$PROGNAME: $*"
32
 
  echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2
33
 
  if [ -n "$DISPLAY" ]; then
34
 
    if [ -n "$zenity" ]; then
35
 
      "$zenity" --info --text "`gettextfunc "$MESSAGE"`"
36
 
    elif [ -n "$xmessage" ]; then
37
 
      echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} | $xmessage -center -file -
38
 
    fi
39
 
  fi
40
 
}
41
 
 
42
 
message_nonl () {
43
 
  # pretty-print messages of arbitrary length (no trailing newline); use
44
 
  # xmessage if it is available and $DISPLAY is set
45
 
  MESSAGE="$PROGNAME: $*"
46
 
  echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2;
47
 
  if [ -n "$DISPLAY" ]; then
48
 
    if [ -n "$zenity" ]; then
49
 
      "$zenity" --info --text "`gettextfunc "$MESSAGE"`"
50
 
    elif [ -n "$xmessage" ]; then
51
 
      echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} | $xmessage -center -file -
52
 
    fi
53
 
  fi
54
 
}
55
 
 
56
 
errormsg () {
57
 
  # exit script with error
58
 
  message "$*"
59
 
  exit 1
60
 
}
61
 
 
62
 
internal_errormsg () {
63
 
  # exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message
64
 
  # One big call to message() for the sake of xmessage; if we had two then
65
 
  # the user would have dismissed the error we want reported before seeing the
66
 
  # request to report it.
67
 
  errormsg "$*" \
68
 
           "Please report the installed version of the \"xfree86-common\"" \
69
 
           "package and the complete text of this error message to" \
70
 
           "<debian-x@lists.debian.org>."
71
 
}
72
 
 
73
 
run_parts () {
74
 
  # until run-parts --noexec is implemented
75
 
  if [ -z "$1" ]; then
76
 
    internal_errormsg "run_parts() called without an argument."
77
 
  fi
78
 
  if [ ! -d "$1" ]; then
79
 
    internal_errormsg "run_parts() called, but \"$1\" does not exist or is" \
80
 
                      "not a directory."
81
 
  fi
82
 
  for F in $(ls $1); do
83
 
    if expr "$F" : '[[:alnum:]_-]\+$' > /dev/null 2>&1; then
84
 
      if [ -f "$1/$F" ]; then
85
 
        echo "$1/$F"
86
 
      fi
87
 
    fi
88
 
  done
89
 
}
90
 
# initialize variables for use by all session scripts
91
 
 
92
 
OPTIONFILE=/etc/X11/Xsession.options
93
 
 
94
 
SYSRESOURCES=/etc/X11/Xresources
95
 
USRRESOURCES=$HOME/.Xresources
96
 
 
97
 
SYSSESSIONDIR=/etc/X11/Xsession.d
98
 
USERXSESSION=$HOME/.xsession
99
 
USERXSESSIONRC=$HOME/.xsessionrc
100
 
ALTUSERXSESSION=$HOME/.Xsession
101
 
 
102
 
# this will go into the .xsession-errors along with all other echo's
103
 
# good for debugging where things went wrong
104
 
echo "$0: Beginning session setup..."
105
 
 
106
 
# First read /etc/profile and .profile
107
 
test -f /etc/profile && . /etc/profile
108
 
test -f "$HOME/.profile" && . "$HOME/.profile"
109
 
# Second read /etc/xprofile and .xprofile for X specific setup
110
 
test -f /etc/xprofile && . /etc/xprofile
111
 
test -f "$HOME/.xprofile" && . "$HOME/.xprofile"
112
 
 
113
 
# Translation stuff
114
 
if [ -x "/usr/lib/gdm/gdmtranslate" ] ; then
115
 
  gdmtranslate="/usr/lib/gdm/gdmtranslate"
116
 
else
117
 
  gdmtranslate=
118
 
fi
119
 
 
120
 
# Note that this should only go to zenity dialogs which always expect utf8
121
 
gettextfunc () {
122
 
  if [ "x$gdmtranslate" != "x" ] ; then
123
 
    "$gdmtranslate" --utf8 "$1"
124
 
  else
125
 
    echo "$1"
126
 
  fi
127
 
}
128
 
 
129
 
zenity=`which zenity 2>/dev/null`
130
 
xmessage=`which xmessage 2>/dev/null`
131
 
 
132
 
command="$1"
133
 
 
134
 
if [ -z "$command" ] ; then
135
 
  command=failsafe
136
 
fi
137
 
 
138
 
if [ x"$command" = xfailsafe ] ; then
139
 
  if [ -n "$zenity" ] ; then
140
 
    "$zenity" --info --text "`gettextfunc "This is the failsafe xterm session.  Windows now have focus only if you have your cursor above them.  To get out of this mode type 'exit' in the window in the upper left corner"`"
141
 
  else
142
 
    echo "$0: Starting the failsafe xterm session."
143
 
  fi
144
 
  exec xterm -geometry 80x24+0+0
145
 
fi
146
 
 
147
 
# clean up after xbanner
148
 
freetemp=`which freetemp 2>/dev/null`
149
 
if [ -n "$freetemp" ] ; then
150
 
        "$freetemp"
151
 
fi
152
 
 
153
 
usermodmap="$HOME/.Xmodmap"
154
 
userxkbmap="$HOME/.Xkbmap"
155
 
 
156
 
if [ -f "$userxkbmap" ]; then
157
 
    setxkbmap `cat "$userxkbmap"`
158
 
    XKB_IN_USE=yes
159
 
fi
160
 
 
161
 
# xkb and xmodmap don't play nice together
162
 
if [ -z "$XKB_IN_USE" ]; then
163
 
    if [ -f "$usermodmap" ]; then
164
 
       xmodmap "$usermodmap"
165
 
    fi
166
 
fi
167
 
 
168
 
unset XKB_IN_USE
169
 
 
170
 
# if GDM_LANG isn't first in LANGUAGE, then unset it.
171
 
if [ -n "$GDM_LANG" ]; then
172
 
    if [ -n "$LANGUAGE" ]; then
173
 
        if echo "$LANGUAGE" | grep -q -- "^$GDM_LANG"; then
174
 
           :
175
 
        else
176
 
           unset LANGUAGE
177
 
        fi
178
 
    fi
179
 
fi
180
 
 
181
 
# The default Debian session runs xsession first, so we just do that for
182
 
# "custom"
183
 
if [ "x$command" = "xcustom" ] ; then
184
 
  shift
185
 
  set default $*
186
 
fi
187
 
 
188
 
# use run-parts to source every file in the session directory; we source
189
 
# instead of executing so that the variables and functions defined above
190
 
# are available to the scripts, and so that they can pass variables to each
191
 
# other
192
 
SESSIONFILES=$(run_parts $SYSSESSIONDIR)
193
 
if [ -n "$SESSIONFILES" ]; then
194
 
  for SESSIONFILE in $SESSIONFILES; do
195
 
    . $SESSIONFILE
196
 
  done
197
 
fi
198
 
 
199
 
echo "$0: Executing $command failed, will try to run x-terminal-emulator"
200
 
 
201
 
if [ -n "$zenity" ] ; then
202
 
        "$zenity" --info --text "`gettextfunc "I could not start your session and so I have started the failsafe xterm session.  Windows now have focus only if you have your cursor above them.  To get out of this mode type 'exit' in the window in the upper left corner"`"
203
 
fi
204
 
 
205
 
exec x-terminal-emulator -geometry 80x24+0+0