#!/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 echo 92 > /tmp/progress update_progress # 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=$(grep 'fixed-address' /var/lib/dhcp/dhclient.leases | head -1| awk '{print $2}' | sed s/";"//g) 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 echo 94 > /tmp/progress update_progress # 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 echo 96 > /tmp/progress update_progress # 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}" != "N" ]; then kill_splash fi 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 echo 98 > /tmp/progress update_progress exit 0