def __init__(self): #Set the Glade file self.gladefile = "src/xensor.glade" self.wTree = gtk.glade.XML(self.gladefile) #set defaults self.wTree.get_widget("name").set_text("domU") self.wTree.get_widget("distro").set_active(0) self.wTree.get_widget("release").set_active(0) #get xen kernels klst = util.pipe_command("ls /boot | grep vmlinuz.*xen") if len(klst): for kernel in klst: self.wTree.get_widget("kernel").append_text("/boot/" + kernel[0:-1]) self.wTree.get_widget("kernel").remove_text(0) self.wTree.get_widget("kernel").set_active(0) self.wTree.get_widget("path").set_text("/var/lib/xen/images/domU.img") self.wTree.get_widget("fs").set_active(0) self.wTree.get_widget("swap").set_text("/var/lib/xen/images/domU-swp.img") self.wTree.get_widget("size").set_text("4") self.wTree.get_widget("swapsize").set_text("256") self.wTree.get_widget("mem").set_text("128") self.wTree.get_widget("arch").set_active(0) self.wTree.get_widget("location").set_text("http://ftp.egr.msu.edu/debian") #assign our event handlers dic = { "on_install_clicked" : self.do_install, "on_distro_changed" : self.update_release, "on_xensor_destroy" : gtk.main_quit } self.wTree.signal_autoconnect(dic)
def _disable_ttys(self, mnt_pt): util.run_command("rm -f %s/etc/event.d/tty[2-6]" % mnt_pt) lines = util.pipe_command("cat %s/etc/event.d/tty1" % mnt_pt) if self._release == "feisty": lines[-1] = 'exec /sbin/getty -L 9600 console vt100\n' else: lines[-1] = 'respawn /sbin/getty -L 9600 console vt100\n' fd = None try: fd = open("%s/etc/event.d/tty1" % mnt_pt, "w") fd.writelines(lines) finally: if fd is not None: fd.close()
def _disable_ttys(self, mnt_pt): util.run_command("rm -f %s/etc/event.d/tty[2-6]" % mnt_pt) lines = util.pipe_command("cat %s/etc/event.d/tty1" % mnt_pt) if self._release == "feisty": lines[-1] = "exec /sbin/getty -L 9600 console vt100\n" else: lines[-1] = "respawn /sbin/getty -L 9600 console vt100\n" fd = None try: fd = open("%s/etc/event.d/tty1" % mnt_pt, "w") fd.writelines(lines) finally: if fd is not None: fd.close()
def __init__(self): #Set the Glade file self.gladefile = "src/xensor.glade" self.wTree = gtk.glade.XML(self.gladefile) #set defaults self.wTree.get_widget("name").set_text("domU") self.wTree.get_widget("distro").set_active(0) self.wTree.get_widget("release").set_active(0) #get xen kernels klst = util.pipe_command("ls /boot | grep vmlinuz.*xen") if len(klst): for kernel in klst: self.wTree.get_widget("kernel").append_text("/boot/" + kernel[0:-1]) self.wTree.get_widget("kernel").remove_text(0) self.wTree.get_widget("kernel").set_active(0) self.wTree.get_widget("path").set_text("/var/lib/xen/images/domU.img") self.wTree.get_widget("fs").set_active(0) self.wTree.get_widget("swap").set_text( "/var/lib/xen/images/domU-swp.img") self.wTree.get_widget("size").set_text("4") self.wTree.get_widget("swapsize").set_text("256") self.wTree.get_widget("mem").set_text("128") self.wTree.get_widget("arch").set_active(0) self.wTree.get_widget("location").set_text( "http://ftp.egr.msu.edu/debian") #assign our event handlers dic = { "on_install_clicked": self.do_install, "on_distro_changed": self.update_release, "on_xensor_destroy": gtk.main_quit } self.wTree.signal_autoconnect(dic)