#!/bin/bash

if [ $UID != 0 ];
then
	if [ -f /tmp/.X0-lock ];
		then echo -e "DISPLAY found. XServer $XORG_VER on tty5"
		exit 0
	else
		clear
		echo -e "XServer $XORG_VER running, ALT+F5 -> switch to X11, ALT+F1-F4 -> switch to virtual terminals" 
		xinit Xorg -logverbose 5 -br -nolisten tcp -dpi 96 >&/dev/null; 
		/sbin/modprobe -r nvidia; 
		deallocvt;
		del;
		setleds +num;
		clear; 
		echo "XServer $XORG_VER stopped"
	fi	


else
	echo "NEVER use X11 as root!"

fi

