blob: 3a7c0a9963302f98f757637cb09fdb8d45b2c363 (
plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
#!/bin/sh
#
if [ "$1" = "prereqs" ]; then
exit 0
fi
quiet=n
. /scripts/functions
. /conf/tcos.conf
. /conf/tcos-run-functions
. /conf/tcos-modules.conf
# set limits in memory
. /bin/set-limits
# if break=startx STOP here
maybe_break startx
modprobe -q mousedev 2>&1 >> /tmp/initramfs.debug
modprobe -q psmouse 2>&1 >> /tmp/initramfs.debug
modprobe -q agpgart 2>&1 >> /tmp/initramfs.debug
# Create magic cookie
# http://www.xs4all.nl/~zweije/xauth-6.html
# cookie=$(dd if=/dev/urandom count=1 2>/dev/null | md5sum | awk '{print $1}' |sed -e 's/^/add :0 . /')
# cookie=$(mcookie)
# xauth -f /root/.Xauthority -q ${cookie}
if [ ! -f $XAUTHORITY ]; then
value=0
log_begin_msg "Creating magic cookie for X"
_log "STARTX creating cookie..."
#MYIP=$(awk -F"=" '/^ip=/ {print $2}' /tmp/net.data)
MYIP=$(getinfo.sh -i NETWORK_IP)
cookie=$(mcookie || value=1)
xauth -f $XAUTHORITY -q add :0 MIT-MAGIC-COOKIE-1 $cookie 2>> /tmp/initramfs.debug || value=1
xauth -f $XAUTHORITY -q add localhost:0 MIT-MAGIC-COOKIE-1 $cookie 2>> /tmp/initramfs.debug || value=1
xauth -f $XAUTHORITY -q add localhost.localdomain:0 MIT-MAGIC-COOKIE-1 $cookie 2>> /tmp/initramfs.debug || value=1
xauth -f $XAUTHORITY -q add $(hostname):0 MIT-MAGIC-COOKIE-1 $cookie 2>> /tmp/initramfs.debug || value=1
xauth -f $XAUTHORITY -q add ${MYIP}:0 MIT-MAGIC-COOKIE-1 $cookie 2>> /tmp/initramfs.debug || value=1
# for new LTSPFS
echo $cookie > /var/run/ltspfs_token
#xauth list >> /tmp/initramfs.debug
_log "STARTX end cookie"
log_end_msg $value
fi
# read some settings from cmdline
# DOCUMENTME xdriver=foo | set default X driver (auto, vesa , via, vmware, ...)
xdriver=$(read_cmdline_var "xdriver" "")
# DOCUMENTME xres=bar | set default X resolution (1024x768, 800x600, 640x480, ...)
xres=$(read_cmdline_var "xres" "")
XORG_CFG_APPEND=""
if [ "${xdriver}" != "" ]; then
XORG_CFG_APPEND="${XORG_CFG_APPEND} --xdriver=${xdriver}"
fi
if [ "${xres}" != "" ]; then
XORG_CFG_APPEND="${XORG_CFG_APPEND} --xres=${xres}"
fi
if [ ! -f /etc/X11/xorg.conf ]; then
# generate xorg.conf
log_begin_msg "Generating xorg.conf"
configurexorg --verbose --newsettings ${XORG_CFG_APPEND} --outputfile=/etc/X11/xorg.conf 2>> /tmp/initramfs.debug
log_end_msg $?
else
log_begin_msg "xorg.conf exists, no overwrite"
log_end_msg $?
fi
# DOCUMENTME startx=X | set default X session (R=remote L=local N=none, F=freenx, S=sshX)
startx=$TCOS_XORG_TYPE
if [ $(cat /conf/mysettings.conf | wc -l) -gt 1 ] ;then
startx_type=$(grep ^xsession /conf/mysettings.conf | awk -F "=" '{print $2}' | sed s/'"'/''/g )
case $type in
XDMCP)
startx=R
;;
local)
startx=L
;;
sshX)
startx=S
;;
FreeNX)
startx=F
;;
rDesktop)
startx=W
;;
esac
fi
# always overwrite with cmdline
startx=$(read_cmdline_var "startx" "${startx}")
if [ "$startx" = "L" ] ; then
ln -s /sbin/startlocalx /sbin/startx
startlocalx &
elif [ "$startx" = "R" ] ; then
ln -s /sbin/startremotex /sbin/startx
startremotex &
elif [ "$startx" = "F" ] ; then
ln -s /sbin/startnx /sbin/startx
startnx &
elif [ "$startx" = "S" ] ; then
ln -s /sbin/startsshx /sbin/startx
startsshx &
elif [ "$startx" = "W" ] ; then
ln -s /sbin/startrdesktop /sbin/startx
startrdesktop &
fi
exit 0
|