/[gli]/branches/overhaul/src/fe/gtk/Bootloader.py
Gentoo

Contents of /branches/overhaul/src/fe/gtk/Bootloader.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1623 - (show annotations) (download) (as text)
Fri Jan 19 10:19:38 2007 UTC (7 years, 9 months ago) by agaffney
File MIME type: text/x-python
File size: 7602 byte(s)
remove Help button
rearrange Stage screen
1 # Copyright 1999-2005 Gentoo Foundation
2 # This source code is distributed under the terms of version 2 of the GNU
3 # General Public License as published by the Free Software Foundation, a copy
4 # of which can be found in the main directory of this project.
5
6 import gtk
7 import gobject
8 import GLIScreen
9
10 class Panel(GLIScreen.GLIScreen):
11
12 title = "Bootloader"
13 active_selection = None
14 boot_loaders = {}
15 _helptext = """
16 <b><u>Bootloader</u></b>
17
18 The bootloaders available depend on the architecture to be installed. For x86,
19 the two bootloaders available are grub and lilo. In amd64, only grub is
20 available. Gentoo recommends grub.
21
22 For those who still like lilo, it is available. Lilo will also detect windows
23 partitions (this support for grub coming soon).
24
25 You almost always will want to check the Install in MBR option, unless you do
26 not want your system to be bootable using your bootloader.
27
28 Set the boot drive to whatever hard drive is set to boot first on your computer.
29
30 If you have any extra kernel parameters you want to add, such as "doscsi", enter
31 them in the textbox. Possible parameters can be found in the Handbook. Usually
32 you will just leave this blank.
33 """
34
35 def __init__(self, controller):
36 GLIScreen.GLIScreen.__init__(self, controller)
37 vert = gtk.VBox(False, 0)
38 vert.set_border_width(10)
39
40 content_str = """Here, you will select which bootloader you would like to use. Each option has
41 a brief description beside it.
42 """
43 content_label = gtk.Label(content_str)
44 vert.pack_start(content_label, expand=False, fill=False, padding=0)
45
46 self.boot_loaders['grub'] = gtk.RadioButton(None, "grub")
47 self.boot_loaders['grub'].set_name("grub")
48 self.boot_loaders['grub'].connect("toggled", self.loader_selected, "grub")
49 self.boot_loaders['grub'].set_size_request(125, -1)
50 hbox = gtk.HBox(False, 0)
51 hbox.pack_start(self.boot_loaders['grub'], expand=False, fill=False, padding=5)
52 tmplabel = gtk.Label("This is the more popular bootloader. If you are installing on AMD64, this is your only choice")
53 tmplabel.set_line_wrap(True)
54 hbox.pack_start(tmplabel, expand=False, fill=False, padding=20)
55 vert.pack_start(hbox, expand=False, fill=False, padding=20)
56
57 self.boot_loaders['lilo'] = gtk.RadioButton(self.boot_loaders['grub'], "lilo")
58 self.boot_loaders['lilo'].set_name("lilo")
59 self.boot_loaders['lilo'].connect("toggled", self.loader_selected, "lilo")
60 self.boot_loaders['lilo'].set_size_request(125, -1)
61 hbox = gtk.HBox(False, 0)
62 hbox.pack_start(self.boot_loaders['lilo'], expand=False, fill=False, padding=5)
63 tmplabel = gtk.Label("This bootloader isn't as flexible as grub, but some people still prefer it")
64 tmplabel.set_line_wrap(True)
65 hbox.pack_start(tmplabel, expand=False, fill=False, padding=20)
66 vert.pack_start(hbox, expand=False, fill=False, padding=15)
67
68 self.boot_loaders['none'] = gtk.RadioButton(self.boot_loaders['grub'], "None")
69 self.boot_loaders['none'].set_name("none")
70 self.boot_loaders['none'].connect("toggled", self.loader_selected, "none")
71 self.boot_loaders['none'].set_size_request(125, -1)
72 hbox = gtk.HBox(False, 0)
73 hbox.pack_start(self.boot_loaders['none'], expand=False, fill=False, padding=5)
74 tmplabel = gtk.Label("Choose this if you don't want a bootloader installed")
75 tmplabel.set_line_wrap(True)
76 hbox.pack_start(tmplabel, expand=False, fill=False, padding=20)
77 vert.pack_start(hbox, expand=False, fill=False, padding=15)
78
79 self.check_install_in_mbr = gtk.CheckButton("Install in MBR")
80 self.check_install_in_mbr.connect("toggled", self.mbr_selected)
81 self.check_install_in_mbr.set_size_request(125, -1)
82 hbox = gtk.HBox(False, 0)
83 hbox.pack_start(self.check_install_in_mbr, expand=False, fill=False, padding=5)
84 tmplabel = gtk.Label("This controls whether the bootloader is installed in the MBR or not")
85 tmplabel.set_line_wrap(True)
86 hbox.pack_start(tmplabel, expand=False, fill=False, padding=20)
87 vert.pack_start(hbox, expand=False, fill=False, padding=15)
88
89 hbox = gtk.HBox(False, 0)
90 tmplabel = gtk.Label("Boot Drive:")
91 tmplabel.set_alignment(0.0, 0.5)
92 tmplabel.set_size_request(160, -1)
93 hbox.pack_start(tmplabel, expand=False, fill=False, padding=0)
94 # self.boot_device_data = gtk.ListStore(gobject.TYPE_STRING)
95 # self.boot_device_combo = gtk.ComboBox(self.boot_drive_data)
96 self.boot_device_combo = gtk.combo_box_new_text()
97 hbox.pack_start(self.boot_device_combo, expand=False, fill=False, padding=15)
98 vert.pack_start(hbox, expand=False, fill=False, padding=15)
99
100 hbox = gtk.HBox(False, 0)
101 tmplabel = gtk.Label("Extra kernel parameters:")
102 tmplabel.set_alignment(0.0, 0.5)
103 tmplabel.set_size_request(160, -1)
104 hbox.pack_start(tmplabel, expand=False, fill=False, padding=0)
105 self.kernel_params_entry = gtk.Entry()
106 self.kernel_params_entry.set_width_chars(40)
107 hbox.pack_start(self.kernel_params_entry, expand=False, fill=False, padding=15)
108 vert.pack_start(hbox, expand=False, fill=False, padding=15)
109
110 self.add_content(vert)
111 self.boot_devices = None
112
113 def loader_selected(self, widget, data=None):
114 self.active_selection = data
115 if data == "none":
116 self.check_install_in_mbr.set_sensitive(False)
117 else:
118 self.check_install_in_mbr.set_sensitive(True)
119
120 def mbr_selected(self, widget, data=None):
121 if self.check_install_in_mbr.get_active():
122 self.boot_device_combo.set_sensitive(True)
123 else:
124 self.boot_device_combo.set_sensitive(False)
125
126 def activate(self):
127 self.controller.SHOW_BUTTON_EXIT = True
128 # self.controller.SHOW_BUTTON_HELP = True
129 self.controller.SHOW_BUTTON_BACK = True
130 self.controller.SHOW_BUTTON_FORWARD = True
131 self.controller.SHOW_BUTTON_FINISH = False
132 self.active_selection = self.controller.install_profile.get_boot_loader_pkg() or "grub"
133 self.boot_loaders[self.active_selection].set_active(True)
134 if self.controller.install_type == "networkless":
135 self.active_selection = "grub"
136 self.boot_loaders["lilo"].set_sensitive(False)
137 self.boot_loaders["grub"].set_active(True)
138 self.check_install_in_mbr.set_active(self.controller.install_profile.get_boot_loader_mbr())
139 self.boot_devices = self.controller.install_profile.get_partition_tables().keys()
140 self.boot_devices.sort()
141 self.boot_device_combo.get_model().clear()
142 boot_device = self.controller.install_profile.get_boot_device()
143 for i, device in enumerate(self.boot_devices):
144 self.boot_device_combo.get_model().append([device])
145 if boot_device == device:
146 self.boot_device_combo.set_active(i)
147 if self.boot_device_combo.get_active() == -1:
148 self.boot_device_combo.set_active(0)
149 # self.kernel_params_entry.set_text(self.controller.install_profile.get_bootloader_kernel_args())
150 kernel_params = self.controller.install_profile.get_bootloader_kernel_args()
151 if not "doscsi" in kernel_params.split():
152 parts_tmp = self.controller.install_profile.get_partition_tables()
153 for device in parts_tmp:
154 if not device.startswith("/dev/sda"): continue
155 for part in parts_tmp[device]:
156 if parts_tmp[device][part]['mountpoint'] == "/":
157 kernel_params += " doscsi"
158 self.kernel_params_entry.set_text(kernel_params)
159
160 def deactivate(self):
161 self.controller.install_profile.set_boot_loader_pkg(None, self.active_selection, None)
162 self.controller.install_profile.set_boot_loader_mbr(None, self.check_install_in_mbr.get_active(), None)
163 if self.check_install_in_mbr.get_active():
164 self.controller.install_profile.set_boot_device(None, self.boot_devices[self.boot_device_combo.get_active()], None)
165 self.controller.install_profile.set_bootloader_kernel_args(None, self.kernel_params_entry.get_text(), None)
166 return True

Properties

Name Value
svn:eol-style native

  ViewVC Help
Powered by ViewVC 1.1.20