This file is indexed.

/usr/share/tcos/hooks-addons/50xorg is in initramfs-tools-tcos 0.89.86.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# hooks addon of Xorg
# compatible with Xorg 7.x


if [ -z "$TCOS_XFBDEV" ] && [ $TCOS_XORG ]; then
# Xorg stuff
 stat_before
if [ "$(pathof Xorg)" = /usr/bin/Xorg ]; then
   XORG=7
   #_echo "   USING Xorg 7.X dirs"
   XORG_PATH=/usr/bin
else
   _echo "   **ERROR** Xorg not found"
   exit
fi


cpifexists $XORG_PATH/Xorg    /usr/bin
cpifexists $XORG_PATH/xauth   /usr/bin
cpifexists $XORG_PATH/mcookie /usr/bin
cpifexists $XORG_PATH/xhost   /usr/bin
cpifexists $XORG_PATH/xterm   /usr/bin
if [ -e $XORG_PATH/twm ]; then
  cpifexists $XORG_PATH/twm     /usr/bin
else
  _echo "    WARNING: twm package not found"
fi

# some xutils
cpifexists $XORG_PATH/xset     /usr/bin
cpifexists $XORG_PATH/xsetroot /usr/bin
cpifexists $XORG_PATH/sessreg  /usr/bin
cpifexists $XORG_PATH/xkbcomp  /usr/bin

# bin to wait until Xorg is started
cpifexists ${TCOS_BINS}/waitforX  /usr/bin/


cpifexists ${TCOS_BINS}/get_vga_vendor  /usr/bin/

mkdir -p $DESTDIR/var/log
mkdir -p $DESTDIR/etc/X11/xserver
mkdir -p $DESTDIR/etc/X11/PreRun
mkdir -p $DESTDIR/etc/X11/xserver/


# copy xorg.conf template and generator
cp ${TCOS_CONF}/xorg.conf.tpl ${DESTDIR}/conf/xorg.conf.tpl
install -m 755 ${TCOS_BINS}/configurexorg ${DESTDIR}/sbin/configurexorg
install -m 755 ${TCOS_BINS}/tryXorg.sh    ${DESTDIR}/sbin/tryXorg


# new xorg.conf.d configuration files
XORG_CONF_PATH=/usr/lib/X11/xorg.conf.d/
[ -d /usr/share/X11/xorg.conf.d ] && XORG_CONF_PATH=/usr/share/X11/xorg.conf.d/

for f in $(find $XORG_CONF_PATH -type f 2>/dev/null); do
  mkdir -p $DESTDIR/$XORG_CONF_PATH
  cp $f $DESTDIR/$XORG_CONF_PATH
done


# include xorg PCI IDS file
mkdir -p ${DESTDIR}/usr/share/xserver-xorg/pci/
cpifexists ${TCOS_DIR}/inc/xorg.pciids /usr/share/xserver-xorg/pci/

mkdir -p  $DESTDIR/usr/lib/xorg/modules/

# new in xorg 1.5
[ -e /usr/lib/xorg/protocol.txt ] && cpifexists /usr/lib/xorg/protocol.txt /usr/lib/xorg/

# FONTS modules
[ -d /usr/lib/xorg/modules/fonts ] && copydir /usr/lib/xorg/modules/fonts /usr/lib/xorg/modules/


if [ -d /usr/share/fonts/X11 ]; then
   TCOS_FONTS_PATH="/usr/share/fonts/X11"
   TCOS_FONT_EXTENSION=".gz"

elif [ ! -L /usr/lib/X11/fonts ]; then
   TCOS_FONTS_PATH="/usr/lib/X11/fonts"
   TCOS_FONT_EXTENSION=""


else
   _echo ""
   _echo "ERROR: Cant' locate fonts dir, XFS is deprecated, BUG!!!"
   _echo ""
   TCOS_FONTS_PATH=""
   exit
fi


if [ "$TCOS_FONTS_PATH" != "" ]; then
    mkdir -p $DESTDIR/$TCOS_FONTS_PATH/misc
    mkdir -p $DESTDIR/$TCOS_FONTS_PATH/100dpi

    cat << EOF > $DESTDIR/$TCOS_FONTS_PATH/misc/fonts.alias
fixed        -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
7x14         -misc-fixed-medium-r-semicondensed--14-120-75-75-c-60-iso8859-1
EOF
    cpifexists $TCOS_FONTS_PATH/misc/6x13-ISO8859-1.pcf${TCOS_FONT_EXTENSION} $TCOS_FONTS_PATH/misc
    cpifexists $TCOS_FONTS_PATH/misc/cursor.pcf${TCOS_FONT_EXTENSION}         $TCOS_FONTS_PATH/misc
    mkfontdir $DESTDIR/$TCOS_FONTS_PATH/misc

    cpifexists $TCOS_FONTS_PATH/100dpi/helvB24-ISO8859-1.pcf${TCOS_FONT_EXTENSION} $TCOS_FONTS_PATH/100dpi
    cpifexists $TCOS_FONTS_PATH/100dpi/helvB08-ISO8859-1.pcf${TCOS_FONT_EXTENSION} $TCOS_FONTS_PATH/100dpi
    mkfontdir $DESTDIR/$TCOS_FONTS_PATH/100dpi
fi

# PCIIDS
if [ -d /usr/share/xserver-xorg/pci ] ; then
 mkdir -p $DESTDIR/usr/share/xserver-xorg/
 copydir /usr/share/xserver-xorg/pci /usr/share/xserver-xorg/
fi


# MODULES
mkdir -p $DESTDIR/usr/lib/xorg/modules/input/

for _ext in $(ls /usr/lib/xorg/modules/lib*so); do
    cpifexists $_ext /usr/lib/xorg/modules/
done

for _inp in $(ls /usr/lib/xorg/modules/input/*); do
    cpifexists $_inp /usr/lib/xorg/modules/input/
done

if  [ -d /usr/lib/xorg/modules/linux ]; then
  mkdir -p  $DESTDIR/usr/lib/xorg/modules/linux

  for _lnx in $(ls /usr/lib/xorg/modules/linux/lib*so); do
    cpifexists $_lnx /usr/lib/xorg/modules/linux/
  done
fi

# DRIVERS and EXTENSIONS
mkdir -p  $DESTDIR/usr/lib/xorg/modules/drivers
# essential xorg driver
cpifexists /usr/lib/xorg/modules/drivers/vesa_drv.so /usr/lib/xorg/modules/drivers/


if [ $TCOS_XORG_ALLDRIVERS ]; then
    driver_dir=/usr/lib/xorg/modules/drivers
    _echo "  Xorg: installing all drivers..."
    for _drv in $(ls ${driver_dir}/*so|grep -v -e nvidia -e vmware -e vbox); do
        cpifexists $_drv ${driver_dir}/
    done
    rm -f $DESTDIR/${driver_dir}/nvidia_drv.so
fi

mkdir -p  $DESTDIR/usr/lib/xorg/modules/extensions
# copy linked libs
for _file in $(ls /usr/lib/xorg/modules/extensions/lib*.so| grep -v glx); do
    cpifexists $_file /usr/lib/xorg/modules/extensions/
done

# delete nvidia/ati glx module
rm -f $DESTDIR/usr/lib/xorg/modules/extensions/libglx.so* 
rm -f $DESTDIR/usr/lib/xorg/modules/libwfb.so
rm -f $DESTDIR/usr/lib/xorg/modules/libnvidia-wfb.so.*
rm -rf $DESTDIR/usr/lib/xorg/modules/extensions/libGLcore.so
rm -rf $DESTDIR/usr/lib/libnvidia-*
# for multiarch
rm -rf $DESTDIR/usr/lib/*/libnvidia-*

# delete linked nvidia driver (10Mb)
rm -f $DESTDIR/usr/lib/libGL*

LIBGL_PATH=/usr/lib/
if [ -e /usr/lib/mesa/libGL.so.1 ]; then
  LIBGL_PATH=/usr/lib/mesa/
fi

# multiarch support
[ -e /usr/lib/i386-linux-gnu/libGL.so.1 ] && LIBGL_PATH=/usr/lib/i386-linux-gnu/
[ -e /usr/lib/x86_64-linux-gnu/libGL.so.1 ] && LIBGL_PATH=/usr/lib/x86_64-linux-gnu/

# delete vnc extension
rm -f $DESTDIR/usr/lib/xorg/modules/extensions/libvnc.so

if [ $TCOS_XORG_OPENGL ]; then
 _echo "    * OpenGL support is ENABLED"
 if [ "$(strings $LIBGL_PATH/libGL.so.1|grep -c NVIDIA)" != 0 ] || \
       [ "$(strings /usr/lib/xorg/modules/extensions/libglx.so 2>&1 |grep -c NVIDIA)" != 0 ] || \
       [ "$(strings $LIBGL_PATH/libGL.so.1|grep -c -i fgl)" != 0 ]; then

   if [ -d ${TCOS_PKG_CACHE}/fix-nvidia-ati ]; then
      rm -rf $DESTDIR/usr/lib/xorg/modules/libglx.so*
      rm -f $DESTDIR/usr/lib/xorg/modules/libnvidia-wfb.so.*
      [ -e ${TCOS_PKG_CACHE}/fix-nvidia-ati/libGLcore.so ] && \
           cpifexists ${TCOS_PKG_CACHE}/fix-nvidia-ati/libGLcore.so /usr/lib/xorg/modules/extensions/

      cpifexists ${TCOS_PKG_CACHE}/fix-nvidia-ati/libglx.so    /usr/lib/xorg/modules/extensions/
      cpifexists ${TCOS_PKG_CACHE}/fix-nvidia-ati/libGL.so.1.2   /usr/lib/
  	  [ -e /usr/lib/libGLU.so.1 ] && cpifexists /usr/lib/libGLU.so.1 /usr/lib/
      [ -f ${TCOS_PKG_CACHE}/fix-nvidia-ati/libwfb.so ] && \
          cpifexists ${TCOS_PKG_CACHE}/fix-nvidia-ati/libwfb.so    /usr/lib/xorg/modules/
      _echo "       * OpenGL use cached fix-nvidia-ati libs"
   else
      _echo " ********************************************** "
      _echo "    WARNING: NVIDIA/ATI libs found !!!!!!       "
      _echo "                                                "
      _echo "      Please fix with: gentcos -fix-nvidia-ati  "
      _echo "         or uninstall nvidia/ati drivers        "
      _echo "                                                "
      _echo "  OpenGL support will not work on thin clients  "
      _echo " ********************************************** "
   fi

 else
  cpifexists /usr/lib/xorg/modules/extensions/libglx.so    /usr/lib/xorg/modules/extensions/
  [ -e /usr/lib/xorg/modules/extensions/libGLcore.so ] && \
       cpifexists /usr/lib/xorg/modules/extensions/libGLcore.so /usr/lib/xorg/modules/extensions/
  cpifexists $LIBGL_PATH/libGL.so.1  /usr/lib/
  [ -e /usr/lib/libGLcore.so.1 ] && cpifexists /usr/lib/libGLcore.so.1  /usr/lib/
  [ -e /usr/lib/libGLU.so.1 ] && cpifexists /usr/lib/libGLU.so.1 /usr/lib/
 fi # end of NVIDIA/ATI strings

if [ -e $DESTDIR/usr/lib/libGL.so.1 ];then
  if [ "$(strings $DESTDIR/usr/lib/libGL.so.1|grep -c NVIDIA)" != 0 ] || \
    [ "$(strings $DESTDIR/usr/lib/libGL.so.1|grep -c -i fgl)" != 0 ]; then
    rm -rf $DESTDIR/usr/lib/libGL.so.1
  fi
fi

if [ -e $DESTDIR/usr/lib/libGLcore.so.1 ];then
  if [ "$(strings $DESTDIR/usr/lib/libGLcore.so.1|grep -c NVIDIA)" != 0 ] || \
    [ "$(strings $DESTDIR/usr/lib/libGLcore.so.1|grep -c -i fgl)" != 0 ]; then
    rm -rf $DESTDIR/usr/lib/libGLcore.so.1
  fi
fi

else
_echo "    * OpenGL support is not enabled!!"
fi # end of $TCOS_XORG_OPENGL


# keyboard and keymap

XORG_XKB_DIR=/usr/share/X11/xkb/
[ ! -d "${XORG_XKB_DIR}" ] && XORG_XKB_DIR=/etc/X11/xkb/
mkdir -p ${DESTDIR}/usr/share/X11

# copy all dir (some files not needed)
cp -ra ${XORG_XKB_DIR} ${DESTDIR}/usr/share/X11

# delete symlinks
find ${DESTDIR}/usr/share/X11/ -type l | xargs rm -f --

# keymap DB
[ -e /usr/share/X11/XKeysymDB ] && cpifexists /usr/share/X11/XKeysymDB /usr/share/X11/




# xorg locale
mkdir -p $DESTDIR/usr/share/locale
mkdir -p $DESTDIR/usr/lib/X11
[ -d /usr/lib/X11/locale ] && copydir /usr/lib/X11/locale/          /usr/lib/X11/
#copydir /usr/lib/X11/config/          /usr/lib/X11/
[ -e /etc/X11/rgb.txt ] && cpifexists /etc/X11/rgb.txt              /etc/X11/



stat_after "Xorg"

fi # end of TCOS_XORG
############### XORG SCRIPTS ####################






cat <<EOF > $DESTDIR/sbin/killX
#!/bin/sh
echo \"killing xorg process...\"
killall Xorg 2>/dev/null
EOF
chmod +x $DESTDIR/sbin/killX

cat <<EOF > $DESTDIR/sbin/restartxorg
#!/bin/sh

killall Xorg 2>/dev/null

EOF
chmod +x $DESTDIR/sbin/restartxorg


cat <<EOF > $DESTDIR/sbin/startlocalx
#!/bin/sh
export DISPLAY=:0
export HOME=/root

if [ -f \$XAUTHORITY ]; then
  TCOS_XORG_OPTS="\$TCOS_XORG_OPTS -auth \$XAUTHORITY"
fi

/sbin/tryXorg --xorgopts="\${TCOS_XORG_OPTS}" &

waitforX || exit
sleep 1

xterm  >> /tmp/initramfs.debug 2>&1 &
twm  >> /tmp/initramfs.debug 2>&1 &

# set background color
xsetroot -cursor_name left_ptr -solid "#338899"

EOF
chmod +x $DESTDIR/sbin/startlocalx

cat <<EOF > $DESTDIR/sbin/startnx
#!/bin/sh
. /conf/tcos.conf
. /conf/tcos-run-functions
SERVER=\$(read_server "xdmcp-server")
export DISPLAY=:0
export HOME=/root
export USER_NX_DIR=/root/.nx

if [ -x /usr/bin/ssh ]; then
  ssh -N -p 2022 -l mario -C -2 -L 5000:localhost:2022 ${SERVER}
fi

if [ -f $\XAUTHORITY ]; then
  TCOS_XORG_OPTS="\$TCOS_XORG_OPTS -auth \$XAUTHORITY"
fi

/sbin/tryXorg  --xorgopts="\${TCOS_XORG_OPTS}" &

waitforX || exit
sleep 1

# no window manager for freenx
#twm  >> /tmp/initramfs.debug 2>&1 &

sleep 2
# set background color
xsetroot -cursor_name left_ptr -solid "#338899"

/usr/NX/bin/nxclient  >> /tmp/initramfs.debug 2>&1
xterm

EOF
chmod +x $DESTDIR/sbin/startnx

cat <<EOF > $DESTDIR/sbin/startremotex
#!/bin/sh
. /conf/tcos.conf
. /conf/tcos-run-functions
SERVER=\$(read_server "xdmcp-server")
export DISPLAY=:0

if [ -f \$XAUTHORITY ]; then
  TCOS_XORG_OPTS="\$TCOS_XORG_OPTS -auth \$XAUTHORITY"
fi

/sbin/tryXorg --server=\${SERVER} --xorgopts="\${TCOS_XORG_OPTS} -query \${SERVER}" &

EOF
chmod +x $DESTDIR/sbin/startremotex


# FIXME, not documented

cat <<EOF > $DESTDIR/sbin/startsshx
#!/bin/sh
. /conf/tcos.conf
. /conf/tcos-run-functions
SERVER=\$(read_server "xdmcp-server")
export DISPLAY=:0
export HOME=/root

if [ -f \$XAUTHORITY ]; then
  TCOS_XORG_OPTS="\$TCOS_XORG_OPTS -auth \$XAUTHORITY"
fi

/sbin/tryXorg --xorgopts="\${TCOS_XORG_OPTS}" &

waitforX || exit
sleep 1

remoteuser=\$(read_cmdline_var "sshuser" "root")
remotesshhost=\$(read_cmdline_var "sshhost" "\${SERVER}")
remotesshport=\$(read_cmdline_var "sshport" "2022")
# gnome-session, startkde , startxfce4
remotesshdesktop=\$(read_cmdline_var "sshdesktop" "startxfce4")

while [ 1 ]; do
 xterm -e "echo \"SSH \${remoteuser}@\${remotesshhost} -p \${remotesshport}...\" ; ssh -X -C -f -l \${remoteuser} \${remotesshhost} -p \${remotesshport} \${remotesshdesktop}"
done

EOF
chmod +x $DESTDIR/sbin/startsshx