forked from dnschneid/crouton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xinit
executable file
·34 lines (29 loc) · 1.08 KB
/
xinit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh -e
# Copyright (c) 2016 The crouton Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Adds a :# to the xinit command line, where # is the first available display
# number. Also adds the -- to the command line and references the global
# xserverrc if it isn't already there. By putting this in /usr/local/bin, PATH
# will prefer it and scripts that call xinit will automagically work.
xserverrc='/etc/X11/xinit/xserverrc'
dash='--'
for arg in "$@"; do
if [ -z "$dash" ]; then
# Check if there's a xserverrc specified.
if [ ! "${arg#/}" = "$arg" ]; then
xserverrc=''
fi
break
elif [ "$arg" = '--' ]; then
dash=
fi
done
# Never use display :0 (confusing if aura does not use X11)
disp=1
while [ -f "/tmp/.X$disp-lock" ]; do
disp=$((disp+1))
done
# If possible, switch to VT1 to avoid strangeness when launching from VT2
chvt 1 2>/dev/null || true
exec /usr/bin/xinit /usr/local/bin/croutonxinitrc-wrapper "$@" $dash $xserverrc ":$disp"