/[gli]/trunk/src/GLIGenDialog.py
Gentoo

Diff of /trunk/src/GLIGenDialog.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 717 Revision 718
285 except: 285 except:
286 self._d.msgbox(_(u"ERROR: Could not set that timezone!")) 286 self._d.msgbox(_(u"ERROR: Could not set that timezone!"))
287 287
288 def _set_portage_tree(self): 288 def _set_portage_tree(self):
289 # This section will ask whether to sync the tree, whether to use a snapshot, etc. 289 # This section will ask whether to sync the tree, whether to use a snapshot, etc.
290 menulist = [("Sync", "Normal. Use emerge sync RECOMMENDED!"), ("Webrsync", "HTTP daily snapshot. Use when rsync is firewalled."), ("Snapshot", "Use a portage snapshot, either a local file or a URL"), ("None", "Extra cases such as if /usr/portage is an NFS mount")] 290 menulist = [("Sync", _(u"Normal. Use emerge sync RECOMMENDED!")), ("Webrsync", _(u"HTTP daily snapshot. Use when rsync is firewalled.")), ("Snapshot", _(u"Use a portage snapshot, either a local file or a URL")), ("None", _(u"Extra cases such as if /usr/portage is an NFS mount"))]
291 code, portage_tree_sync = self._d.menu(_(u"Which method do you want to use to sync the portage tree for the installation? If choosing a snapshot you will need to provide the URI for the snapshot if it is not on the livecd."),width=60, height=15, choices=menulist) 291 code, portage_tree_sync = self._d.menu(_(u"Which method do you want to use to sync the portage tree for the installation? If choosing a snapshot you will need to provide the URI for the snapshot if it is not on the livecd."),width=60, height=15, choices=menulist)
292 if code != self._DLG_OK: 292 if code != self._DLG_OK:
293 return 293 return
294 #portage_tree_sync = menulist[int(portage_tree_sync)-1] 294 #portage_tree_sync = menulist[int(portage_tree_sync)-1]
295 #FIX ME when python 2.4 comes out. 295 #FIX ME when python 2.4 comes out.
300 #if portage_tree_sync == "None (NFS mount)": 300 #if portage_tree_sync == "None (NFS mount)":
301 # self._install_profile.set_portage_tree_sync_type(None, "none", None) 301 # self._install_profile.set_portage_tree_sync_type(None, "none", None)
302 #if portage_tree_sync == "Snapshot (using a portage snapshot)": 302 #if portage_tree_sync == "Snapshot (using a portage snapshot)":
303 # self._install_profile.set_portage_tree_sync_type(None, "snapshot", None) 303 # self._install_profile.set_portage_tree_sync_type(None, "snapshot", None)
304 self._install_profile.set_portage_tree_sync_type(None, portage_tree_sync.lower(), None) 304 self._install_profile.set_portage_tree_sync_type(None, portage_tree_sync.lower(), None)
305 snapshot_options = ("Use Local", "Specify URI") 305 snapshot_options = (_(u"Use Local"), _(u"Specify URI"))
306 code, snapshot_option = self._d.menu("Select a local portage snapshot or manually specify a location:", choices=self._dmenu_list_to_choices(snapshot_options)) 306 code, snapshot_option = self._d.menu(_(u"Select a local portage snapshot or manually specify a location:"), choices=self._dmenu_list_to_choices(snapshot_options))
307 snapshot_option = snapshot_options[int(snapshot_option)-1] 307 snapshot_option = snapshot_options[int(snapshot_option)-1]
308 if snapshot_option == "Use Local": 308 if snapshot_option == _(u"Use Local"):
309 snapshot_dir = "/mnt/cdrom/snapshots" 309 snapshot_dir = "/mnt/cdrom/snapshots"
310 if os.path.isdir(snapshot_dir) and os.listdir(snapshot_dir): 310 if os.path.isdir(snapshot_dir) and os.listdir(snapshot_dir):
311 local_snapshots = glob.glob(snapshot_dir + "/portage*.bz2") 311 local_snapshots = glob.glob(snapshot_dir + "/portage*.bz2")
312 if len(local_snapshots) == 1: 312 if len(local_snapshots) == 1:
313 snapshot = local_snapshots[0] 313 snapshot = local_snapshots[0]
314 else: 314 else:
315 local_snapshots.sort() 315 local_snapshots.sort()
316 code, snapshot = self._d.menu("Select a local portage snapshot:", choices=self._dmenu_list_to_choices(local_snapshots)) 316 code, snapshot = self._d.menu(_(u"Select a local portage snapshot:"), choices=self._dmenu_list_to_choices(local_snapshots))
317 if code != self._DLG_OK: return 317 if code != self._DLG_OK: return
318 snapshot = local_snapshots[int(snapshot)-1] 318 snapshot = local_snapshots[int(snapshot)-1]
319 else: 319 else:
320 self._d.msgbox(_(u"There don't seem to be any local portage snapshots available. Hit OK to manually specify a URI.")) 320 self._d.msgbox(_(u"There don't seem to be any local portage snapshots available. Hit OK to manually specify a URI."))
321 snapshot_option = "Specify URI" 321 snapshot_option = _(u"Specify URI")
322 if snapshot_option != "Use Local": 322 if snapshot_option != _(u"Use Local"):
323 code, snapshot = self._d.inputbox(_(u"Enter portage tree snapshot URI"), init=self._install_profile.get_portage_tree_snapshot_uri()) 323 code, snapshot = self._d.inputbox(_(u"Enter portage tree snapshot URI"), init=self._install_profile.get_portage_tree_snapshot_uri())
324 if code == self._DLG_OK: 324 if code == self._DLG_OK:
325 if snapshot: 325 if snapshot:
326 if not GLIUtility.is_uri(snapshot, checklocal=self.local_install): 326 if not GLIUtility.is_uri(snapshot, checklocal=self.local_install):
327 self._d.msgbox(_(u"The specified URI is invalid. It was not saved. Please go back and try again.")) 327 self._d.msgbox(_(u"The specified URI is invalid. It was not saved. Please go back and try again."))
357 devices[drive].set_partitions_from_disk() 357 devices[drive].set_partitions_from_disk()
358 drives.append(drive) 358 drives.append(drive)
359 choice_list.append((drive, devices[drive].get_model())) 359 choice_list.append((drive, devices[drive].get_model()))
360 #choice_list.append(("Other", "Type your own drive name)) # I DONT THINK GLISD CAN DO NONEXISTANT DRIVES 360 #choice_list.append(("Other", "Type your own drive name)) # I DONT THINK GLISD CAN DO NONEXISTANT DRIVES
361 while 1: 361 while 1:
362 code, drive_to_partition = self._d.menu(_(u"Which drive would you like to partition?\n Info provided: Type, mkfs Options, Mountpoint, Mountopts, Size in MB"), choices=choice_list, cancel="Save and Continue") 362 code, drive_to_partition = self._d.menu(_(u"Which drive would you like to partition?\n Info provided: Type, mkfs Options, Mountpoint, Mountopts, Size in MB"), choices=choice_list, cancel=_(u"Save and Continue"))
363 if code != self._DLG_OK: break 363 if code != self._DLG_OK: break
364 while 1: 364 while 1:
365 partitions = devices[drive_to_partition].get_partitions() 365 partitions = devices[drive_to_partition].get_partitions()
366 partlist = devices[drive_to_partition].get_ordered_partition_list() 366 partlist = devices[drive_to_partition].get_ordered_partition_list()
367 tmpparts = devices[drive_to_partition].get_partitions() 367 tmpparts = devices[drive_to_partition].get_partitions()
389 entry += (tmppart.get_mkfsopts() or "none") + ", " 389 entry += (tmppart.get_mkfsopts() or "none") + ", "
390 entry += (tmppart.get_mountpoint() or "none") + ", " 390 entry += (tmppart.get_mountpoint() or "none") + ", "
391 entry += (tmppart.get_mountopts() or "none") + ", " 391 entry += (tmppart.get_mountopts() or "none") + ", "
392 entry += str(tmppart.get_mb()) + "MB)" 392 entry += str(tmppart.get_mb()) + "MB)"
393 partsmenu.append(entry) 393 partsmenu.append(entry)
394 code, part_to_edit = self._d.menu(_(u"Select a partition or unallocated space to edit"), width=70, choices=self._dmenu_list_to_choices(partsmenu), cancel="Back") 394 code, part_to_edit = self._d.menu(_(u"Select a partition or unallocated space to edit"), width=70, choices=self._dmenu_list_to_choices(partsmenu), cancel=_(u"Back"))
395 if code != self._DLG_OK: break 395 if code != self._DLG_OK: break
396 part_to_edit = partlist[int(part_to_edit)-1] 396 part_to_edit = partlist[int(part_to_edit)-1]
397 tmppart = tmpparts[part_to_edit] 397 tmppart = tmpparts[part_to_edit]
398 if tmppart.get_type() == "free": 398 if tmppart.get_type() == "free":
399 # partition size first 399 # partition size first
400 free_mb = tmppart.get_mb() 400 free_mb = tmppart.get_mb()
401 code, new_mb = self._d.inputbox("Enter the size of the new partition in MB (max " + str(free_mb) + "MB). If creating an extended partition input its entire size (not just the first logical size):", init=str(free_mb)) 401 code, new_mb = self._d.inputbox(_(u"Enter the size of the new partition in MB (max %s MB). If creating an extended partition input its entire size (not just the first logical size):") % str(free_mb), init=str(free_mb))
402 if code != self._DLG_OK: continue 402 if code != self._DLG_OK: continue
403 if int(new_mb) > free_mb: 403 if int(new_mb) > free_mb:
404 self._d.msgbox("The size you entered (" + new_mb + "MB) is larger than the maximum of " + str(free_mb) + "MB") 404 self._d.msgbox(_(u"The size you entered (%s MB) is larger than the maximum of %s MB") % (new_mb, str(free_mb)))
405 continue 405 continue
406 # partition type 406 # partition type
407 part_types = [("ext2", "Old, stable, but no journaling"), ("ext3", "ext2 with journaling and b-tree indexing (RECOMMENDED)"), ("linux-swap", "Swap partition for memory overhead"), ("fat32", "Windows filesystem format used in Win9X and XP"), ("ntfs", "Windows filesystem format used in Win2K and NT"),("jfs", "IBM's journaling filesystem. stability unknown."), ("xfs", "Don't use this unless you know you need it."), ("reiserfs", "B*-tree based filesystem. great performance. Only V3 supported."), ("extended", "Create an extended partition containing other logical partitions"), ("other", "Something else we probably don't support.")] 407 part_types = [("ext2", _(u"Old, stable, but no journaling")), ("ext3", _(u"ext2 with journaling and b-tree indexing (RECOMMENDED)")), ("linux-swap", _(u"Swap partition for memory overhead")), ("fat32", _(u"Windows filesystem format used in Win9X and XP")), ("ntfs", _(u"Windows filesystem format used in Win2K and NT")),("jfs", _(u"IBM's journaling filesystem. stability unknown.")), ("xfs", _(u"Don't use this unless you know you need it.")), ("reiserfs", _(u"B*-tree based filesystem. great performance. Only V3 supported.")), ("extended", _(u"Create an extended partition containing other logical partitions")), ("other", _(u"Something else we probably don't support."))]
408 code, type = self._d.menu(_(u"Choose the filesystem type for this new partition."), height=20, width=77, choices=part_types) 408 code, type = self._d.menu(_(u"Choose the filesystem type for this new partition."), height=20, width=77, choices=part_types)
409 if code != self._DLG_OK: continue 409 if code != self._DLG_OK: continue
410 410
411 # 'other' partition type 411 # 'other' partition type
412 if type == "other": 412 if type == "other":
418 else: 418 else:
419 while 1: 419 while 1:
420 tmppart = tmpparts[part_to_edit] 420 tmppart = tmpparts[part_to_edit]
421 tmptitle = drive_to_partition + str(part_to_edit) + " - " 421 tmptitle = drive_to_partition + str(part_to_edit) + " - "
422 if tmppart.is_logical(): 422 if tmppart.is_logical():
423 tmptitle += "Logical (" 423 tmptitle += _(u"Logical (")
424 else: 424 else:
425 tmptitle += "Primary (" 425 tmptitle += _(u"Primary (")
426 tmptitle += tmppart.get_type() + ", " 426 tmptitle += tmppart.get_type() + ", "
427 tmptitle += (tmppart.get_mkfsopts() or "none") + ", " 427 tmptitle += (tmppart.get_mkfsopts() or "none") + ", "
428 tmptitle += (tmppart.get_mountpoint() or "none") + ", " 428 tmptitle += (tmppart.get_mountpoint() or "none") + ", "
429 tmptitle += (tmppart.get_mountopts() or "none") + ", " 429 tmptitle += (tmppart.get_mountopts() or "none") + ", "
430 tmptitle += str(tmppart.get_mb()) + "MB)" 430 tmptitle += str(tmppart.get_mb()) + "MB)"
431 menulist = ["Delete", "Mount Point", "Mount Options", "Format", "Extra mkfs.* Parameters"] 431 menulist = [_(u"Delete"), _(u"Mount Point"), _(u"Mount Options"), _(u"Format"), _(u"Extra mkfs.* Parameters")]
432 code, part_action = self._d.menu(tmptitle, choices=self._dmenu_list_to_choices(menulist), cancel="Back") 432 code, part_action = self._d.menu(tmptitle, choices=self._dmenu_list_to_choices(menulist), cancel=_(u"Back"))
433 if code != self._DLG_OK: break 433 if code != self._DLG_OK: break
434 part_action = menulist[int(part_action)-1] 434 part_action = menulist[int(part_action)-1]
435 if part_action == "Delete": 435 if part_action == _(u"Delete"):
436 answer = (self._d.yesno("Are you sure you want to delete the partition " + drive_to_partition + str(part_to_edit) + "?") == self._DLG_YES) 436 answer = (self._d.yesno(_(u"Are you sure you want to delete the partition ") + drive_to_partition + str(part_to_edit) + "?") == self._DLG_YES)
437 if answer == True: 437 if answer == True:
438 tmpdev = tmppart.get_device() 438 tmpdev = tmppart.get_device()
439 tmpdev.remove_partition(part_to_edit) 439 tmpdev.remove_partition(part_to_edit)
440 break 440 break
441 elif part_action == "Mount Point": 441 elif part_action == _(u"Mount Point"):
442 code, answer = self._d.inputbox("Enter a mountpoint for partition " + str(part_to_edit), init=tmppart.get_mountpoint()) 442 code, answer = self._d.inputbox(_(u"Enter a mountpoint for partition ") + str(part_to_edit), init=tmppart.get_mountpoint())
443 if code == self._DLG_OK: tmppart.set_mountpoint(answer) 443 if code == self._DLG_OK: tmppart.set_mountpoint(answer)
444 elif part_action == "Mount Options": 444 elif part_action == _(u"Mount Options"):
445 code, answer = self._d.inputbox("Enter your mount options for partition " + str(part_to_edit), init=(tmppart.get_mountopts() or "defaults")) 445 code, answer = self._d.inputbox(_(u"Enter your mount options for partition ") + str(part_to_edit), init=(tmppart.get_mountopts() or "defaults"))
446 if code == self._DLG_OK: tmppart.set_mountopts(answer) 446 if code == self._DLG_OK: tmppart.set_mountopts(answer)
447 elif part_action == "Format": 447 elif part_action == _(u"Format"):
448 code = d.yesno("Do you want to format this partition?") 448 code = d.yesno(_(u"Do you want to format this partition?"))
449 if code == self._DLG_YES: 449 if code == self._DLG_YES:
450 tmppart.set_format(True) 450 tmppart.set_format(True)
451 else: 451 else:
452 tmppart.set_format(False) 452 tmppart.set_format(False)
453 elif part_action == "Extra mkfs.* Parameters": 453 elif part_action == _(u"Extra mkfs.* Parameters"):
454 new_mkfsopts = tmppart.get_mkfsopts() 454 new_mkfsopts = tmppart.get_mkfsopts()
455 # extra mkfs options 455 # extra mkfs options
456 if tmppart.get_type() != "extended": 456 if tmppart.get_type() != "extended":
457 code, new_mkfsopts = self._d.inputbox("Extra mkfs parameters", init=new_mkfsopts) 457 code, new_mkfsopts = self._d.inputbox(_(u"Extra mkfs.* Parameters"), init=new_mkfsopts)
458 if code == self._DLG_OK: tmppart.set_mkfsopts(new_mkfsopts) 458 if code == self._DLG_OK: tmppart.set_mkfsopts(new_mkfsopts)
459 try: 459 try:
460 self._install_profile.set_partition_tables(devices) 460 self._install_profile.set_partition_tables(devices)
461 except: 461 except:
462 self._d.msgbox(_(u"ERROR: The partition tables could not be set correctly!")) 462 self._d.msgbox(_(u"ERROR: The partition tables could not be set correctly!"))
466 network_mounts = copy.deepcopy(self._install_profile.get_network_mounts()) 466 network_mounts = copy.deepcopy(self._install_profile.get_network_mounts())
467 while 1: 467 while 1:
468 menulist = [] 468 menulist = []
469 for mount in network_mounts: 469 for mount in network_mounts:
470 menulist.append(mount['host'] + ":" + mount['export']) 470 menulist.append(mount['host'] + ":" + mount['export'])
471 menulist.append("Add a new network mount") 471 menulist.append(_(u"Add a new network mount"))
472 choices = self._dmenu_list_to_choices(menulist) 472 choices = self._dmenu_list_to_choices(menulist)
473 code, menuitemidx = self._d.menu(_(u"If you have any network shares you would like to mount during the install and for your new system, define them here. Select a network mount to edit or add a new mount. Currently GLI only supports NFS mounts."), choices=choices, cancel="Save and Continue") 473 code, menuitemidx = self._d.menu(_(u"If you have any network shares you would like to mount during the install and for your new system, define them here. Select a network mount to edit or add a new mount. Currently GLI only supports NFS mounts."), choices=choices, cancel=_(u"Save and Continue"))
474 if code == self._DLG_CANCEL: 474 if code == self._DLG_CANCEL:
475 try: 475 try:
476 self._install_profile.set_network_mounts(network_mounts) 476 self._install_profile.set_network_mounts(network_mounts)
477 except: 477 except:
478 self._d.msgbox(_(u"ERROR: Could net set network mounts!")) 478 self._d.msgbox(_(u"ERROR: Could net set network mounts!"))
479 break 479 break
480 menuitem = menulist[int(menuitemidx)-1] 480 menuitem = menulist[int(menuitemidx)-1]
481 if menuitem == "Add a new network mount": 481 if menuitem == _(u"Add a new network mount"):
482 code, nfsmount = self._d.inputbox(_(u"Enter NFS mount or just enter the IP/hostname to search for available mounts")) 482 code, nfsmount = self._d.inputbox(_(u"Enter NFS mount or just enter the IP/hostname to search for available mounts"))
483 if code != self._DLG_OK: 483 if code != self._DLG_OK:
484 continue 484 continue
485 if not GLIUtility.is_nfs(nfsmount): 485 if not GLIUtility.is_nfs(nfsmount):
486 if GLIUtility.is_ip(nfsmount) or GLIUtility.is_hostname(nfsmount): 486 if GLIUtility.is_ip(nfsmount) or GLIUtility.is_hostname(nfsmount):
488 if not len(remotemounts): 488 if not len(remotemounts):
489 self._d.msgbox(_(u"No NFS exports were detected on ") + nfsmount) 489 self._d.msgbox(_(u"No NFS exports were detected on ") + nfsmount)
490 continue 490 continue
491 for i in range(0, len(remotemounts)): 491 for i in range(0, len(remotemounts)):
492 remotemounts[i] = string.strip(remotemounts[i]) 492 remotemounts[i] = string.strip(remotemounts[i])
493 code, nfsmount2 = self._d.menu("Select a NFS export", choices=self._dmenu_list_to_choices(remotemounts), cancel="Back") 493 code, nfsmount2 = self._d.menu(_(u"Select a NFS export"), choices=self._dmenu_list_to_choices(remotemounts), cancel=_(u"Back"))
494 if code != self._DLG_OK: 494 if code != self._DLG_OK:
495 continue 495 continue
496 nfsmount2 = remotemounts[int(nfsmount2)-1] 496 nfsmount2 = remotemounts[int(nfsmount2)-1]
497 else: 497 else:
498 self._d.msgbox("The address you entered, '" + nfsmount + "', is not a valid IP or hostname. Please try again.") 498 self._d.msgbox(_(u"The address you entered, %s, is not a valid IP or hostname. Please try again.") % nfsmount)
499 continue 499 continue
500 else: 500 else:
501 colon_location = nfsmount.find(':') 501 colon_location = nfsmount.find(':')
502 menuitem = nfsmount 502 menuitem = nfsmount
503 nfsmount = menuitem[:colon_location] 503 nfsmount = menuitem[:colon_location]
504 nfsmount2 = menuitem[colon_location+1:] 504 nfsmount2 = menuitem[colon_location+1:]
505 for mount in network_mounts: 505 for mount in network_mounts:
506 if nfsmount == mount['host'] and nfsmount2 == mount['export']: 506 if nfsmount == mount['host'] and nfsmount2 == mount['export']:
507 self._d.msgbox("There is already an entry for " + nfsmount + ":" + nfsmount2 + ".") 507 self._d.msgbox(_(u"There is already an entry for ") + nfsmount + ":" + nfsmount2 + ".")
508 nfsmount = None 508 nfsmount = None
509 break 509 break
510 if nfsmount == None: 510 if nfsmount == None:
511 continue 511 continue
512 network_mounts.append({'export': nfsmount2, 'host': nfsmount, 'mountopts': '', 'mountpoint': '', 'type': 'nfs'}) 512 network_mounts.append({'export': nfsmount2, 'host': nfsmount, 'mountopts': '', 'mountpoint': '', 'type': 'nfs'})
514 menuitemidx = len(network_mounts) 514 menuitemidx = len(network_mounts)
515 515
516 if menuitem.find(':') != -1: 516 if menuitem.find(':') != -1:
517 colon_location = menuitem.find(':') 517 colon_location = menuitem.find(':')
518 tmpmount = network_mounts[int(menuitemidx)-1] 518 tmpmount = network_mounts[int(menuitemidx)-1]
519 code, mountpoint = self._d.inputbox("Enter a mountpoint", init=tmpmount['mountpoint']) 519 code, mountpoint = self._d.inputbox(_(u"Enter a mountpoint"), init=tmpmount['mountpoint'])
520 if code == self._DLG_OK: 520 if code == self._DLG_OK:
521 tmpmount['mountpoint'] = mountpoint 521 tmpmount['mountpoint'] = mountpoint
522 code, mountopts = self._d.inputbox("Enter mount options", init=tmpmount['mountopts']) 522 code, mountopts = self._d.inputbox(_(u"Enter mount options"), init=tmpmount['mountopts'])
523 if code == self._DLG_OK: 523 if code == self._DLG_OK:
524 tmpmount['mountopts'] = mountopts 524 tmpmount['mountopts'] = mountopts
525 network_mounts[int(menuitemidx)-1] = tmpmount 525 network_mounts[int(menuitemidx)-1] = tmpmount
526 526
527 def _set_make_conf(self): 527 def _set_make_conf(self):
600 make_conf["ACCEPT_KEYWORDS"] = "" 600 make_conf["ACCEPT_KEYWORDS"] = ""
601 else: #Unstable 601 else: #Unstable
602 make_conf["ACCEPT_KEYWORDS"] = "~" + self._client_profile.get_architecture_template() 602 make_conf["ACCEPT_KEYWORDS"] = "~" + self._client_profile.get_architecture_template()
603 #Third, misc. stuff. 603 #Third, misc. stuff.
604 while 1: 604 while 1:
605 menulist = [("CFLAGS","Edit your C Flags and Optimization level"), ("CHOST", "Change the Host Setting"), ("MAKEOPTS", "Specify number of parallel makes (-j) to perform. (ex. CPUs+1)"), ("FEATURES", "Change portage functionality settings."), ("GENTOO_MIRRORS", "Specify mirrors to use for source retrieval."), ("SYNC", "Specify server used by rsync to sync the portage tree.")] 605 menulist = [("CFLAGS",_(u"Edit your C Flags and Optimization level")), ("CHOST", _(u"Change the Host Setting")), ("MAKEOPTS", _(u"Specify number of parallel makes (-j) to perform. (ex. CPUs+1)")), ("FEATURES", _(u"Change portage functionality settings.")), ("GENTOO_MIRRORS", _(u"Specify mirrors to use for source retrieval.")), ("SYNC", _(u"Specify server used by rsync to sync the portage tree."))]
606 code, menuitem = self._d.menu(_(u"For experienced users, the following /etc/make.conf variables can also be defined. Choose a variable to edit or Done to continue."), choices=menulist, cancel="Done") 606 code, menuitem = self._d.menu(_(u"For experienced users, the following /etc/make.conf variables can also be defined. Choose a variable to edit or Done to continue."), choices=menulist, cancel=_(u"Done"))
607 if code != self._DLG_OK: 607 if code != self._DLG_OK:
608 self._install_profile.set_make_conf(make_conf) 608 self._install_profile.set_make_conf(make_conf)
609 break 609 break
610 oldval = "" 610 oldval = ""
611 if make_conf.has_key(menuitem): 611 if make_conf.has_key(menuitem):
612 oldval = make_conf[menuitem] 612 oldval = make_conf[menuitem]
613 code, newval = self._d.inputbox("Enter new value for " + menuitem, init=oldval) 613 code, newval = self._d.inputbox(_(u"Enter new value for ") + menuitem, init=oldval)
614 if code == self._DLG_OK: 614 if code == self._DLG_OK:
615 make_conf[menuitem] = newval 615 make_conf[menuitem] = newval
616 616
617 617
618 def _set_kernel(self): 618 def _set_kernel(self):
619 # This section will be for choosing kernel sources, choosing (and specifying) a custom config or genkernel, modules to load at startup, etc. 619 # This section will be for choosing kernel sources, choosing (and specifying) a custom config or genkernel, modules to load at startup, etc.
620 kernel_sources = [("vanilla-sources", "The Unaltered Linux Kernel ver 2.6+ (safest)"), ("gentoo-sources", "Gentoo's optimized 2.6+ kernel. (less safe)"), ("hardened-sources", "Hardened sources for the 2.6 kernel tree"), ("grsec-sources","Vanilla sources with grsecurity patches"), ("livecd-kernel", "Use the current running kernel for the new system (fastest)"), ("Other", "Choose one of the other sources available.")] 620 kernel_sources = [("vanilla-sources", _(u"The Unaltered Linux Kernel ver 2.6+ (safest)")), ("gentoo-sources", _(u"Gentoo's optimized 2.6+ kernel. (less safe)")), ("hardened-sources", _(u"Hardened sources for the 2.6 kernel tree")), ("grsec-sources",_(u"Vanilla sources with grsecurity patches")), ("livecd-kernel", _(u"Use the current running kernel for the new system (fastest)")), (_(u"Other"), _(u"Choose one of the other sources available."))]
621 code, menuitem = self._d.menu(_(u"Choose which kernel sources to use for your system. If using a previously-made kernel configuration, make sure the sources match the kernel used to create the configuration."), choices=kernel_sources) 621 code, menuitem = self._d.menu(_(u"Choose which kernel sources to use for your system. If using a previously-made kernel configuration, make sure the sources match the kernel used to create the configuration."), choices=kernel_sources)
622 if code != self._DLG_OK: 622 if code != self._DLG_OK:
623 return 623 return
624 if menuitem == "Other": 624 if menuitem == _(u"Other"):
625 code, menuitem = self._d.inputbox(_(u"Please enter the desired kernel sources package name:")) 625 code, menuitem = self._d.inputbox(_(u"Please enter the desired kernel sources package name:"))
626 if code != self._DLG_OK: return 626 if code != self._DLG_OK: return
627 try: 627 try:
628 self._install_profile.set_kernel_source_pkg(None, menuitem, None) 628 self._install_profile.set_kernel_source_pkg(None, menuitem, None)
629 except: 629 except:
630 self._d.msgbox("ERROR! Could not set the kernel source package!") 630 self._d.msgbox(_(u"ERROR! Could not set the kernel source package!"))
631 if not menuitem == "livecd-kernel": 631 if not menuitem == "livecd-kernel":
632 #Change the Yes/No buttons to new labels for this question. 632 #Change the Yes/No buttons to new labels for this question.
633 self._d.add_persistent_args(["--yes-label", _(u"Genkernel")]) 633 self._d.add_persistent_args(["--yes-label", _(u"Genkernel")])
634 self._d.add_persistent_args(["--no-label", _(u"Traditional (requires config file!)")]) 634 self._d.add_persistent_args(["--no-label", _(u"Traditional (requires config file!)")])
635 string1 = _(u"There are currently two ways the installer can compile a kernel for your new system. You can either provide a previously-made kernel configuration file and use the traditional kernel-compiling procedure (no initrd) or have genkernel automatically create your kernel for you (with initrd). \n\n If you do not have a previously-made kernel configuration, YOU MUST CHOOSE Genkernel. Choose which method you want to use.") 635 string1 = _(u"There are currently two ways the installer can compile a kernel for your new system. You can either provide a previously-made kernel configuration file and use the traditional kernel-compiling procedure (no initrd) or have genkernel automatically create your kernel for you (with initrd). \n\n If you do not have a previously-made kernel configuration, YOU MUST CHOOSE Genkernel. Choose which method you want to use.")
636 if self._d.yesno(string1, width=70, height=13) == self._DLG_YES: #Genkernel 636 if self._d.yesno(string1, width=70, height=13) == self._DLG_YES: #Genkernel
637 self._install_profile.set_kernel_build_method(None,"genkernel", None) 637 self._install_profile.set_kernel_build_method(None,"genkernel", None)
638 #Change the Yes/No buttons back. 638 #Change the Yes/No buttons back.
639 self._d.add_persistent_args(["--yes-label", _(u"Yes")]) 639 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
640 self._d.add_persistent_args(["--no-label", _(u"No")]) 640 self._d.add_persistent_args(["--no-label", _(u"No")])
641 if self._d.yesno("Do you want the bootsplash screen to show up on bootup?") == self._DLG_YES: 641 if self._d.yesno(_(u"Do you want the bootsplash screen to show up on bootup?")) == self._DLG_YES:
642 self._install_profile.set_kernel_bootsplash(None, True, None) 642 self._install_profile.set_kernel_bootsplash(None, True, None)
643 else: 643 else:
644 self._install_profile.set_kernel_bootsplash(None, False, None) 644 self._install_profile.set_kernel_bootsplash(None, False, None)
645 else: #Custom 645 else: #Custom
646 self._install_profile.set_kernel_build_method(None,"custom", None) 646 self._install_profile.set_kernel_build_method(None,"custom", None)
659 659
660 660
661 661
662 def _set_install_stage(self): 662 def _set_install_stage(self):
663 # The install stage and stage tarball will be selected here 663 # The install stage and stage tarball will be selected here
664 install_stages = (("1","Stage1 is used when you want to bootstrap and build the entire system from scratch."), ("2","Stage2 is used for building the entire system from a bootstrapped semi-compiled state."), ("3","Stage3 installation is a basic Gentoo Linux system that has been built for you (no compiling)."), ("3 + GRP", "A Stage3 install but using binary packages from the LiveCD whenever possible")) 664 install_stages = (("1",_(u"Stage1 is used when you want to bootstrap and build the entire system from scratch.")), ("2",_(u"Stage2 is used for building the entire system from a bootstrapped semi-compiled state.")), ("3",_(u"Stage3 installation is a basic Gentoo Linux system that has been built for you (no compiling).")), ("3 + GRP", _(u"A Stage3 install but using binary packages from the LiveCD whenever possible")))
665 code, install_stage = self._d.menu("Which stage do you want to start at?", choices=install_stages, cancel="Back") 665 code, install_stage = self._d.menu(_(u"Which stage do you want to start at?"), choices=install_stages, cancel=_(u"Back"), width=77)
666 if code == self._DLG_OK: 666 if code == self._DLG_OK:
667 if install_stage == "3 + GRP": 667 if install_stage == "3 + GRP":
668 install_stage = "3" 668 install_stage = "3"
669 try: 669 try:
670 self._install_profile.set_grp_install(None, True, None) 670 self._install_profile.set_grp_install(None, True, None)
671 self._install_profile.set_install_stage(None, install_stage, None) 671 self._install_profile.set_install_stage(None, install_stage, None)
672 except: 672 except:
673 self._d.msgbox("ERROR! Could not set install stage!") 673 self._d.msgbox(_(u"ERROR! Could not set install stage!"))
674 #Change the Yes/No buttons to new labels for this question. 674 #Change the Yes/No buttons to new labels for this question.
675 self._d.add_persistent_args(["--yes-label", _(u"Use Local")]) 675 self._d.add_persistent_args(["--yes-label", _(u"Use Local")])
676 self._d.add_persistent_args(["--no-label", _(u"Specify URI")]) 676 self._d.add_persistent_args(["--no-label", _(u"Specify URI")])
677 if self._d.yesno(_(u"Do you want to use a local tarball on the LiveCD (or other local location) or do you want to grab your stage tarball from the Internet?")) == self._DLG_YES: 677 if self._d.yesno(_(u"Do you want to use a local tarball on the LiveCD (or other local location) or do you want to grab your stage tarball from the Internet?")) == self._DLG_YES:
678 #Use Local 678 #Use Local
679 stages_dir = "/mnt/cdrom/stages" 679 stages_dir = "/mnt/cdrom/stages"
680 if os.path.isdir(stages_dir) and os.listdir(stages_dir): 680 if os.path.isdir(stages_dir) and os.listdir(stages_dir):
681 local_tarballs = glob.glob(stages_dir + "/stage" + install_stage + "*.bz2") 681 local_tarballs = glob.glob(stages_dir + "/stage" + install_stage + "*.bz2")
682 local_tarballs.sort() 682 local_tarballs.sort()
683 code, stage_tarball = self._d.menu("Select a local tarball:", choices=self._dmenu_list_to_choices(local_tarballs)) 683 code, stage_tarball = self._d.menu(_(u"Select a local tarball:"), choices=self._dmenu_list_to_choices(local_tarballs))
684 if code != self._DLG_OK: 684 if code != self._DLG_OK:
685 return 685 return
686 stage_tarball = local_tarballs[int(stage_tarball)-1] 686 stage_tarball = local_tarballs[int(stage_tarball)-1]
687 try: 687 try:
688 self._install_profile.set_stage_tarball_uri(None, stage_tarball, None) 688 self._install_profile.set_stage_tarball_uri(None, stage_tarball, None)
689 except: 689 except:
690 self._d.msgbox("ERROR: Could not set the stage tarball URI!") 690 self._d.msgbox(_(u"ERROR: Could not set the stage tarball URI!"))
691 return 691 return
692 else: 692 else:
693 self._d.msgbox("There don't seem to be any local tarballs available. Hit OK to manually specify a URI.") 693 self._d.msgbox(_(u"There don't seem to be any local tarballs available. Hit OK to manually specify a URI."))
694 694
695 #Specify URI 695 #Specify URI
696 subarches = { 'x86': ("x86", "i686", "pentium3", "pentium4", "athlon-xp"), 'hppa': ("hppa1.1", "hppa2.0"), 'ppc': ("g3", "g4", "g5", "ppc"), 'sparc': ("sparc32", "sparc64")} 696 #subarches = { 'x86': ("x86", "i686", "pentium3", "pentium4", "athlon-xp"), 'hppa': ("hppa1.1", "hppa2.0"), 'ppc': ("g3", "g4", "g5", "ppc"), 'sparc': ("sparc32", "sparc64")}
697 type_it_in = False 697 type_it_in = False
698 stage_tarball = "" 698 stage_tarball = ""
699 if GLIUtility.ping("www.gentoo.org"): #Test for network connectivity 699 if GLIUtility.ping("www.gentoo.org"): #Test for network connectivity
700 mirrors = GLIUtility.list_mirrors() 700 mirrors = GLIUtility.list_mirrors()
701 mirrornames = [] 701 mirrornames = []
702 mirrorurls = [] 702 mirrorurls = []
703 for item in mirrors: 703 for item in mirrors:
704 mirrornames.append(item[1]) 704 mirrornames.append(item[1])
705 mirrorurls.append(item[0]) 705 mirrorurls.append(item[0])
706 code, mirror = self._d.menu("Select a mirror to grab the tarball from or select Cancel to enter an URI manually.", choices=self._dmenu_list_to_choices(mirrornames), width=77, height=20) 706 code, mirror = self._d.menu(_(u"Select a mirror to grab the tarball from or select Cancel to enter an URI manually."), choices=self._dmenu_list_to_choices(mirrornames), width=77, height=20)
707 if code != self._DLG_OK: 707 if code != self._DLG_OK:
708 type_it_in = True 708 type_it_in = True
709 else: 709 else:
710 mirror = mirrorurls[int(mirror)-1] 710 mirror = mirrorurls[int(mirror)-1]
711 arch = self._client_profile.get_architecture_template() 711 arch = self._client_profile.get_architecture_template()
712 subarches = GLIUtility.list_subarch_from_mirror(mirror,arch) 712 subarches = GLIUtility.list_subarch_from_mirror(mirror,arch)
713 code, subarch = self._d.menu("Select the sub-architecture that most closely matches your system (this changes the amount of optimization):", choices=self._dmenu_list_to_choices(subarches)) 713 code, subarch = self._d.menu(_(u"Select the sub-architecture that most closely matches your system (this changes the amount of optimization):"), choices=self._dmenu_list_to_choices(subarches))
714 if code != self._DLG_OK: 714 if code != self._DLG_OK:
715 type_it_in = True 715 type_it_in = True
716 else: 716 else:
717 subarch = subarches[int(subarch)-1] 717 subarch = subarches[int(subarch)-1]
718 tarballs = GLIUtility.list_stage_tarballs_from_mirror(mirror, arch, subarch) 718 tarballs = GLIUtility.list_stage_tarballs_from_mirror(mirror, arch, subarch)
719 code, stage_tarball = self._d.menu("Select your desired stage tarball:", choices=self._dmenu_list_to_choices(tarballs)) 719 code, stage_tarball = self._d.menu(_(u"Select your desired stage tarball:"), choices=self._dmenu_list_to_choices(tarballs))
720 if (code != self._DLG_OK): 720 if (code != self._DLG_OK):
721 type_it_in = True 721 type_it_in = True
722 else: 722 else:
723 stage_tarball = mirror + "/releases/" + arch + "/current/stages/" + subarch + tarballs[int(stage_tarball)-1] 723 stage_tarball = mirror + "/releases/" + arch + "/current/stages/" + subarch + tarballs[int(stage_tarball)-1]
724 #get portageq envvar value of cflags and look for x86, i686,etc. 724 #get portageq envvar value of cflags and look for x86, i686,etc.
725 #URL SYNTAX 725 #URL SYNTAX
726 #http://gentoo.osuosl.org/releases/ARCHITECTURE/current/stages/SUB-ARCH/ 726 #http://gentoo.osuosl.org/releases/ARCHITECTURE/current/stages/SUB-ARCH/
727 else: 727 else:
728 type_it_in = True 728 type_it_in = True
729 if type_it_in: 729 if type_it_in:
730 code, stage_tarball = self._d.inputbox("Specify the stage tarball URI or local file:", init=self._install_profile.get_stage_tarball_uri()) 730 code, stage_tarball = self._d.inputbox(_(u"Specify the stage tarball URI or local file:"), init=self._install_profile.get_stage_tarball_uri())
731 if code != self._DLG_OK: 731 if code != self._DLG_OK:
732 return 732 return
733 #If Doing a local install, check for valid file:/// uri 733 #If Doing a local install, check for valid file:/// uri
734 if stage_tarball: 734 if stage_tarball:
735 if not GLIUtility.is_uri(stage_tarball, checklocal=self.local_install): 735 if not GLIUtility.is_uri(stage_tarball, checklocal=self.local_install):
736 self._d.msgbox("The specified URI is invalid. It was not saved. Please go back and try again."); 736 self._d.msgbox(_(u"The specified URI is invalid. It was not saved. Please go back and try again."));
737 else: self._install_profile.set_stage_tarball_uri(None, stage_tarball, None) 737 else: self._install_profile.set_stage_tarball_uri(None, stage_tarball, None)
738 else: self._d.msgbox("No URI was specified!") 738 else: self._d.msgbox(_(u"No URI was specified!"))
739 #if d.yesno("The specified URI is invalid. Use it anyway?") == DLG_YES: install_profile.set_stage_tarball_uri(None, stage_tarball, None) 739 #if d.yesno("The specified URI is invalid. Use it anyway?") == DLG_YES: install_profile.set_stage_tarball_uri(None, stage_tarball, None)
740 740
741 def _set_boot_loader(self): 741 def _set_boot_loader(self):
742 arch = self._client_profile.get_architecture_template() 742 arch = self._client_profile.get_architecture_template()
743 arch_loaders = { 'x86': [("grub","GRand Unified Bootloader, newer, RECOMMENDED"),("lilo","LInux LOader, older, traditional.(detects windows partitions)")], 'amd64': [("grub","GRand Unified Bootloader, newer, RECOMMENDED")]} #FIXME ADD OTHER ARCHS 743 arch_loaders = { 'x86': [("grub",_(u"GRand Unified Bootloader, newer, RECOMMENDED")),("lilo",_(u"LInux LOader, older, traditional.(detects windows partitions)"))], 'amd64': [("grub",_(u"GRand Unified Bootloader, newer, RECOMMENDED"))]} #FIXME ADD OTHER ARCHS
744 boot_loaders = arch_loaders[arch] 744 boot_loaders = arch_loaders[arch]
745 boot_loaders.append(("none", "Do not install a bootloader. (System may be unbootable!)")) 745 boot_loaders.append(("none", _(u"Do not install a bootloader. (System may be unbootable!)")))
746 string1 = _(u"To boot successfully into your new Linux system, a bootloader will be needed. If you already have a bootloader you want to use you can select None here. The bootloader choices available are dependent on what GLI supports and what architecture your system is. Choose a bootloader") 746 string1 = _(u"To boot successfully into your new Linux system, a bootloader will be needed. If you already have a bootloader you want to use you can select None here. The bootloader choices available are dependent on what GLI supports and what architecture your system is. Choose a bootloader")
747 code, menuitem = self._d.menu(string1, choices=boot_loaders) 747 code, menuitem = self._d.menu(string1, choices=boot_loaders)
748 if code != self._DLG_OK: 748 if code != self._DLG_OK:
749 return 749 return
750 try: 750 try:
751 self._install_profile.set_boot_loader_pkg(None, menuitem, None) 751 self._install_profile.set_boot_loader_pkg(None, menuitem, None)
752 except: 752 except:
753 self._d.msgbox(_(u"ERROR! Could not set boot loader pkg! ")+menuitem) 753 self._d.msgbox(_(u"ERROR! Could not set boot loader pkg! ")+menuitem)
754 if menuitem != "none": 754 if menuitem != "none":
755 #Reset the Yes/No labels. 755 #Reset the Yes/No labels.
756 self._d.add_persistent_args(["--yes-label", "Yes"]) 756 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
757 self._d.add_persistent_args(["--no-label","No"]) 757 self._d.add_persistent_args(["--no-label",_(u"No")])
758 if self._d.yesno(_(u"Most bootloaders have the ability to install to either the Master Boot Record (MBR) or some other partition. Most people will want their bootloader installed on the MBR for successful boots, but if you have special circumstances, you can have the bootloader installed to the /boot partition instead. Do you want the boot loader installed in the MBR? (YES is RECOMMENDED)")) == self._DLG_YES: 758 if self._d.yesno(_(u"Most bootloaders have the ability to install to either the Master Boot Record (MBR) or some other partition. Most people will want their bootloader installed on the MBR for successful boots, but if you have special circumstances, you can have the bootloader installed to the /boot partition instead. Do you want the boot loader installed in the MBR? (YES is RECOMMENDED)")) == self._DLG_YES:
759 self._install_profile.set_boot_loader_mbr(None, True, None) 759 self._install_profile.set_boot_loader_mbr(None, True, None)
760 else: 760 else:
761 self._install_profile.set_boot_loader_mbr(None, False, None) 761 self._install_profile.set_boot_loader_mbr(None, False, None)
762 code, bootloader_kernel_args = self._d.inputbox(_(u"If you have any additional optional arguments you want to pass to the kernel at boot, type them here or just press Enter to continue:")) 762 code, bootloader_kernel_args = self._d.inputbox(_(u"If you have any additional optional arguments you want to pass to the kernel at boot, type them here or just press Enter to continue:"))
788 string1 = _(u"Here you will enter all of your network interface information for the new system. You can either choose a network interface to edit, add a network interface, delete an interface, or edit the miscellaneous options such as hostname and proxy servers.") 788 string1 = _(u"Here you will enter all of your network interface information for the new system. You can either choose a network interface to edit, add a network interface, delete an interface, or edit the miscellaneous options such as hostname and proxy servers.")
789 string2 = _(u"To setup your network interface, you can either use DHCP if enabled, or manually enter your network information.\n DHCP (Dynamic Host Configuration Protocol) makes it possible to automatically receive networking information (IP address, netmask, broadcast address, gateway, nameservers etc.). This only works if you have a DHCP server in your network (or if your provider provides a DHCP service). If you do not, you must enter the information manually. Please select your networking configuration method:") 789 string2 = _(u"To setup your network interface, you can either use DHCP if enabled, or manually enter your network information.\n DHCP (Dynamic Host Configuration Protocol) makes it possible to automatically receive networking information (IP address, netmask, broadcast address, gateway, nameservers etc.). This only works if you have a DHCP server in your network (or if your provider provides a DHCP service). If you do not, you must enter the information manually. Please select your networking configuration method:")
790 choice_list = [] 790 choice_list = []
791 for iface in interfaces: 791 for iface in interfaces:
792 if interfaces[iface][0] == 'dhcp': 792 if interfaces[iface][0] == 'dhcp':
793 choice_list.append((iface, "Settings: DHCP. Options: "+ interfaces[iface][1])) 793 choice_list.append((iface, _(u"Settings: DHCP. Options: ")+ interfaces[iface][1]))
794 else: 794 else:
795 choice_list.append((iface, "Settings: IP: "+interfaces[iface][0]+" Broadcast: "+interfaces[iface][1]+" Netmask: "+interfaces[iface][2])) 795 choice_list.append((iface, _(u"IP: ")+interfaces[iface][0]+_(u" Broadcast: ")+interfaces[iface][1]+" Netmask: "+interfaces[iface][2]))
796 choice_list.append(("Add","Add a new network interface")) 796 choice_list.append(("Add",_(u"Add a new network interface")))
797 code, iface_choice = self._d.menu(string1, choices=choice_list, cancel="Save and Continue", height=18, width=67) 797 code, iface_choice = self._d.menu(string1, choices=choice_list, cancel=_(u"Save and Continue"), height=18, width=67)
798 if code != self._DLG_OK: 798 if code != self._DLG_OK:
799 try: 799 try:
800 self._install_profile.set_network_interfaces(interfaces) 800 self._install_profile.set_network_interfaces(interfaces)
801 except: 801 except:
802 self_d.msgbox(_(u"ERROR! Could not set the network interfaces!")) 802 self_d.msgbox(_(u"ERROR! Could not set the network interfaces!"))
806 device_list = GLIUtility.get_eth_devices() 806 device_list = GLIUtility.get_eth_devices()
807 newchoice_list = [] 807 newchoice_list = []
808 for device in device_list: 808 for device in device_list:
809 if device not in interfaces: 809 if device not in interfaces:
810 newchoice_list.append((device, GLIUtility.get_interface_realname(device))) 810 newchoice_list.append((device, GLIUtility.get_interface_realname(device)))
811 newchoice_list.append(("Other","Type your own.")) 811 newchoice_list.append((_(u"Other"),_(u"Type your own.")))
812 code, newnic = self._d.menu(_("Choose an interface from the list or Other to type your own if it was not detected."), choices=newchoice_list, width=75) 812 code, newnic = self._d.menu(_("Choose an interface from the list or Other to type your own if it was not detected."), choices=newchoice_list, width=75)
813 else: 813 else:
814 newnic == "Other" 814 newnic == _(u"Other")
815 if newnic == "Other": 815 if newnic == _(u"Other"):
816 code, newnic = self._d.inputbox("Enter name for new interface (eth0, ppp0, etc.)") 816 code, newnic = self._d.inputbox(_(u"Enter name for new interface (eth0, ppp0, etc.)"))
817 if code != self._DLG_OK: 817 if code != self._DLG_OK:
818 continue 818 continue
819 if newnic in interfaces: 819 if newnic in interfaces:
820 self._d.msgbox("An interface with the name is already defined.") 820 self._d.msgbox(_(u"An interface with the name is already defined."))
821 continue 821 continue
822 #create the interface in the data structure. 822 #create the interface in the data structure.
823 #interfaces[newnic] = ("", "", "") 823 #interfaces[newnic] = ("", "", "")
824 #Change the Yes/No buttons to new labels for this question. 824 #Change the Yes/No buttons to new labels for this question.
825 self._d.add_persistent_args(["--yes-label", _(u"DHCP")]) 825 self._d.add_persistent_args(["--yes-label", _(u"DHCP")])
828 dhcp_options = "" 828 dhcp_options = ""
829 code, dhcp_options = self._d.inputbox(_(u"If you have any additional DHCP options to pass, type them here in a space-separated list. If you have none, just press Enter."), height=13, width=50) 829 code, dhcp_options = self._d.inputbox(_(u"If you have any additional DHCP options to pass, type them here in a space-separated list. If you have none, just press Enter."), height=13, width=50)
830 interfaces[newnic] = ('dhcp', dhcp_options, None) 830 interfaces[newnic] = ('dhcp', dhcp_options, None)
831 else: 831 else:
832 network_type = 'static' 832 network_type = 'static'
833 code, data = self._d.form('Enter your networking information: (See Chapter 3 of the Handbook for more information) Your broadcast address is probably your IP address with 255 as the last tuple. Do not press Enter until all fields are complete!', (('Enter your IP address:', 15),('Enter your Broadcast address:', 15),('Enter your Netmask:',15,'255.255.255.0'))) 833 code, data = self._d.form(_(u'Enter your networking information: (See Chapter 3 of the Handbook for more information) Your broadcast address is probably your IP address with 255 as the last tuple. Do not press Enter until all fields are complete!'), ((_(u'Enter your IP address:'), 15),(_(u'Enter your Broadcast address:'), 15),(_(u'Enter your Netmask:'),15,'255.255.255.0')))
834 (ip_address, broadcast, netmask) = data[:-1].split('\n') 834 (ip_address, broadcast, netmask) = data[:-1].split('\n')
835 if code != self._DLG_OK: 835 if code != self._DLG_OK:
836 continue 836 continue
837 #Set the info now that it's all gathered. 837 #Set the info now that it's all gathered.
838 interfaces[newnic] = (ip_address, broadcast, netmask) 838 interfaces[newnic] = (ip_address, broadcast, netmask)
849 dhcp_options = "" 849 dhcp_options = ""
850 code, dhcp_options = self._d.inputbox(_(u"If you have any additional DHCP options to pass, type them here in a space-separated list. If you have none, just press Enter."), height=13, width=50) 850 code, dhcp_options = self._d.inputbox(_(u"If you have any additional DHCP options to pass, type them here in a space-separated list. If you have none, just press Enter."), height=13, width=50)
851 interfaces[iface_choice] = ('dhcp', dhcp_options, None) 851 interfaces[iface_choice] = ('dhcp', dhcp_options, None)
852 else: 852 else:
853 network_type = 'static' 853 network_type = 'static'
854 code, data = self._d.form('Enter your networking information: (See Chapter 3 of the Handbook for more information) Your broadcast address is probably your IP address with 255 as the last tuple. Do not press Enter until all fields are complete!', (('Enter your IP address:', 15, interfaces[iface_choice][0]),('Enter your Broadcast address:', 15, interfaces[iface_choice][1]),('Enter your Netmask:',15,interfaces[iface_choice][2]))) 854 code, data = self._d.form(_(u'Enter your networking information: (See Chapter 3 of the Handbook for more information) Your broadcast address is probably your IP address with 255 as the last tuple. Do not press Enter until all fields are complete!'), ((_(u'Enter your IP address:'), 15, interfaces[iface_choice][0]),(_(u'Enter your Broadcast address:'), 15, interfaces[iface_choice][1]),(_(u'Enter your Netmask:'),15,interfaces[iface_choice][2])))
855 (ip_address, broadcast, netmask) = data[:-1].split('\n') 855 (ip_address, broadcast, netmask) = data[:-1].split('\n')
856 if code != self._DLG_OK: 856 if code != self._DLG_OK:
857 continue 857 continue
858 #Set the info now that it's all gathered. 858 #Set the info now that it's all gathered.
859 interfaces[iface_choice] = (ip_address, broadcast, netmask) 859 interfaces[iface_choice] = (ip_address, broadcast, netmask)
860 else: 860 else:
861 #Delete 861 #Delete
862 #Reset the Yes/No buttons 862 #Reset the Yes/No buttons
863 self._d.add_persistent_args(["--yes-label", _(u"Yes")]) 863 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
864 self._d.add_persistent_args(["--no-label", _(u"No")]) 864 self._d.add_persistent_args(["--no-label", _(u"No")])
865 if self._d.yesno("Are you sure you want to remove the interface " + iface_choice + "?") == self._DLG_YES: 865 if self._d.yesno(_(u"Are you sure you want to remove the interface ") + iface_choice + "?") == self._DLG_YES:
866 del interfaces[iface_choice] 866 del interfaces[iface_choice]
867 867
868 #This section is for defining DNS servers, default routes/gateways, hostname, etc. 868 #This section is for defining DNS servers, default routes/gateways, hostname, etc.
869 #First ask for the default gateway device and IP 869 #First ask for the default gateway device and IP
870 interfaces = self._install_profile.get_network_interfaces() 870 interfaces = self._install_profile.get_network_interfaces()
871 choice_list = [] 871 choice_list = []
872 for iface in interfaces: 872 for iface in interfaces:
873 if interfaces[iface][0] == 'dhcp': 873 if interfaces[iface][0] == 'dhcp':
874 choice_list.append((iface, "Settings: DHCP. Options: "+ interfaces[iface][1],0)) 874 choice_list.append((iface, _(u"Settings: DHCP. Options: ")+ interfaces[iface][1],0))
875 else: 875 else:
876 choice_list.append((iface, "Settings: IP: "+interfaces[iface][0]+" Broadcast: "+interfaces[iface][1]+" Netmask: "+interfaces[iface][2],0)) 876 choice_list.append((iface, _(u"IP: ")+interfaces[iface][0]+_(u" Broadcast: ")+interfaces[iface][1]+" Netmask: "+interfaces[iface][2],0))
877 string3 = _("To be able to surf on the internet, you must know which host shares the Internet connection. This host is called the gateway. It is usually similar to your IP address, but ending in .1\nIf you have DHCP then just select your primary Internet interface (no IP will be needed) Start by choosing which interface accesses the Internet:") 877 string3 = _("To be able to surf on the internet, you must know which host shares the Internet connection. This host is called the gateway. It is usually similar to your IP address, but ending in .1\nIf you have DHCP then just select your primary Internet interface (no IP will be needed) Start by choosing which interface accesses the Internet:")
878 code, gateway_iface = self._d.radiolist(string3, choices=choice_list, height=18, width=67) 878 code, gateway_iface = self._d.radiolist(string3, choices=choice_list, height=18, width=67)
879 if code == self._DLG_OK: #They made a choice. Ask the IP if not DHCP. 879 if code == self._DLG_OK: #They made a choice. Ask the IP if not DHCP.
880 while interfaces[gateway_iface][0] != 'dhcp': 880 while interfaces[gateway_iface][0] != 'dhcp':
881 code, ip = self._d.inputbox("Enter an IP address for " + gateway_iface, init=interfaces[gateway_iface][0]) 881 code, ip = self._d.inputbox(_(u"Enter the gateway IP address for ") + gateway_iface, init=interfaces[gateway_iface][0])
882 if code != self._DLG_OK: 882 if code != self._DLG_OK:
883 break 883 break
884 if not GLIUtility.is_ip(ip): 884 if not GLIUtility.is_ip(ip):
885 self._d.msgbox(_(u"Invalid IP Entered! Please try again.")) 885 self._d.msgbox(_(u"Invalid IP Entered! Please try again."))
886 continue 886 continue
891 break 891 break
892 #Now ask for the other info in a large form. 892 #Now ask for the other info in a large form.
893 error = True 893 error = True
894 while error: 894 while error:
895 error = False 895 error = False
896 code, data = self._d.form('Fill out the remaining networking settings. The hostname is manditory as that is the name of your computer. Leave the other fields blank if you are not using them. If using DHCP you do not need to enter DNS servers. Do not press Enter until all fields are complete!', (('Enter your Hostname:', 25, self._install_profile.get_hostname()),('Enter your Domain Name:', 25, self._install_profile.get_domainname()),('Enter your NIS Domain Name:',25,self._install_profile.get_nisdomainname()),('Enter a primary DNS server:',15),('Enter a backup DNS server:',15), ('Enter a HTTP Proxy IP:', 15,self._install_profile.get_http_proxy()),('Enter a FTP Proxy IP:', 15, self._install_profile.get_ftp_proxy()), ('Enter a RSYNC Proxy:',15,self._install_profile.get_rsync_proxy()))) 896 code, data = self._d.form(_(u'Fill out the remaining networking settings. The hostname is manditory as that is the name of your computer. Leave the other fields blank if you are not using them. If using DHCP you do not need to enter DNS servers. Do not press Enter until all fields are complete!'), ((_(u'Enter your Hostname:'), 25, self._install_profile.get_hostname()),(_(u'Enter your Domain Name:'), 25, self._install_profile.get_domainname()),(_(u'Enter your NIS Domain Name:'),25,self._install_profile.get_nisdomainname()),(_(u'Enter a primary DNS server:'),15),(_(u'Enter a backup DNS server:'),15), (_(u'Enter a HTTP Proxy IP:'), 15,self._install_profile.get_http_proxy()),(_(u'Enter a FTP Proxy IP:'), 15, self._install_profile.get_ftp_proxy()), (_(u'Enter a RSYNC Proxy:'),15,self._install_profile.get_rsync_proxy())))
897 if code != self._DLG_OK: 897 if code != self._DLG_OK:
898 return 898 return
899 (hostname, domainname, nisdomainname, primary_dns, backup_dns, http_proxy, ftp_proxy, rsync_proxy) = data[:-1].split('\n') 899 (hostname, domainname, nisdomainname, primary_dns, backup_dns, http_proxy, ftp_proxy, rsync_proxy) = data[:-1].split('\n')
900 #Check the data before entering it. 900 #Check the data before entering it.
901 if hostname: 901 if hostname:
944 except: 944 except:
945 self._d.msgbox(_(u"ERROR! Could not set the DNS Servers:")+primary_dns) 945 self._d.msgbox(_(u"ERROR! Could not set the DNS Servers:")+primary_dns)
946 error = True 946 error = True
947 if http_proxy: 947 if http_proxy:
948 if not GLIUtility.is_uri(http_proxy): 948 if not GLIUtility.is_uri(http_proxy):
949 self._d.msgbox("Incorrect HTTP Proxy! It must be a uri. Not saved.") 949 self._d.msgbox(_(u"Incorrect HTTP Proxy! It must be a uri. Not saved."))
950 error = True 950 error = True
951 else: 951 else:
952 try: 952 try:
953 self._install_profile.set_http_proxy(None, http_proxy, None) 953 self._install_profile.set_http_proxy(None, http_proxy, None)
954 except: 954 except:
955 self._d.msgbox(_(u"ERROR! Could not set the HTTP Proxy:")+http_proxy) 955 self._d.msgbox(_(u"ERROR! Could not set the HTTP Proxy:")+http_proxy)
956 error = True 956 error = True
957 if ftp_proxy: 957 if ftp_proxy:
958 if not GLIUtility.is_uri(ftp_proxy): 958 if not GLIUtility.is_uri(ftp_proxy):
959 self._d.msgbox("Incorrect FTP Proxy! It must be a uri. Not saved.") 959 self._d.msgbox(_(u"Incorrect FTP Proxy! It must be a uri. Not saved."))
960 error = True 960 error = True
961 else: 961 else:
962 try: 962 try:
963 self._install_profile.set_ftp_proxy(None, ftp_proxy, None) 963 self._install_profile.set_ftp_proxy(None, ftp_proxy, None)
964 except: 964 except:
965 self._d.msgbox(_(u"ERROR! Could not set the FTP Proxy:")+ftp_proxy) 965 self._d.msgbox(_(u"ERROR! Could not set the FTP Proxy:")+ftp_proxy)
966 error = True 966 error = True
967 if rsync_proxy: 967 if rsync_proxy:
968 if not GLIUtility.is_uri(rsync_proxy): 968 if not GLIUtility.is_uri(rsync_proxy):
969 self._d.msgbox("Incorrect RSYNC Proxy! It must be a uri. Not saved.") 969 self._d.msgbox(_(u"Incorrect RSYNC Proxy! It must be a uri. Not saved."))
970 error = True 970 error = True
971 else: 971 else:
972 try: 972 try:
973 self._install_profile.set_rsync_proxy(None, rsync_proxy, None) 973 self._install_profile.set_rsync_proxy(None, rsync_proxy, None)
974 except: 974 except:
975 self._d.msgbox(_(u"ERROR! Could not set the RSYNC Proxy:")+rsync_proxy) 975 self._d.msgbox(_(u"ERROR! Could not set the RSYNC Proxy:")+rsync_proxy)
976 error = True 976 error = True
977 977
978 def _set_cron_daemon(self): 978 def _set_cron_daemon(self):
979 cron_daemons = (("vixie-cron", "Paul Vixie's cron daemon, fully featured, RECOMMENDED."), ("dcron","A cute little cron from Matt Dillon."), ("fcron", "A command scheduler with extended capabilities over cron and anacron"), ("None", "Don't use a cron daemon. (NOT Recommended!)")) 979 cron_daemons = (("vixie-cron", _(u"Paul Vixie's cron daemon, fully featured, RECOMMENDED.")), ("dcron",_(u"A cute little cron from Matt Dillon.")), ("fcron", _(u"A command scheduler with extended capabilities over cron and anacron")), ("None", _(u"Don't use a cron daemon. (NOT Recommended!)")))
980 string = _(u"A cron daemon executes scheduled commands. It is very handy if you need to execute some command regularly (for instance daily, weekly or monthly). Gentoo offers three possible cron daemons: dcron, fcron and vixie-cron. Installing one of them is similar to installing a system logger. However, dcron and fcron require an extra configuration command, namely crontab /etc/crontab. If you don't know what to choose, use vixie-cron. If doing a networkless install, choose vixie-cron. Choose your cron daemon:") 980 string = _(u"A cron daemon executes scheduled commands. It is very handy if you need to execute some command regularly (for instance daily, weekly or monthly). Gentoo offers three possible cron daemons: dcron, fcron and vixie-cron. Installing one of them is similar to installing a system logger. However, dcron and fcron require an extra configuration command, namely crontab /etc/crontab. If you don't know what to choose, use vixie-cron. If doing a networkless install, choose vixie-cron. Choose your cron daemon:")
981 code, menuitem = self._d.menu(string, choices=cron_daemons, height=21, width=68) 981 code, menuitem = self._d.menu(string, choices=cron_daemons, height=21, width=68)
982 if code == self._DLG_OK: 982 if code == self._DLG_OK:
983 if menuitem == "None": 983 if menuitem == "None":
984 menuitem = "" 984 menuitem = ""
985 self._install_profile.set_cron_daemon_pkg(None, menuitem, None) 985 self._install_profile.set_cron_daemon_pkg(None, menuitem, None)
986 986
987 def _set_logger(self): 987 def _set_logger(self):
988 loggers = (("syslog-ng", "An advanced system logger."), ("metalog", "A Highly-configurable system logger."), ("syslogkd", "The traditional set of system logging daemons.")) 988 loggers = (("syslog-ng", _(u"An advanced system logger.")), ("metalog", _(u"A Highly-configurable system logger.")), ("syslogkd", _(u"The traditional set of system logging daemons.")))
989 string = _(u"Linux has an excellent history of logging capabilities -- if you want you can log everything that happens on your system in logfiles. This happens through the system logger. Gentoo offers several system loggers to choose from. If you plan on using sysklogd or syslog-ng you might want to install logrotate afterwards as those system loggers don't provide any rotation mechanism for the log files. Choose a system logger:") 989 string = _(u"Linux has an excellent history of logging capabilities -- if you want you can log everything that happens on your system in logfiles. This happens through the system logger. Gentoo offers several system loggers to choose from. If you plan on using sysklogd or syslog-ng you might want to install logrotate afterwards as those system loggers don't provide any rotation mechanism for the log files. Choose a system logger:")
990 code, menuitem = self._d.menu(string, choices=loggers, height=21, width=68) 990 code, menuitem = self._d.menu(string, choices=loggers, height=21, width=68)
991 if code == self._DLG_OK: 991 if code == self._DLG_OK:
992 self._install_profile.set_logging_daemon_pkg(None, menuitem, None) 992 self._install_profile.set_logging_daemon_pkg(None, menuitem, None)
993 993
994 def _set_extra_packages(self): 994 def _set_extra_packages(self):
995 #d.msgbox("This section is for selecting extra packages (pcmcia-cs, rp-pppoe, xorg-x11, etc.) and setting them up") 995 #d.msgbox("This section is for selecting extra packages (pcmcia-cs, rp-pppoe, xorg-x11, etc.) and setting them up")
996 install_packages = "" 996 install_packages = ""
997 while 1: 997 while 1:
998 highlevel_menu = [("Desktop", "Popular Desktop Applications"), ("Servers", "Applications often found on servers."), ("X11", "Window managers and X selection."), ("Misc", "Miscellaneous Applications you may want."), ("Recommended", "Applications recommended by the Gentoo Linux Installer Team."), ("Manual", "Type your own space-separated list of packages to install.")] 998 highlevel_menu = [(_(u"Desktop"), _(u"Popular Desktop Applications")), (_(u"Servers"), _(u"Applications often found on servers.")), (_(u"X11"), _(u"Window managers and X selection.")), (_(u"Misc"), _(u"Miscellaneous Applications you may want.")), (_(u"Recommended"), _(u"Applications recommended by the Gentoo Linux Installer Team.")), (_(u"Manual"), _(u"Type your own space-separated list of packages to install."))]
999 string1 = _(u"There are thousands of applications available to Gentoo users through Portage, Gentoo's package management system. Select some of the more common ones below or add your own additional package list by choosing 'Manual'.") 999 string1 = _(u"There are thousands of applications available to Gentoo users through Portage, Gentoo's package management system. Select some of the more common ones below or add your own additional package list by choosing 'Manual'.")
1000 code, submenu = self._d.menu(string1+ "\nYour current package list is: "+install_packages, choices=highlevel_menu, cancel="Save and Continue", width=70, height=23) 1000 code, submenu = self._d.menu(string1+ _(u"\nYour current package list is: ")+install_packages, choices=highlevel_menu, cancel=_(u"Save and Continue"), width=70, height=23)
1001 if code != self._DLG_OK: #Save and move on. 1001 if code != self._DLG_OK: #Save and move on.
1002 try: 1002 try:
1003 if install_packages[-1] == " ": 1003 if install_packages[-1] == " ":
1004 install_packages = install_packages[:-1] 1004 install_packages = install_packages[:-1]
1005 self._install_profile.set_install_packages(None, install_packages, None) 1005 self._install_profile.set_install_packages(None, install_packages, None)
1006 except: 1006 except:
1007 self._d.msgbox(_(u"ERROR! Could not set the install packages! List of packages:")+install_packages) 1007 self._d.msgbox(_(u"ERROR! Could not set the install packages! List of packages:")+install_packages)
1008 return 1008 return
1009 #Popular Desktop Applications 1009 #Popular Desktop Applications
1010 choices_list = [] 1010 choices_list = []
1011 if submenu == "Desktop": 1011 if submenu == _(u"Desktop"):
1012 choices_list = [("gaim","GTK Instant Messenger client",0), ("gftp","Gnome based FTP Client",0), ("evolution","A GNOME groupware application, a Microsoft Outlook workalike",0), ("mozilla-firefox","The Mozilla Firefox Web Browser",0), ("mplayer","Media Player for Linux",0), ("openoffice","OpenOffice.org, a full office productivity suite.",0), ("openoffice-bin","Same as OpenOffice but a binary package (no compiling!)",0), ("realplayer","Real Media Player",0), ("xchat","Graphical IRC Client",0), ("xmms", "X MultiMedia System",0)] 1012 choices_list = [("gaim","GTK Instant Messenger client",0), ("gftp","Gnome based FTP Client",0), ("evolution","A GNOME groupware application, a Microsoft Outlook workalike",0), ("mozilla-firefox","The Mozilla Firefox Web Browser",0), ("mplayer","Media Player for Linux",0), ("openoffice","OpenOffice.org, a full office productivity suite.",0), ("openoffice-bin","Same as OpenOffice but a binary package (no compiling!)",0), ("realplayer","Real Media Player",0), ("xchat","Graphical IRC Client",0), ("xmms", "X MultiMedia System",0)]
1013 #Applications often found on servers. 1013 #Applications often found on servers.
1014 elif submenu == "Servers": 1014 elif submenu == _(u"Servers"):
1015 choices_list = [("apache","Apache Web Server",0), ("iptables","Linux kernel (2.4+) firewall, NAT and packet mangling tools",0), ("proftpd","ProFTP Server",0), ("samba","SAMBA client/server programs for UNIX",0), ("traceroute","Utility to trace the route of IP packets",0)] 1015 choices_list = [("apache","Apache Web Server",0), ("iptables","Linux kernel (2.4+) firewall, NAT and packet mangling tools",0), ("proftpd","ProFTP Server",0), ("samba","SAMBA client/server programs for UNIX",0), ("traceroute","Utility to trace the route of IP packets",0)]
1016 #Window managers and X selection. 1016 #Window managers and X selection.
1017 elif submenu == "X11": 1017 elif submenu == _(u"X11"):
1018 choices_list = [("xorg-x11","An X11 implementation maintained by the X.Org Foundation.",0), ("gnome","The Gnome Desktop Environment",0), ("kde","The K Desktop Environment",0), ("blackbox","A small, fast, full-featured window manager for X",0), ("enlightenment","Enlightenment Window Manager",0), ("fluxbox","Fluxbox is an X11 window manager featuring tabs and an iconbar",0), ("xfce4","XFCE Desktop Environment",0)] 1018 choices_list = [("xorg-x11","An X11 implementation maintained by the X.Org Foundation.",0), ("gnome","The Gnome Desktop Environment",0), ("kde","The K Desktop Environment",0), ("blackbox","A small, fast, full-featured window manager for X",0), ("enlightenment","Enlightenment Window Manager",0), ("fluxbox","Fluxbox is an X11 window manager featuring tabs and an iconbar",0), ("xfce4","XFCE Desktop Environment",0)]
1019 #Miscellaneous Applications you may want. 1019 #Miscellaneous Applications you may want.
1020 elif submenu == "Misc": 1020 elif submenu == _(u"Misc"):
1021 choices_list = [("gkrellm","Single process stack of various system monitors",0), ("logrotate","Rotates, compresses, and mails system logs",0), ("slocate","Secure way to index and quickly search for files on your system",0), ("ufed","Gentoo Linux USE flags editor",0)] 1021 choices_list = [("gkrellm","Single process stack of various system monitors",0), ("logrotate","Rotates, compresses, and mails system logs",0), ("slocate","Secure way to index and quickly search for files on your system",0), ("ufed","Gentoo Linux USE flags editor",0)]
1022 #Recommended by the Gentoo Linux Installer Team 1022 #Recommended by the Gentoo Linux Installer Team
1023 elif submenu == "Recommended": 1023 elif submenu == _(u"Recommended"):
1024 choices_list = [("anjuta","A versatile IDE for GNOME",0), ("chkrootkit","a tool to locally check for signs of a rootkit",0), ("crack-attack","Addictive OpenGL-based block game",0), ("enemy-territory","Return to Castle Wolfenstein: Enemy Territory",0), ("netcat","the network swiss army knife",0), ("nmap","A utility for network exploration or security auditing",0), ("screen","full-screen window manager that multiplexes between several processes",0)] 1024 choices_list = [("anjuta","A versatile IDE for GNOME",0), ("chkrootkit","a tool to locally check for signs of a rootkit",0), ("crack-attack","Addictive OpenGL-based block game",0), ("enemy-territory","Return to Castle Wolfenstein: Enemy Territory",0), ("netcat","the network swiss army knife",0), ("nmap","A utility for network exploration or security auditing",0), ("screen","full-screen window manager that multiplexes between several processes",0)]
1025 elif submenu == "Manual": 1025 elif submenu == _(u"Manual"):
1026 code, install_packages = self._d.inputbox("Enter a space-separated list of extra packages to install on the system", init=install_packages, width=70) 1026 code, install_packages = self._d.inputbox(_(u"Enter a space-separated list of extra packages to install on the system"), init=install_packages, width=70)
1027 continue 1027 continue
1028 code, choices = self._d.checklist("Choose from the listed packages", choices=choices_list, height=19, list_height=10, width=77) 1028 code, choices = self._d.checklist(_(u"Choose from the listed packages"), choices=choices_list, height=19, list_height=10, width=77)
1029 if code != self._DLG_OK: 1029 if code != self._DLG_OK:
1030 continue 1030 continue
1031 for package in choices: 1031 for package in choices:
1032 install_packages += package + " " 1032 install_packages += package + " "
1033 def _set_rc_conf(self): 1033 def _set_rc_conf(self):
1051 # The root password will be set here 1051 # The root password will be set here
1052 while 1: 1052 while 1:
1053 code, passwd1 = self._d.passwordbox(_(u"Please enter your desired password for the root account. (note it will not show the password. Also do not try to use backspace.):")) 1053 code, passwd1 = self._d.passwordbox(_(u"Please enter your desired password for the root account. (note it will not show the password. Also do not try to use backspace.):"))
1054 if code != self._DLG_OK: 1054 if code != self._DLG_OK:
1055 return 1055 return
1056 code, passwd2 = self._d.passwordbox("Enter the new root password again for confirmation") 1056 code, passwd2 = self._d.passwordbox(_(u"Enter the new root password again for confirmation"))
1057 if code != self._DLG_OK: 1057 if code != self._DLG_OK:
1058 return 1058 return
1059 if passwd1 != passwd2: 1059 if passwd1 != passwd2:
1060 self._d.msgbox("The passwords do not match. Please try again or cancel.") 1060 self._d.msgbox(_(u"The passwords do not match. Please try again or cancel."))
1061 else: 1061 else:
1062 try: 1062 try:
1063 self._install_profile.set_root_pass_hash(None, GLIUtility.hash_password(passwd1), None) 1063 self._install_profile.set_root_pass_hash(None, GLIUtility.hash_password(passwd1), None)
1064 except: 1064 except:
1065 self._d.msgbox(_(u"ERROR! Could not set the new system root password!")) 1065 self._d.msgbox(_(u"ERROR! Could not set the new system root password!"))
1074 while 1: 1074 while 1:
1075 menu_list = [] 1075 menu_list = []
1076 for user in users: 1076 for user in users:
1077 menu_list.append(user) 1077 menu_list.append(user)
1078 menu_list.sort() 1078 menu_list.sort()
1079 menu_list.append("Add user") 1079 menu_list.append(_(u"Add user"))
1080 string1 = _(u"Working as root on a Unix/Linux system is dangerous and should be avoided as much as possible. Therefore it is strongly recommended to add a user for day-to-day use. Choose a user to edit:") 1080 string1 = _(u"Working as root on a Unix/Linux system is dangerous and should be avoided as much as possible. Therefore it is strongly recommended to add a user for day-to-day use. Choose a user to edit:")
1081 code, menuitem = self._d.menu(string1, choices=self._dmenu_list_to_choices(menu_list), cancel="Save and Continue") 1081 code, menuitem = self._d.menu(string1, choices=self._dmenu_list_to_choices(menu_list), cancel="Save and Continue")
1082 if code != self._DLG_OK: 1082 if code != self._DLG_OK:
1083 #if self._d.yesno("Do you want to save changes?") == self._DLG_YES: 1083 #if self._d.yesno("Do you want to save changes?") == self._DLG_YES:
1084 tmpusers = [] 1084 tmpusers = []
1088 self._install_profile.set_users(tmpusers) 1088 self._install_profile.set_users(tmpusers)
1089 except: 1089 except:
1090 self._d.msgbox(_(u"ERROR! Could not set the additional users!")) 1090 self._d.msgbox(_(u"ERROR! Could not set the additional users!"))
1091 break 1091 break
1092 menuitem = menu_list[int(menuitem)-1] 1092 menuitem = menu_list[int(menuitem)-1]
1093 if menuitem == "Add user": 1093 if menuitem == _(u"Add user"):
1094 code, newuser = self._d.inputbox("Enter the username for the new user") 1094 code, newuser = self._d.inputbox(_(u"Enter the username for the new user"))
1095 if code != self._DLG_OK: 1095 if code != self._DLG_OK:
1096 continue 1096 continue
1097 if newuser in users: 1097 if newuser in users:
1098 self._d.msgbox("A user with that name already exists") 1098 self._d.msgbox(_(u"A user with that name already exists"))
1099 continue 1099 continue
1100 code, passwd1 = self._d.passwordbox("Enter the new password for user "+ newuser) 1100 code, passwd1 = self._d.passwordbox(_(u"Enter the new password for user ")+ newuser)
1101 code, passwd2 = self._d.passwordbox("Enter the new password again for confirmation") 1101 code, passwd2 = self._d.passwordbox(_(u"Enter the new password again for confirmation"))
1102 if code == self._DLG_OK: 1102 if code == self._DLG_OK:
1103 if passwd1 != passwd2: 1103 if passwd1 != passwd2:
1104 self._d.msgbox("The passwords do not match! Go to the menu and try again.") 1104 self._d.msgbox(_(u"The passwords do not match! Go to the menu and try again."))
1105 #Create the entry for the new user 1105 #Create the entry for the new user
1106 new_user = [newuser, GLIUtility.hash_password(passwd1), ('users',), '/bin/bash', '/home/' + newuser, '', ''] 1106 new_user = [newuser, GLIUtility.hash_password(passwd1), ('users',), '/bin/bash', '/home/' + newuser, '', '']
1107 users[newuser] = new_user 1107 users[newuser] = new_user
1108 menuitem = newuser 1108 menuitem = newuser
1109 while 1: 1109 while 1:
1110 menulist = ["Password", "Group Membership", "Shell", "Home Directory", "UID", "Comment", "Delete"] 1110 menulist = [_(u"Password"), _(u"Group Membership"), _(u"Shell"), _(u"Home Directory"), _(u"UID"), _(u"Comment"), _(u"Delete")]
1111 code, menuitem2 = self._d.menu("Choose an option for user " + menuitem, choices=self._dmenu_list_to_choices(menulist), cancel="Back") 1111 code, menuitem2 = self._d.menu(_(u"Choose an option for user ") + menuitem, choices=self._dmenu_list_to_choices(menulist), cancel=_(u"Back"))
1112 if code != self._DLG_OK: 1112 if code != self._DLG_OK:
1113 break 1113 break
1114 menuitem2 = menulist[int(menuitem2)-1] 1114 menuitem2 = menulist[int(menuitem2)-1]
1115 if menuitem2 == "Password": 1115 if menuitem2 == _(u"Password"):
1116 code, passwd1 = self._d.passwordbox("Enter the new password") 1116 code, passwd1 = self._d.passwordbox(_(u"Enter the new password"))
1117 if code != self._DLG_OK: 1117 if code != self._DLG_OK:
1118 continue 1118 continue
1119 code, passwd2 = self._d.passwordbox("Enter the new password again") 1119 code, passwd2 = self._d.passwordbox(_(u"Enter the new password again"))
1120 if code != self._DLG_OK: 1120 if code != self._DLG_OK:
1121 continue 1121 continue
1122 if passwd1 != passwd2: 1122 if passwd1 != passwd2:
1123 self._d.msgbox("The passwords do not match! Try again.") 1123 self._d.msgbox(_(u"The passwords do not match! Try again."))
1124 continue 1124 continue
1125 self._d.msgbox(_(u"Password saved. Press Enter to continue.")) 1125 self._d.msgbox(_(u"Password saved. Press Enter to continue."))
1126 users[menuitem][1] = GLIUtility.hash_password(passwd1) 1126 users[menuitem][1] = GLIUtility.hash_password(passwd1)
1127 elif menuitem2 == "Group Membership": 1127 elif menuitem2 == _(u"Group Membership"):
1128 choice_list = [("users", "The usual group for normal users.", 1), ("wheel", "Allows users to attempt to su to root.", 0), ("audio", "Allows access to audio devices.", 0), ("games", "Allows access to games.", 0), ("apache", "For users who know what they're doing only.", 0), ("cdrom", "For users who know what they're doing only.", 0), ("ftp", "For users who know what they're doing only.", 0), ("video", "For users who know what they're doing only.", 0), ("Other", "Manually specify your groups in a comma-separated list.", 0)] 1128 choice_list = [("users", _(u"The usual group for normal users."), 1), ("wheel", _(u"Allows users to attempt to su to root."), 0), ("audio", _(u"Allows access to audio devices."), 0), ("games", _(u"Allows access to games."), 0), ("apache", _(u"For users who know what they're doing only."), 0), ("cdrom", _(u"For users who know what they're doing only."), 0), ("ftp", _(u"For users who know what they're doing only."), 0), ("video", _(u"For users who know what they're doing only."), 0), (_(u"Other"), _(u"Manually specify your groups in a comma-separated list."), 0)]
1129 string2 = _(u"Select which groups you would like the user %s to be in." % menuitem) 1129 string2 = _(u"Select which groups you would like the user %s to be in." % menuitem)
1130 code, group_list = self._d.checklist(string2, choices=choice_list, height=19, list_height=10, width=68) 1130 code, group_list = self._d.checklist(string2, choices=choice_list, height=19, list_height=10, width=68)
1131 groups = "" 1131 groups = ""
1132 for group in group_list: 1132 for group in group_list:
1133 groups += group + "," 1133 groups += group + ","
1134 groups = groups[:-1] 1134 groups = groups[:-1]
1135 if "Other" in group_list: 1135 if _(u"Other") in group_list:
1136 code, groups = self._d.inputbox("Enter a comma-separated list of groups the user is to be in", init=",".join(users[menuitem][2])) 1136 code, groups = self._d.inputbox(_(u"Enter a comma-separated list of groups the user is to be in"), init=",".join(users[menuitem][2]))
1137 if code != self._DLG_OK: continue 1137 if code != self._DLG_OK: continue
1138 users[menuitem][2] = string.split(groups, ",") 1138 users[menuitem][2] = string.split(groups, ",")
1139 elif menuitem2 == "Shell": 1139 elif menuitem2 == _(u"Shell"):
1140 code, shell = self._d.inputbox("Enter the shell you want the user to use. default is /bin/bash. ", init=users[menuitem][3]) 1140 code, shell = self._d.inputbox(_(u"Enter the shell you want the user to use. default is /bin/bash. "), init=users[menuitem][3])
1141 if code != self._DLG_OK: 1141 if code != self._DLG_OK:
1142 continue 1142 continue
1143 users[menuitem][3] = shell 1143 users[menuitem][3] = shell
1144 elif menuitem2 == "Home Directory": 1144 elif menuitem2 == _(u"Home Directory"):
1145 code, homedir = self._d.inputbox("Enter the user's home directory. default is /home/username. ", init=users[menuitem][4]) 1145 code, homedir = self._d.inputbox(_(u"Enter the user's home directory. default is /home/username. "), init=users[menuitem][4])
1146 if code != self._DLG_OK: 1146 if code != self._DLG_OK:
1147 continue 1147 continue
1148 users[menuitem][4] = homedir 1148 users[menuitem][4] = homedir
1149 elif menuitem2 == "UID": 1149 elif menuitem2 == _(u"UID"):
1150 code, uid = self._d.inputbox("Enter the user's UID. If left blank the system will choose a default value (this is recommended).", init=users[menuitem][5]) 1150 code, uid = self._d.inputbox(_(u"Enter the user's UID. If left blank the system will choose a default value (this is recommended)."), init=users[menuitem][5])
1151 if code != self._DLG_OK: 1151 if code != self._DLG_OK:
1152 continue 1152 continue
1153 if type(uid) != int: 1153 if type(uid) != int:
1154 continue 1154 continue
1155 users[menuitem][5] = uid 1155 users[menuitem][5] = uid
1156 elif menuitem2 == "Comment": 1156 elif menuitem2 == _(u"Comment"):
1157 code, comment = self._d.inputbox("Enter the user's comment. This is completely optional.", init=users[menuitem][6]) 1157 code, comment = self._d.inputbox(_(u"Enter the user's comment. This is completely optional."), init=users[menuitem][6])
1158 if code != self._DLG_OK: 1158 if code != self._DLG_OK:
1159 continue 1159 continue
1160 users[menuitem][6] = comment 1160 users[menuitem][6] = comment
1161 elif menuitem2 == "Delete": 1161 elif menuitem2 == _(u"Delete"):
1162 if self._d.yesno("Are you sure you want to delete the user " + menuitem + "?") == self._DLG_YES: 1162 if self._d.yesno(_(u"Are you sure you want to delete the user ") + menuitem + "?") == self._DLG_YES:
1163 del users[menuitem] 1163 del users[menuitem]
1164 break 1164 break
1165 1165
1166 def _set_services(self): 1166 def _set_services(self):
1167 choice_list = [("alsasound", "ALSA Sound Daemon",0), ("apache", "Common web server (version 1.x)",0), ("apache2", "Common web server (version 2.x)",0), ("distccd", "Distributed Compiling System",0), ("esound", "ESD Sound Daemon",0), ("hdparm", "Hard Drive Tweaking Utility",0), ("local", "Run scripts found in /etc/conf.d/local.start",0), ("portmap", "Port Mapping Service",0), ("proftpd", "Common FTP server",0), ("sshd", "SSH Daemon (allows remote logins)",0), ("Other","Manually specify your services in a comma-separated list.",0)] 1167 choice_list = [("alsasound", _(u"ALSA Sound Daemon"),0), ("apache", _(u"Common web server (version 1.x)"),0), ("apache2", _(u"Common web server (version 2.x)"),0), ("distccd", _(u"Distributed Compiling System"),0), ("esound", _(u"ESD Sound Daemon"),0), ("hdparm", _(u"Hard Drive Tweaking Utility"),0), ("local", _(u"Run scripts found in /etc/conf.d/local.start"),0), ("portmap", _(u"Port Mapping Service"),0), ("proftpd", _(u"Common FTP server"),0), ("sshd", _(u"SSH Daemon (allows remote logins)"),0), (_(u"Other"),_(u"Manually specify your services in a comma-separated list."),0)]
1168 string = _(u"Choose the services you want started on bootup. Note that depending on what packages are selected, some services listed will not exist.") 1168 string = _(u"Choose the services you want started on bootup. Note that depending on what packages are selected, some services listed will not exist.")
1169 code, services_list = self._d.checklist(string, choices=choice_list, height=19, list_height=10, width=68) 1169 code, services_list = self._d.checklist(string, choices=choice_list, height=19, list_height=10, width=68)
1170 if code != self._DLG_OK: 1170 if code != self._DLG_OK:
1171 return 1171 return
1172 services = "" 1172 services = ""
1173 for service in services_list: 1173 for service in services_list:
1174 services += service + "," 1174 services += service + ","
1175 services = services[:-1] 1175 services = services[:-1]
1176 if "Other" in services_list: 1176 if _(u"Other") in services_list:
1177 code, services = self._d.inputbox(_(u"Enter a comma-separated list of services to start on boot")) 1177 code, services = self._d.inputbox(_(u"Enter a comma-separated list of services to start on boot"))
1178 if code != self._DLG_OK: 1178 if code != self._DLG_OK:
1179 return 1179 return
1180 try: 1180 try:
1181 self._install_profile.set_services(None, services, None) 1181 self._install_profile.set_services(None, services, None)
1184 1184
1185 def _save_install_profile(self, xmlfilename="", askforfilename=True): 1185 def _save_install_profile(self, xmlfilename="", askforfilename=True):
1186 code = 0 1186 code = 0
1187 filename = xmlfilename 1187 filename = xmlfilename
1188 if askforfilename: 1188 if askforfilename:
1189 code, filename = self._d.inputbox("Enter a filename for the XML file", init=xmlfilename) 1189 code, filename = self._d.inputbox(_(u"Enter a filename for the XML file"), init=xmlfilename)
1190 if code != self._DLG_OK: 1190 if code != self._DLG_OK:
1191 return None 1191 return None
1192 if GLIUtility.is_file(filename): 1192 if GLIUtility.is_file(filename):
1193 if not self._d.yesno("The file " + filename + " already exists. Do you want to overwrite it?") == self._DLG_YES: 1193 if not self._d.yesno(_(u"The file %s already exists. Do you want to overwrite it?") % filename) == self._DLG_YES:
1194 return None 1194 return None
1195 configuration = open(filename ,"w") 1195 configuration = open(filename ,"w")
1196 configuration.write(self._install_profile.serialize()) 1196 configuration.write(self._install_profile.serialize())
1197 configuration.close() 1197 configuration.close()
1198 return filename 1198 return filename

Legend:
Removed from v.717  
changed lines
  Added in v.718

  ViewVC Help
Powered by ViewVC 1.1.20