livecd-bashrc: Avoid a startx race by restricting to tty1
authorW. Trevor King <wking@tremily.us>
Mon, 4 Mar 2013 02:33:02 +0000 (21:33 -0500)
committerBrian Dolbec <dolsen@gentoo.org>
Thu, 6 Jun 2013 03:45:04 +0000 (20:45 -0700)
Otherwise several virtual consoles may notice the existence of
/etc/startx, and spawn simultaneous X servers.  This way we only spawn
a single X server, regardless of timing.

A better solution here is probably to add a "start" or "x-server"
service to /etc/init.d/, but that's more work than I'm up to at the
moment.

livecd/files/livecd-bashrc

index 983e657d132f0c9c9ec712f073464d93db4c72ed..7abfbd4f5c6947b747731c9c7569993225e28045 100644 (file)
@@ -4,7 +4,7 @@ if [ ! "$(grep nox /proc/cmdline)" ]
 then
        if [ -x /usr/bin/X ]
        then
-               if [ -e /etc/startx ]
+               if [ -e /etc/startx ] && [ "$(tty)" == /dev/tty1 ]
                then
                        rm -f /etc/startx
                        ##STARTX