| 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 GLIScreen |
| 8 |
import GLIUtility |
| 9 |
from gettext import gettext as _ |
| 10 |
|
| 11 |
class Panel(GLIScreen.GLIScreen): |
| 12 |
|
| 13 |
title = _("Pre-install Configuration") |
| 14 |
_helptext = """ |
| 15 |
<b><u>Pre-install Config - aka Client Configuration</u></b> |
| 16 |
|
| 17 |
If your network is already set up and you can ping www.gentoo.org, then the |
| 18 |
checkbox labeled "My network is already set up and running (or no network)" |
| 19 |
will be checked. In that case you do not need to set up any pre-install |
| 20 |
networking. If it is not, you need to set up your networking. If you are not |
| 21 |
connected to a network, you should check that box, so the installer does not try |
| 22 |
to find a DHCP server. |
| 23 |
|
| 24 |
Note: If you intend to use wireless to connect to the Internet from the Livecd, |
| 25 |
you will need to set up your connection before starting the installer. See the |
| 26 |
Wireless Networking guide at |
| 27 |
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4&chap=4 |
| 28 |
|
| 29 |
To connect to the Internet you will need to configure one network device, |
| 30 |
usually eth0. In most cases you can select DHCP unless you have a specific IP |
| 31 |
address or network configuration where you need to give Static information. |
| 32 |
|
| 33 |
In the rare case that you need to connect to the Internet through a proxy, there |
| 34 |
are three proxy types to enter. |
| 35 |
|
| 36 |
In the Misc. tab there are a few customizable items: |
| 37 |
|
| 38 |
Chroot directory: This is the directory the the installer mounts your / |
| 39 |
partition to and then chroots to in order to do the installation. It is best to |
| 40 |
not change this unless you need to. |
| 41 |
|
| 42 |
Logfile: The path and filename of the installer logfile. The default is |
| 43 |
recommended. |
| 44 |
|
| 45 |
SSH: If you want to start sshd to allow remote access to your machine during |
| 46 |
the installation, select Yes, otherwise No. No is recommended since it is not |
| 47 |
necessary for an installation. |
| 48 |
|
| 49 |
Root password: This sets the root password for the <i>Livecd environment <b>only</b></i>. |
| 50 |
If you chose Yes for SSH then you will need to enter a root password or you will |
| 51 |
not be able to login remotely. |
| 52 |
|
| 53 |
Kernel Modules: If you have additional modules (ex. some rare networking module |
| 54 |
that didn't autoload) you need to load that are not in the Loaded modules list |
| 55 |
on the right, you can enter them here. |
| 56 |
|
| 57 |
Verbose logging: This adds a lot of debugging information to the logfiles, |
| 58 |
which is useful for reporting bugs. |
| 59 |
|
| 60 |
Install mode: You want "Normal". the Chroot mode is still under development |
| 61 |
and will not leave you with a bootable system. |
| 62 |
""" |
| 63 |
|
| 64 |
def __init__(self, controller): |
| 65 |
GLIScreen.GLIScreen.__init__(self, controller) |
| 66 |
vert = gtk.VBox(False, 0) |
| 67 |
vert.set_border_width(10) |
| 68 |
|
| 69 |
content_str = _("""On this screen, you will set all your pre-install options such as networking, |
| 70 |
chroot directory, logfile location, architecture, etc.""") |
| 71 |
|
| 72 |
content_label = gtk.Label(content_str) |
| 73 |
vert.pack_start(content_label, expand=False, fill=False, padding=5) |
| 74 |
|
| 75 |
self.notebook = gtk.Notebook() |
| 76 |
|
| 77 |
basicbox = gtk.VBox(False, 0) |
| 78 |
basicbox.set_border_width(10) |
| 79 |
hbox = gtk.HBox(False, 0) |
| 80 |
tmplabel = gtk.Label() |
| 81 |
tmplabel.set_markup("<b><u>" + _("Network setup (for install only):") + "</u></b>") |
| 82 |
hbox.pack_start(tmplabel, expand=False, fill=False, padding=0) |
| 83 |
basicbox.pack_start(hbox, expand=False, fill=False, padding=0) |
| 84 |
hbox = gtk.HBox(False, 0) |
| 85 |
self.already_setup_check = gtk.CheckButton() |
| 86 |
self.already_setup_check.set_active(False) |
| 87 |
self.already_setup_check.connect("toggled", self.already_setup_toggled) |
| 88 |
hbox.pack_start(self.already_setup_check, expand=False, fill=False, padding=0) |
| 89 |
hbox.pack_start(gtk.Label("My network is already setup and running (or no network)"), expand=False, fill=False, padding=10) |
| 90 |
basicbox.pack_start(hbox, expand=False, fill=False, padding=3) |
| 91 |
hbox = gtk.HBox(False, 0) |
| 92 |
hbox.pack_start(gtk.Label(_("Interface:")), expand=False, fill=False, padding=0) |
| 93 |
self.interface_combo = gtk.combo_box_entry_new_text() |
| 94 |
self.interface_combo.get_child().set_width_chars(9) |
| 95 |
self.interface_combo.connect("changed", self.interface_changed) |
| 96 |
self.interfaces = GLIUtility.get_eth_devices() |
| 97 |
for device in self.interfaces: |
| 98 |
self.interface_combo.append_text(device) |
| 99 |
hbox.pack_start(self.interface_combo, expand=False, fill=False, padding=10) |
| 100 |
basicbox.pack_start(hbox, expand=False, fill=False, padding=7) |
| 101 |
hbox = gtk.HBox(False, 0) |
| 102 |
self.basic_dhcp_radio = gtk.RadioButton(label=_("DHCP")) |
| 103 |
self.basic_dhcp_radio.connect("toggled", self.dhcp_static_toggled, "dhcp") |
| 104 |
hbox.pack_start(self.basic_dhcp_radio, expand=False, fill=False, padding=0) |
| 105 |
basicbox.pack_start(hbox, expand=False, fill=False, padding=0) |
| 106 |
hbox = gtk.HBox(False, 0) |
| 107 |
tmptable = gtk.Table(rows=1, columns=3) |
| 108 |
tmptable.set_col_spacings(6) |
| 109 |
tmptable.set_row_spacings(5) |
| 110 |
tmptable.attach(gtk.Label(" "), 0, 1, 0, 1) |
| 111 |
tmplabel = gtk.Label(_("DHCP options:")) |
| 112 |
tmplabel.set_alignment(0.0, 0.5) |
| 113 |
tmptable.attach(tmplabel, 1, 2, 0, 1) |
| 114 |
self.dhcp_options_entry = gtk.Entry() |
| 115 |
self.dhcp_options_entry.set_width_chars(35) |
| 116 |
tmptable.attach(self.dhcp_options_entry, 2, 3, 0, 1) |
| 117 |
hbox.pack_start(tmptable, expand=False, fill=False, padding=0) |
| 118 |
basicbox.pack_start(hbox, expand=False, fill=False, padding=3) |
| 119 |
hbox = gtk.HBox(False, 0) |
| 120 |
self.basic_static_radio = gtk.RadioButton(group=self.basic_dhcp_radio, label=_("Static")) |
| 121 |
self.basic_static_radio.connect("toggled", self.dhcp_static_toggled, "static") |
| 122 |
hbox.pack_start(self.basic_static_radio, expand=False, fill=False, padding=0) |
| 123 |
basicbox.pack_start(hbox, expand=False, fill=False, padding=3) |
| 124 |
hbox = gtk.HBox(False, 0) |
| 125 |
tmptable = gtk.Table(rows=5, columns=1) |
| 126 |
tmptable.set_col_spacings(6) |
| 127 |
tmptable.set_row_spacings(5) |
| 128 |
tmptable.attach(gtk.Label(" "), 0, 1, 0, 1) |
| 129 |
tmplabel = gtk.Label(_("IP address:")) |
| 130 |
tmplabel.set_alignment(0.0, 0.5) |
| 131 |
tmptable.attach(tmplabel, 1, 2, 0, 1) |
| 132 |
self.ip_address_entry = gtk.Entry() |
| 133 |
self.ip_address_entry.set_width_chars(20) |
| 134 |
tmptable.attach(self.ip_address_entry, 2, 3, 0, 1) |
| 135 |
tmptable.attach(gtk.Label(" "), 3, 4, 0, 1) |
| 136 |
tmplabel = gtk.Label(_("Netmask:")) |
| 137 |
tmplabel.set_alignment(0.0, 0.5) |
| 138 |
tmptable.attach(tmplabel, 4, 5, 0, 1) |
| 139 |
self.netmask_entry = gtk.Entry() |
| 140 |
self.netmask_entry.set_width_chars(20) |
| 141 |
tmptable.attach(self.netmask_entry, 5, 6, 0, 1) |
| 142 |
tmplabel = gtk.Label(_("Broadcast:")) |
| 143 |
tmplabel.set_alignment(0.0, 0.5) |
| 144 |
tmptable.attach(tmplabel, 1, 2, 1, 2) |
| 145 |
self.broadcast_entry = gtk.Entry() |
| 146 |
self.broadcast_entry.set_width_chars(20) |
| 147 |
tmptable.attach(self.broadcast_entry, 2, 3, 1, 2) |
| 148 |
tmplabel = gtk.Label(_("Gateway:")) |
| 149 |
tmplabel.set_alignment(0.0, 0.5) |
| 150 |
tmptable.attach(tmplabel, 4, 5, 1, 2) |
| 151 |
self.gateway_entry = gtk.Entry() |
| 152 |
self.gateway_entry.set_width_chars(20) |
| 153 |
tmptable.attach(self.gateway_entry, 5, 6, 1, 2) |
| 154 |
tmplabel = gtk.Label(_("DNS servers:")) |
| 155 |
tmplabel.set_alignment(0.0, 0.5) |
| 156 |
tmptable.attach(tmplabel, 1, 2, 2, 3) |
| 157 |
self.dns_entry = gtk.Entry() |
| 158 |
self.dns_entry.set_width_chars(20) |
| 159 |
tmptable.attach(self.dns_entry, 2, 3, 2, 3) |
| 160 |
hbox.pack_start(tmptable, expand=False, fill=False, padding=0) |
| 161 |
basicbox.pack_start(hbox, expand=False, fill=False, padding=3) |
| 162 |
hbox = gtk.HBox(False, 0) |
| 163 |
tmptable = gtk.Table(rows=1, columns=5) |
| 164 |
tmptable.set_col_spacings(6) |
| 165 |
tmptable.set_row_spacings(5) |
| 166 |
# tmptable.attach(gtk.Label(" "), 0, 2, 0, 1) |
| 167 |
tmplabel = gtk.Label() |
| 168 |
tmplabel.set_markup("<b><u>" + _("Proxies:") + "</u></b>") |
| 169 |
tmplabel.set_alignment(0.0, 0.5) |
| 170 |
tmptable.attach(tmplabel, 0, 5, 0, 1) |
| 171 |
|
| 172 |
tmpbox = gtk.HBox(False, 5) |
| 173 |
tmplabel = gtk.Label(_("HTTP:")) |
| 174 |
tmplabel.set_alignment(0, 0.5) |
| 175 |
# tmptable.attach(tmplabel, 0, 1, 2, 3) |
| 176 |
tmpbox.pack_start(tmplabel, expand=False, fill=False) |
| 177 |
self.http_proxy_entry = gtk.Entry() |
| 178 |
tmpbox.pack_start(self.http_proxy_entry, expand=False, fill=False) |
| 179 |
# tmptable.attach(self.http_proxy_entry, 1, 2, 2, 3) |
| 180 |
tmptable.attach(tmpbox, 0, 1, 1, 2) |
| 181 |
tmptable.attach(gtk.Label(" "), 1, 2, 1, 2) |
| 182 |
|
| 183 |
tmpbox = gtk.HBox(False, 5) |
| 184 |
tmplabel = gtk.Label(_("FTP:")) |
| 185 |
tmplabel.set_alignment(0, 0.5) |
| 186 |
# tmptable.attach(tmplabel, 0, 1, 3, 4) |
| 187 |
tmpbox.pack_start(tmplabel, expand=False, fill=False) |
| 188 |
self.ftp_proxy_entry = gtk.Entry() |
| 189 |
tmpbox.pack_start(self.ftp_proxy_entry, expand=False, fill=False) |
| 190 |
# tmptable.attach(self.ftp_proxy_entry, 1, 2, 3, 4) |
| 191 |
tmptable.attach(tmpbox, 2, 3, 1, 2) |
| 192 |
tmptable.attach(gtk.Label(" "), 3, 4, 1, 2) |
| 193 |
|
| 194 |
tmpbox = gtk.HBox(False, 5) |
| 195 |
tmplabel = gtk.Label(_("Rsync:")) |
| 196 |
tmplabel.set_alignment(0, 0.5) |
| 197 |
# tmptable.attach(tmplabel, 0, 1, 4, 5) |
| 198 |
tmpbox.pack_start(tmplabel, expand=False, fill=False) |
| 199 |
self.rsync_proxy_entry = gtk.Entry() |
| 200 |
tmpbox.pack_start(self.rsync_proxy_entry, expand=False, fill=False) |
| 201 |
# tmptable.attach(self.rsync_proxy_entry, 1, 2, 4, 5) |
| 202 |
tmptable.attach(tmpbox, 4, 5, 1, 2) |
| 203 |
|
| 204 |
hbox.pack_start(tmptable, expand=False, fill=False, padding=0) |
| 205 |
basicbox.pack_start(hbox, expand=False, fill=False, padding=3) |
| 206 |
self.notebook.append_page(basicbox, gtk.Label(_("Networking"))) |
| 207 |
|
| 208 |
advbox = gtk.VBox(False, 0) |
| 209 |
advbox.set_border_width(10) |
| 210 |
hbox = gtk.HBox(False, 0) |
| 211 |
tmptable = gtk.Table(rows=5, columns=1) |
| 212 |
tmptable.set_col_spacings(6) |
| 213 |
tmptable.set_row_spacings(5) |
| 214 |
# tmplabel = gtk.Label() |
| 215 |
# tmplabel.set_markup("<b><u>" + _("Directories and logfiles:") + "</u></b>") |
| 216 |
# tmplabel.set_alignment(0.0, 0.5) |
| 217 |
# tmptable.attach(tmplabel, 0, 2, 0, 1) |
| 218 |
tmplabel = gtk.Label(_("Chroot directory:")) |
| 219 |
tmplabel.set_alignment(0.0, 0.5) |
| 220 |
tmptable.attach(tmplabel, 0, 1, 1, 2) |
| 221 |
self.chroot_dir_entry = gtk.Entry() |
| 222 |
self.chroot_dir_entry.set_width_chars(25) |
| 223 |
tmptable.attach(self.chroot_dir_entry, 1, 2, 1, 2) |
| 224 |
tmplabel = gtk.Label(_("Logfile:")) |
| 225 |
tmplabel.set_alignment(0.0, 0.5) |
| 226 |
tmptable.attach(tmplabel, 0, 1, 2, 3) |
| 227 |
self.logfile_entry = gtk.Entry() |
| 228 |
self.logfile_entry.set_width_chars(25) |
| 229 |
tmptable.attach(self.logfile_entry, 1, 2, 2, 3) |
| 230 |
tmplabel = gtk.Label(" ") |
| 231 |
tmptable.attach(tmplabel, 0, 1, 3, 4) |
| 232 |
# tmplabel = gtk.Label() |
| 233 |
# tmplabel.set_markup("<b><u>" + _("SSH:") + "</u></b>") |
| 234 |
# tmplabel.set_alignment(0.0, 0.5) |
| 235 |
# tmptable.attach(tmplabel, 0, 2, 4, 5) |
| 236 |
tmplabel = gtk.Label(_("Start SSHd:")) |
| 237 |
tmplabel.set_alignment(0.0, 0.5) |
| 238 |
tmptable.attach(tmplabel, 0, 1, 5, 6) |
| 239 |
tmphbox = gtk.HBox(False, 0) |
| 240 |
self.sshd_yes_radio = gtk.RadioButton(label=_("Yes")) |
| 241 |
tmphbox.pack_start(self.sshd_yes_radio, expand=False, fill=False, padding=0) |
| 242 |
self.sshd_no_radio = gtk.RadioButton(group=self.sshd_yes_radio, label=_("No")) |
| 243 |
tmphbox.pack_start(self.sshd_no_radio, expand=False, fill=False, padding=15) |
| 244 |
tmptable.attach(tmphbox, 1, 2, 5, 6) |
| 245 |
tmplabel = gtk.Label(_("Root password:")) |
| 246 |
tmplabel.set_alignment(0.0, 0.5) |
| 247 |
tmptable.attach(tmplabel, 0, 1, 6, 7) |
| 248 |
self.root_password_entry = gtk.Entry() |
| 249 |
self.root_password_entry.set_width_chars(25) |
| 250 |
self.root_password_entry.set_visibility(False) |
| 251 |
tmptable.attach(self.root_password_entry, 1, 2, 6, 7, xoptions=0) |
| 252 |
tmplabel = gtk.Label(_("Verify root password:")) |
| 253 |
tmplabel.set_alignment(0.0, 0.5) |
| 254 |
tmptable.attach(tmplabel, 0, 1, 7, 8) |
| 255 |
self.verify_root_password_entry = gtk.Entry() |
| 256 |
self.verify_root_password_entry.set_width_chars(25) |
| 257 |
self.verify_root_password_entry.set_visibility(False) |
| 258 |
tmptable.attach(self.verify_root_password_entry, 1, 2, 7, 8, xoptions=0) |
| 259 |
tmplabel = gtk.Label(" ") |
| 260 |
tmptable.attach(tmplabel, 0, 1, 8, 9) |
| 261 |
# tmplabel = gtk.Label() |
| 262 |
# tmplabel.set_markup("<b><u>" + _("Other:") + "</u></b>") |
| 263 |
# tmplabel.set_alignment(0.0, 0.5) |
| 264 |
# tmptable.attach(tmplabel, 0, 2, 9, 10) |
| 265 |
tmplabel = gtk.Label(_("Kernel modules:")) |
| 266 |
tmplabel.set_alignment(0.0, 0.5) |
| 267 |
tmptable.attach(tmplabel, 0, 1, 10, 11) |
| 268 |
self.modules_entry = gtk.Entry() |
| 269 |
self.modules_entry.set_width_chars(25) |
| 270 |
tmptable.attach(self.modules_entry, 1, 2, 10, 11) |
| 271 |
# tmplabel = gtk.Label(" ") |
| 272 |
# tmptable.attach(tmplabel, 0, 1, 11, 12) |
| 273 |
# tmplabel = gtk.Label() |
| 274 |
# tmplabel.set_markup("<b><u>" + _("Debug:") + "</u></b>") |
| 275 |
# tmplabel.set_alignment(0.0, 0.5) |
| 276 |
# tmptable.attach(tmplabel, 0, 2, 12, 13) |
| 277 |
tmplabel = gtk.Label(_("Verbose logging:")) |
| 278 |
tmplabel.set_alignment(0.0, 0.5) |
| 279 |
tmptable.attach(tmplabel, 0, 1, 11, 12) |
| 280 |
tmphbox = gtk.HBox(False, 0) |
| 281 |
self.verbose_no_radio = gtk.RadioButton(label=_("No")) |
| 282 |
tmphbox.pack_start(self.verbose_no_radio, expand=False, fill=False, padding=0) |
| 283 |
self.verbose_yes_radio = gtk.RadioButton(group=self.verbose_no_radio, label=_("Yes")) |
| 284 |
tmphbox.pack_start(self.verbose_yes_radio, expand=False, fill=False, padding=15) |
| 285 |
tmptable.attach(tmphbox, 1, 2, 11, 12) |
| 286 |
tmplabel = gtk.Label(_("Install mode:")) |
| 287 |
tmplabel.set_alignment(0.0, 0.5) |
| 288 |
tmptable.attach(tmplabel, 0, 1, 12, 13) |
| 289 |
self.install_mode_combo = gtk.combo_box_new_text() |
| 290 |
self._install_modes = ( "Normal", "Chroot" ) |
| 291 |
for install_mode in self._install_modes: |
| 292 |
self.install_mode_combo.append_text(install_mode) |
| 293 |
self.install_mode_combo.set_active(0) |
| 294 |
tmptable.attach(self.install_mode_combo, 1, 2, 12, 13) |
| 295 |
|
| 296 |
hbox.pack_start(tmptable, expand=False, fill=False, padding=0) |
| 297 |
|
| 298 |
# Currently loaded modules |
| 299 |
loaded_mod_frame = gtk.Frame(label="Loaded modules") |
| 300 |
loaded_mod_frame.set_size_request(200, -1) |
| 301 |
module_list_box = gtk.VBox(False, 3) |
| 302 |
module_list_box.set_border_width(7) |
| 303 |
module_scroll = gtk.ScrolledWindow() |
| 304 |
module_scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) |
| 305 |
module_scroll.set_shadow_type(gtk.SHADOW_NONE) |
| 306 |
module_viewport = gtk.Viewport() |
| 307 |
module_viewport.set_shadow_type(gtk.SHADOW_NONE) |
| 308 |
module_viewport.add(module_list_box) |
| 309 |
module_scroll.add(module_viewport) |
| 310 |
loaded_mod_frame.add(module_scroll) |
| 311 |
loaded_modules = GLIUtility.spawn(r"lsmod | grep -v ^Module | cut -d ' ' -f 1", return_output=True)[1].strip().split("\n") |
| 312 |
for module in loaded_modules: |
| 313 |
tmplabel = gtk.Label(module) |
| 314 |
tmplabel.set_alignment(0.0, 0.5) |
| 315 |
module_list_box.pack_start(tmplabel, expand=False, fill=False, padding=0) |
| 316 |
hbox.pack_end(loaded_mod_frame, expand=False, fill=False, padding=5) |
| 317 |
|
| 318 |
advbox.pack_start(hbox, expand=False, fill=False, padding=0) |
| 319 |
self.notebook.append_page(advbox, gtk.Label(_("Misc."))) |
| 320 |
|
| 321 |
vert.pack_start(self.notebook, expand=True, fill=True, padding=0) |
| 322 |
|
| 323 |
self.add_content(vert) |
| 324 |
|
| 325 |
def interface_changed(self, combobox): |
| 326 |
hw_addr, ip_addr, mask, bcast, gw, up = ("", "", "", "", "", "") |
| 327 |
interface = combobox.child.get_text() |
| 328 |
try: |
| 329 |
if interface.startswith("eth"): |
| 330 |
hw_addr, ip_addr, mask, bcast, gw, up = GLIUtility.get_eth_info(interface[-1:]) |
| 331 |
except: |
| 332 |
pass |
| 333 |
self.ip_address_entry.set_text(ip_addr) |
| 334 |
self.netmask_entry.set_text(mask) |
| 335 |
self.broadcast_entry.set_text(bcast) |
| 336 |
# self.gateway_entry.set_text(gw) |
| 337 |
|
| 338 |
def dhcp_static_toggled(self, radiobutton, data=None): |
| 339 |
if radiobutton.get_active(): |
| 340 |
# This one was just toggled ON |
| 341 |
if data == "dhcp": |
| 342 |
self.ip_address_entry.set_sensitive(False) |
| 343 |
self.netmask_entry.set_sensitive(False) |
| 344 |
self.broadcast_entry.set_sensitive(False) |
| 345 |
self.gateway_entry.set_sensitive(False) |
| 346 |
self.dns_entry.set_sensitive(False) |
| 347 |
self.dhcp_options_entry.set_sensitive(True) |
| 348 |
else: |
| 349 |
self.ip_address_entry.set_sensitive(True) |
| 350 |
self.netmask_entry.set_sensitive(True) |
| 351 |
self.broadcast_entry.set_sensitive(True) |
| 352 |
self.gateway_entry.set_sensitive(True) |
| 353 |
self.dns_entry.set_sensitive(True) |
| 354 |
self.dhcp_options_entry.set_sensitive(False) |
| 355 |
|
| 356 |
def already_setup_toggled(self, widget): |
| 357 |
if self.already_setup_check.get_active(): |
| 358 |
self.interface_combo.set_sensitive(False) |
| 359 |
self.basic_dhcp_radio.set_sensitive(False) |
| 360 |
self.basic_static_radio.set_sensitive(False) |
| 361 |
self.ip_address_entry.set_sensitive(False) |
| 362 |
self.netmask_entry.set_sensitive(False) |
| 363 |
self.broadcast_entry.set_sensitive(False) |
| 364 |
self.gateway_entry.set_sensitive(False) |
| 365 |
self.dns_entry.set_sensitive(False) |
| 366 |
self.dhcp_options_entry.set_sensitive(False) |
| 367 |
else: |
| 368 |
self.interface_combo.set_sensitive(True) |
| 369 |
self.basic_dhcp_radio.set_sensitive(True) |
| 370 |
self.basic_static_radio.set_sensitive(True) |
| 371 |
if self.basic_static_radio.get_active(): |
| 372 |
self.ip_address_entry.set_sensitive(True) |
| 373 |
self.netmask_entry.set_sensitive(True) |
| 374 |
self.broadcast_entry.set_sensitive(True) |
| 375 |
self.gateway_entry.set_sensitive(True) |
| 376 |
self.dns_entry.set_sensitive(True) |
| 377 |
else: |
| 378 |
self.dhcp_options_entry.set_sensitive(True) |
| 379 |
|
| 380 |
def activate(self): |
| 381 |
self.controller.SHOW_BUTTON_EXIT = True |
| 382 |
# self.controller.SHOW_BUTTON_HELP = True |
| 383 |
self.controller.SHOW_BUTTON_BACK = False |
| 384 |
self.controller.SHOW_BUTTON_FORWARD = True |
| 385 |
self.controller.SHOW_BUTTON_FINISH = False |
| 386 |
|
| 387 |
interface = self.controller.client_profile.get_network_interface() |
| 388 |
ip = self.controller.client_profile.get_network_ip() |
| 389 |
if not interface: |
| 390 |
self.interface_combo.set_active(0) |
| 391 |
else: |
| 392 |
self.interface_combo.child.set_text(interface) |
| 393 |
for i, dev in enumerate(self.interfaces): |
| 394 |
if dev == interface: |
| 395 |
self.interface_combo.set_active(i) |
| 396 |
if ip == "dhcp" or not ip: |
| 397 |
self.basic_dhcp_radio.set_active(True) |
| 398 |
self.dhcp_static_toggled(self.basic_dhcp_radio, "dhcp") |
| 399 |
self.dhcp_options_entry.set_text(self.controller.client_profile.get_network_dhcp_options()) |
| 400 |
else: |
| 401 |
self.basic_static_radio.set_active(True) |
| 402 |
self.chroot_dir_entry.set_text(self.controller.client_profile.get_root_mount_point()) |
| 403 |
self.logfile_entry.set_text(self.controller.client_profile.get_log_file()) |
| 404 |
if self.controller.client_profile.get_enable_ssh(): |
| 405 |
self.sshd_yes_radio.set_active(True) |
| 406 |
else: |
| 407 |
self.sshd_no_radio.set_active(True) |
| 408 |
dns_servers = GLIUtility.spawn(r"grep -e '^nameserver' /etc/resolv.conf | sed -e 's:^nameserver ::'", return_output=True)[1].strip().split('\n') |
| 409 |
dns_servers = " ".join(dns_servers) |
| 410 |
self.dns_entry.set_text(dns_servers) |
| 411 |
self.gateway_entry.set_text(GLIUtility.spawn(r"/sbin/route -n | grep -e '^0\.0\.0\.0' | sed -e 's:^0\.0\.0\.0 \+::' -e 's: \+.\+$::'", return_output=True)[1].strip()) |
| 412 |
self.modules_entry.set_text(" ".join(self.controller.client_profile.get_kernel_modules())) |
| 413 |
if self.controller.client_profile.get_verbose(): |
| 414 |
self.verbose_yes_radio.set_active(True) |
| 415 |
else: |
| 416 |
self.verbose_no_radio.set_active(True) |
| 417 |
if self.controller.install_type == "networkless": |
| 418 |
self.already_setup_check.set_active(True) |
| 419 |
self.notebook.set_show_tabs(False) |
| 420 |
self.notebook.set_current_page(1) |
| 421 |
self.sshd_yes_radio.set_sensitive(False) |
| 422 |
self.sshd_no_radio.set_sensitive(False) |
| 423 |
self.root_password_entry.set_sensitive(False) |
| 424 |
self.verify_root_password_entry.set_sensitive(False) |
| 425 |
else: |
| 426 |
if GLIUtility.ping("www.gentoo.org"): |
| 427 |
self.already_setup_check.set_active(True) |
| 428 |
|
| 429 |
def deactivate(self): |
| 430 |
self.controller.client_profile.set_network_interface(None, self.interface_combo.get_child().get_text(), None) |
| 431 |
if self.already_setup_check.get_active(): |
| 432 |
self.controller.client_profile.set_network_type(None, "none", None) |
| 433 |
else: |
| 434 |
if self.basic_dhcp_radio.get_active(): |
| 435 |
self.controller.client_profile.set_network_type(None, "dhcp", None) |
| 436 |
self.controller.client_profile.set_network_dhcp_options(None, self.dhcp_options_entry.get_text(), None) |
| 437 |
else: |
| 438 |
self.controller.client_profile.set_network_type(None, "static", None) |
| 439 |
self.controller.client_profile.set_network_ip(None, self.ip_address_entry.get_text(), None) |
| 440 |
self.controller.client_profile.set_network_netmask(None, self.netmask_entry.get_text(), None) |
| 441 |
self.controller.client_profile.set_network_broadcast(None, self.broadcast_entry.get_text(), None) |
| 442 |
self.controller.client_profile.set_network_gateway(None, self.gateway_entry.get_text(), None) |
| 443 |
self.controller.client_profile.set_dns_servers(None, self.dns_entry.get_text(), None) |
| 444 |
self.controller.client_profile.set_http_proxy(None, self.http_proxy_entry.get_text(), None) |
| 445 |
self.controller.client_profile.set_ftp_proxy(None, self.ftp_proxy_entry.get_text(), None) |
| 446 |
self.controller.client_profile.set_rsync_proxy(None, self.rsync_proxy_entry.get_text(), None) |
| 447 |
self.controller.client_profile.set_root_mount_point(None, self.chroot_dir_entry.get_text(), None) |
| 448 |
self.controller.client_profile.set_log_file(None, self.logfile_entry.get_text(), None) |
| 449 |
self.controller.client_profile.set_enable_ssh(None, self.sshd_yes_radio.get_active(), None) |
| 450 |
if self.root_password_entry.get_text() == self.verify_root_password_entry.get_text(): |
| 451 |
self.controller.client_profile.set_root_passwd(None, GLIUtility.hash_password(self.root_password_entry.get_text()), None) |
| 452 |
self.controller.client_profile.set_kernel_modules(None, self.modules_entry.get_text(), None) |
| 453 |
self.controller.client_profile.set_verbose(None, self.verbose_yes_radio.get_active(), None) |
| 454 |
arch = GLIUtility.spawn(r"uname -m | sed -e 's:i[3-6]86:x86:' -e 's:x86_64:amd64:' -e 's:parisc:hppa:'", return_output=True)[1].strip() |
| 455 |
self.controller.client_profile.set_architecture_template(None, arch, None) |
| 456 |
self.controller.client_profile.set_install_mode(None, self._install_modes[self.install_mode_combo.get_active()].lower(), None) |
| 457 |
|
| 458 |
self.controller.cc.set_configuration(self.controller.client_profile) |
| 459 |
self.controller.cc.start_pre_install() |
| 460 |
|
| 461 |
return True |