/[gli]/branches/overhaul/src/fe/dialog/gli-dialog.py
Gentoo

Diff of /branches/overhaul/src/fe/dialog/gli-dialog.py

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

Revision 1580 Revision 1581
91 #Change the Yes/No buttons 91 #Change the Yes/No buttons
92 self._d.add_persistent_args(["--yes-label", _(u"Networkless")]) 92 self._d.add_persistent_args(["--yes-label", _(u"Networkless")])
93 self._d.add_persistent_args(["--no-label", _(u"Internet enabled")]) 93 self._d.add_persistent_args(["--no-label", _(u"Internet enabled")])
94 if self._d.yesno(networkless_string, width=65, height=20) == self._DLG_YES: 94 if self._d.yesno(networkless_string, width=65, height=20) == self._DLG_YES:
95 self.networkless = True 95 self.networkless = True
96 try:
97 self._install_profile.set_grp_install(None, True, None)
98 self._install_profile.set_install_stage(None, "3", None)
99 self._install_profile.set_dynamic_stage3(None, True, None)
100 self._install_profile.set_portage_tree_sync_type(None,"snapshot", None)
101 cd_snapshot_uri = GLIUtility.get_cd_snapshot_uri()
102 self._install_profile.set_portage_tree_snapshot_uri(None, cd_snapshot_uri, None)
103 self._install_profile.set_kernel_source_pkg(None, "livecd-kernel", None)
104 self._install_profile.set_cron_daemon_pkg(None, "vixie-cron", None)
105 self._install_profile.set_logging_daemon_pkg(None,"syslog-ng", None)
106 except:
107 self._d.msgbox(_(u"ERROR: Could not set networkless information in the profile"))
96 else: 108 else:
97 self.networkless = False 109 self.networkless = False
98 110
99 def ask_load_profile(self): 111 def ask_load_profile(self):
100 #Reset the Yes/No labels. 112 #Reset the Yes/No labels.
106 All of the installation settings are stored in an XML file, which we call the InstallProfile. If you have a previously-created profile, you can load it now 118 All of the installation settings are stored in an XML file, which we call the InstallProfile. If you have a previously-created profile, you can load it now
107 for use in this installation. 119 for use in this installation.
108 Do you have a previously generated profile for the installer? 120 Do you have a previously generated profile for the installer?
109 """) 121 """)
110 if self._d.yesno(string, width=70, height=15, defaultno=1) == self._DLG_YES: 122 if self._d.yesno(string, width=70, height=15, defaultno=1) == self._DLG_YES:
111 code, self.profile_xml_file = d.inputbox(_(u"Enter the filename of the XML file")) 123 code, self.profile_xml_file = self._d.inputbox(_(u"Enter the filename of the XML file"))
112 if code != self._DLG_OK: 124 if code != self._DLG_OK:
113 break 125 break
114 if GLIUtility.is_file(self.profile_xml_file): 126 if GLIUtility.is_file(self.profile_xml_file):
115 break 127 break
116 self._d.msgbox(_(u"Cannot open file %s") % self.profile_xml_file, height=7, width=50) 128 self._d.msgbox(_(u"Cannot open file %s") % self.profile_xml_file, height=7, width=50)
117 self.profile_xml_file = None 129 self.profile_xml_file = None
118 continue 130 continue
119 else: 131 else:
120 break 132 break
121 133 if self.profile_xml_file != None:
134 self._install_profile.parse(self.profile_xml_file)
135 self.run_phase5()
122 136
123############ STAGE1 FUNCTIONS ################# 137############ STAGE1 FUNCTIONS #################
124 138
125 def set_arch_template(self): 139 def set_arch_template(self):
126 subarches = { 'i386': 'x86', 'i486': 'x86', 'i586': 'x86', 'i686': 'x86', 'x86_64': 'amd64', 'parisc': 'hppa' } 140 subarches = { 'i386': 'x86', 'i486': 'x86', 'i586': 'x86', 'i686': 'x86', 'x86_64': 'amd64', 'parisc': 'hppa' }
621 else: 635 else:
622 initval = GLIUtility.get_cd_snapshot_uri() 636 initval = GLIUtility.get_cd_snapshot_uri()
623 code, snapshot = self._d.inputbox(_(u"Enter portage tree snapshot URI"), init=initval) 637 code, snapshot = self._d.inputbox(_(u"Enter portage tree snapshot URI"), init=initval)
624 if code == self._DLG_OK: 638 if code == self._DLG_OK:
625 if snapshot: 639 if snapshot:
626 if not GLIUtility.is_uri(snapshot, checklocal=self.local_install): 640 if not GLIUtility.is_uri(snapshot):
627 self._d.msgbox(_(u"The specified URI is invalid. It was not saved. Please go back and try again.")) 641 self._d.msgbox(_(u"The specified URI is invalid. It was not saved. Please go back and try again."))
628 else: 642 else:
629 self._install_profile.set_portage_tree_snapshot_uri(None, snapshot, None) 643 self._install_profile.set_portage_tree_snapshot_uri(None, snapshot, None)
630 644
631 else: 645 else:
987 except: 1001 except:
988 self._d.msgbox(_(u"ERROR! Could not set the kernel config URI!")) 1002 self._d.msgbox(_(u"ERROR! Could not set the kernel config URI!"))
989 #else: self._d.msgbox(_(u"No URI was specified! Reverting to using genkernel")) 1003 #else: self._d.msgbox(_(u"No URI was specified! Reverting to using genkernel"))
990 1004
991 def set_boot_loader(self): 1005 def set_boot_loader(self):
992 parts = self._install_profile.get_partition_tables() 1006 mounts = self._install_profile.get_mounts()
1007 boot_drive_choices = []
993 #Bootloader code yanked from the x86ArchTemplate 1008 #Bootloader code yanked from the x86ArchTemplate
994 kernel_params = self._install_profile.get_bootloader_kernel_args() 1009 kernel_params = self._install_profile.get_bootloader_kernel_args()
995 if self._install_profile.get_boot_device(): 1010 if self._install_profile.get_boot_device():
996 boot_device = self._install_profile.get_boot_device() 1011 boot_device = self._install_profile.get_boot_device()
997 else: 1012 else:
998 boot_device = "" 1013 boot_device = ""
999 foundboot = False 1014 foundboot = False
1000 for device in parts: 1015 for mount in mounts:
1001 tmp_partitions = parts[device] #.get_install_profile_structure() 1016 boot_drive_choices.append(mount['devnode'][:-1])
1002 for partition in tmp_partitions: 1017 mountpoint = mount['mountpoint']
1003 mountpoint = tmp_partitions[partition]['mountpoint']
1004 if (mountpoint == "/boot"): 1018 if (mountpoint == "/boot"):
1005 foundboot = True 1019 foundboot = True
1006 if (( (mountpoint == "/") and (not foundboot) ) or (mountpoint == "/boot")): 1020 if (( (mountpoint == "/") and (not foundboot) ) or (mountpoint == "/boot")):
1007 boot_device = device
1008 if not "doscsi" in kernel_params.split(): 1021 if not "doscsi" in kernel_params.split():
1009 if device.startswith("/dev/sd"): kernel_params += " doscsi" 1022 if mount['devnode'].startswith("/dev/sd"): kernel_params += " doscsi"
1010 arch_loaders = { 'x86': [ 1023 arch_loaders = { 'x86': [
1011 ("grub",_(u"GRand Unified Bootloader, newer, RECOMMENDED"))], 1024 ("grub",_(u"GRand Unified Bootloader, newer, RECOMMENDED"))],
1012 'amd64': [ 1025 'amd64': [
1013 ("grub",_(u"GRand Unified Bootloader, newer, RECOMMENDED"))]} #FIXME ADD OTHER ARCHS 1026 ("grub",_(u"GRand Unified Bootloader, newer, RECOMMENDED"))]} #FIXME ADD OTHER ARCHS
1014 if not self.networkless: 1027 if not self.networkless:
1037 #show the menu. 1050 #show the menu.
1038 boot_string3_std = _(u"Your boot device may not be correct. It is currently set to %s, but this device may not be the first to boot. Usually boot devices end in 'a' such as hda or sda.") % boot_device 1051 boot_string3_std = _(u"Your boot device may not be correct. It is currently set to %s, but this device may not be the first to boot. Usually boot devices end in 'a' such as hda or sda.") % boot_device
1039 boot_string3 = _(u" Please confirm your boot device by choosing it from the menu.") 1052 boot_string3 = _(u" Please confirm your boot device by choosing it from the menu.")
1040 if not self.advanced_mode: 1053 if not self.advanced_mode:
1041 boot_string3 = boot_string3_std + boot_string3 1054 boot_string3 = boot_string3_std + boot_string3
1042 #grab choies from the partiton list.
1043 boot_drive_choices = []
1044 for device in parts:
1045 boot_drive_choices.append(device)
1046 if not boot_drive_choices: 1055 if not boot_drive_choices:
1047 self._d.msgbox(_(u"ERROR: No drives set up. Please complete the Partitioning screen first!")) 1056 self._d.msgbox(_(u"ERROR: No drives set up. Please complete the Partitioning screen first!"))
1048 return 1057 return
1049 code, boot_drive_choice = self._d.menu(boot_string3, choices=self._dmenu_list_to_choices(boot_drive_choices), height=16, width=70) 1058 code, boot_drive_choice = self._d.menu(boot_string3, choices=self._dmenu_list_to_choices(boot_drive_choices), height=16, width=70)
1050 if code != self._DLG_OK: 1059 if code != self._DLG_OK:
1749 1758
1750 def show_settings(self): 1759 def show_settings(self):
1751 settings = _(u"Look carefully at the following settings to check for mistakes.\nThese are the installation settings you have chosen:\n\n") 1760 settings = _(u"Look carefully at the following settings to check for mistakes.\nThese are the installation settings you have chosen:\n\n")
1752 #Partitioning 1761 #Partitioning
1753 settings += _(u"Partitioning: \n Key: Minor, Pri/Ext, Filesystem, MkfsOpts, Mountpoint, MountOpts, Size.\n") 1762 settings += _(u"Partitioning: \n Key: Minor, Pri/Ext, Filesystem, MkfsOpts, Mountpoint, MountOpts, Size.\n")
1754 devices = self._install_profile.get_partition_tables() 1763 mounts = self._install_profile.get_mounts()
1764 blah = """
1755 drives = devices.keys() 1765 drives = devices.keys()
1756 drives.sort() 1766 drives.sort()
1757 for drive in drives: 1767 for drive in drives:
1758 settings += _(u" Drive: ") + drive + devices[drive].get_model() + "\n" 1768 settings += _(u" Drive: ") + drive + devices[drive].get_model() + "\n"
1759 partlist = devices[drive].get_ordered_partition_list() 1769 partlist = devices[drive].get_ordered_partition_list()
1780 entry += (tmppart.get_mkfsopts() or "none") + ", " 1790 entry += (tmppart.get_mkfsopts() or "none") + ", "
1781 entry += (tmppart.get_mountpoint() or "none") + ", " 1791 entry += (tmppart.get_mountpoint() or "none") + ", "
1782 entry += (tmppart.get_mountopts() or "none") + ", " 1792 entry += (tmppart.get_mountopts() or "none") + ", "
1783 entry += str(tmppart.get_mb()) + "MB)" 1793 entry += str(tmppart.get_mb()) + "MB)"
1784 settings += entry + "\n" 1794 settings += entry + "\n"
1785 1795 """
1786 #Network Mounts: 1796 #Network Mounts:
1787 network_mounts = copy.deepcopy(self._install_profile.get_network_mounts()) 1797 network_mounts = copy.deepcopy(self._install_profile.get_network_mounts())
1788 settings += _(u"\nNetwork Mounts: \n") 1798 settings += _(u"\nNetwork Mounts: \n")
1789 for mount in network_mounts: 1799 for mount in network_mounts:
1790 settings += " "+mount['host']+":"+mount['export']+"\n" 1800 settings += " "+mount['host']+":"+mount['export']+"\n"
1952 self.set_root_password() 1962 self.set_root_password()
1953 self.set_additional_users() 1963 self.set_additional_users()
1954 1964
1955 #Save the profile 1965 #Save the profile
1956 self.save_install_profile() 1966 self.save_install_profile()
1957 1967
1968 def run_phase5(self):
1958 #Start the rest of the installation 1969 #Start the rest of the installation
1959 # INSTALLATION TIME 1970 # INSTALLATION TIME
1960 current_item = 0 1971 current_item = 0
1972 self._cc.start_pre_install()
1973
1974 self._cc.set_install_profile(self._install_profile)
1975 self._cc.start_install()
1976 self._d.gauge_start(_(u"Installation Started!"), title=_(u"Installation progress"))
1977 num_steps_completed = 1
1978 next_step = 0
1979 num_steps = 0
1980 i = 0
1961 while 1: 1981 while 1:
1962 self._cc.set_install_profile(self._install_profile)
1963 self._cc.start_install()
1964 self._d.gauge_start(_(u"Installation Started!"), title=_(u"Installation progress"))
1965 num_steps_completed = 1
1966 next_step = 0
1967 num_steps = 0
1968 i = 0
1969 while 1:
1970 notification = self._cc.getNotification() 1982 notification = self._cc.getNotification()
1971 if notification == None: 1983 if notification == None:
1972 time.sleep(1) 1984 time.sleep(1)
1985 continue
1986 type_r = notification.get_type()
1987 data = notification.get_data()
1988 if type_r == "exception":
1989 #Reset the Yes/No labels.
1990 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
1991 self._d.add_persistent_args(["--no-label",_(u"No")])
1992 if self._d.yesno(_(u"There was an Exception received during the install that is outside of the normal install errors. This is a bad thing. The error was:")+ str(data) + _(u"\nPlease submit a bug report (after searching to make sure it's not a known issue and verifying you didn't do something stupid) with the contents of /var/log/install.log and /tmp/installprofile.xml and the version of the installer you used\nDo you want to cleanup your system to attempt another install?"), width=77, height=22) == self._DLG_YES:
1993 self._cc.start_failure_cleanup()
1994 sys.exit(0)
1995 elif type_r == "progress":
1996 #SECONDARY UPDATIN' GOIN ON IN HERE
1997 diff = (data[0]*100)/num_steps
1998 self._d.gauge_update(i+diff, _(u"On step %d of %d. Current step: %s\n%s") % (num_steps_completed, num_steps, next_step, data[1]), update_text=1)
1999 elif type_r == "int":
2000 if data == GLIClientController.NEXT_STEP_READY:
2001 next_step_waiting = False
2002 next_step = self._cc.get_next_step_info()
2003 num_steps = self._cc.get_num_steps()
2004 i = (num_steps_completed*100)/num_steps
2005 self._d.gauge_update(i, _(u"On step %d of %d. Current step: %s") % (num_steps_completed, num_steps, next_step), update_text=1)
2006 num_steps_completed += 1
2007 #print "Next step: " + next_step
2008 if self._cc.has_more_steps():
2009 self._cc.next_step()
1973 continue 2010 continue
1974 type_r = notification.get_type()
1975 data = notification.get_data()
1976 if type_r == "exception":
1977 #Reset the Yes/No labels.
1978 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
1979 self._d.add_persistent_args(["--no-label",_(u"No")])
1980 if self._d.yesno(_(u"There was an Exception received during the install that is outside of the normal install errors. This is a bad thing. The error was:")+ str(data) + _(u"\nPlease submit a bug report (after searching to make sure it's not a known issue and verifying you didn't do something stupid) with the contents of /var/log/install.log and /tmp/installprofile.xml and the version of the installer you used\nDo you want to cleanup your system to attempt another install?"), width=77, height=22) == self._DLG_YES:
1981 self._cc.start_failure_cleanup()
1982 sys.exit(0)
1983 elif type_r == "progress":
1984 #SECONDARY UPDATIN' GOIN ON IN HERE
1985 diff = (data[0]*100)/num_steps
1986 self._d.gauge_update(i+diff, _(u"On step %d of %d. Current step: %s\n%s") % (num_steps_completed, num_steps, next_step, data[1]), update_text=1)
1987 elif type_r == "int":
1988 if data == GLIClientController.NEXT_STEP_READY:
1989 next_step_waiting = False
1990 next_step = self._cc.get_next_step_info()
1991 num_steps = self._cc.get_num_steps()
1992 i = (num_steps_completed*100)/num_steps
1993 self._d.gauge_update(i, _(u"On step %d of %d. Current step: %s") % (num_steps_completed, num_steps, next_step), update_text=1)
1994 num_steps_completed += 1
1995 #print "Next step: " + next_step
1996 if self._cc.has_more_steps():
1997 self._cc.next_step()
1998 continue
1999 if data == GLIClientController.INSTALL_DONE: 2011 if data == GLIClientController.INSTALL_DONE:
2000 self._d.gauge_update(100, _(u"Install completed!"), update_text=1) 2012 self._d.gauge_update(100, _(u"Install completed!"), update_text=1)
2001 self._d.gauge_stop() 2013 self._d.gauge_stop()
2002 print _(u"Install done!") 2014 print _(u"Install done!")
2003 sys.exit(0) 2015 sys.exit(0)
2004 2016
2005 2017
2006# --------------------------End of functions------------------------ 2018# --------------------------End of functions------------------------
2007# --------------------------Beginning of MAIN----------------------- 2019# --------------------------Beginning of MAIN-----------------------
2008if __name__ == '__main__': 2020if __name__ == '__main__':
2020 2032
2021 gli.run_phase1() #Set up networking 2033 gli.run_phase1() #Set up networking
2022 gli.run_phase2() #Do partitioning 2034 gli.run_phase2() #Do partitioning
2023 gli.run_phase3() #Install stage tarball and portage 2035 gli.run_phase3() #Install stage tarball and portage
2024 gli.run_phase4() #Do everything else 2036 gli.run_phase4() #Do everything else
2037 gli.run_phase5() #Execute the installation
2025 2038
2026 2039
2027#########################End of main################################# 2040#########################End of main#################################

Legend:
Removed from v.1580  
changed lines
  Added in v.1581

  ViewVC Help
Powered by ViewVC 1.1.20