diff options
-rwxr-xr-x | anaconda | 25 |
1 files changed, 23 insertions, 2 deletions
@@ -2,10 +2,11 @@ import sys, getopt, os -(args, extra) = getopt.getopt(sys.argv[1:], 'gTt', [ 'gui', 'text', 'test' ]) +(args, extra) = getopt.getopt(sys.argv[1:], 'gTt', [ 'gui', 'text', 'test', 'force' ]) mode = None test = 0 +force = 0 for n in args: (str, arg) = n @@ -15,13 +16,33 @@ for n in args: mode = 't' elif (str == '-t' or str == '--test'): test = 1 + elif (str == '--force'): + force = 1 -if (not test and os.getpid() > 10): +if (not test and os.getpid() > 10 and not force): print "you're running me on a live system! that's incredibly stupid." sys.exit(1) if (test): sys.path.append('balkan') +elif (mode == None): + try: + f = open('/dev/fb0', 'r') + f.close() + mode = 'g' + except: + mode = 't' + +if (mode == 'g' and not os.environ.has_key('DISPLAY')): + os.environ['DISPLAY'] = ':0' + server = os.fork() + if (not server): + os.execv('/usr/X11R6/bin/XF86_FBDev', ['/usr/X11R6/bin/XF86_FBDev']) + child = os.fork() + if (child): + os.waitpid(child, 0) + os.kill(server, 15) + sys.exit(0) if (mode == 'g'): import gui |