# 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 ################ ugly hack ########################### mkdir -p $DESTDIR/etc/X11/xserver/ cp ${TCOS_CONF}/SecurityPolicy $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 if [ ! -e /usr/lib/xorg/modules/input/kbd_drv.so ]; then _echo " * xserver-xorg-input-kbd not installed, trying to use evdev keyboard" 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 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 # 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 # 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 # 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 $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* [ -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/ if [ -f ${TCOS_PKG_CACHE}/fix-nvidia-ati/libwfb.so ]; then rm -f $DESTDIR/usr/lib/xorg/modules/libwfb.so cpifexists ${TCOS_PKG_CACHE}/fix-nvidia-ati/libwfb.so /usr/lib/xorg/modules/ fi _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 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 < $DESTDIR/sbin/killX #!/bin/sh echo \"killing xorg process...\" killall Xorg 2>/dev/null EOF chmod +x $DESTDIR/sbin/killX cat < $DESTDIR/sbin/restartxorg #!/bin/sh killall Xorg 2>/dev/null EOF chmod +x $DESTDIR/sbin/restartxorg cat < $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 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 < $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 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 < $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 < $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 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