#!/usr/bin/python import sys, getopt, os (args, extra) = getopt.getopt(sys.argv[1:], 'p:gTtdr:', [ 'gui', 'text', 'test', 'force', 'debug', 'rootpath=', 'testpath=' ]) mode = None test = 0 force = 0 debug = 0 rootPath = '/mnt' runLive = 0 for n in args: (str, arg) = n if (str == '-g' or str == '--gui'): mode = 'g' elif (str == '-T' or str == '--text'): mode = 't' elif (str == '-t' or str == '--test'): test = 1 elif (str == '-d' or str == '--debug'): debug = 1 elif (str == '-r' or str == '--rootpath'): rootPath = arg runLive = 1 elif (str == '-p' or str == '--imagepath'): imagepath = arg elif (str == '--force'): force = 1 if (debug): import pdb pdb.set_trace() 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') sys.path.append('rpmmodule') sys.path.append('isys') elif (mode == None): try: f = open('/dev/fb0', 'r') f.close() mode = 'g' except: mode = 't' # imports after setting up the path from image import InstallMethod import rpm import lilo from todo import ToDo import isys 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'): from gui import InstallInterface elif (mode == 't'): from text import InstallInterface else: print "No mode was specified" sys.exit(1) method = InstallMethod(imagepath) intf = InstallInterface() todo = ToDo(intf, method, rootPath, runLive) intf.run(todo) todo.installSystem() del intf l = lilo.LiloConfiguration() l.addEntry('boot', '/dev/hda') l.addEntry('map', '/boot/map') l.addEntry('install', '/boot/boot.b') l.addEntry('prompt') l.addEntry('timeout', 50) s = lilo.LiloConfiguration() s.addEntry('label', 'linux') s.addEntry('root', '/dev/hda8') s.addEntry('read-only') l.addImage('/boot/vmlinuz', s) #l.write('/etc/lilo.conf')