/[gli]/trunk/src/fe/dialog/gli-dialog.py
Gentoo

Contents of /trunk/src/fe/dialog/gli-dialog.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 738 - (show annotations) (download) (as text)
Thu Jul 7 06:30:50 2005 UTC (13 years, 3 months ago) by codeman
File MIME type: text/x-python
File size: 7861 byte(s)
  fix global USE flags to not include the arch types at the end.
  updates to GenDialog and gli-d.

fixed more heights/widths. fixed missing use_local_desc in set_make_conf

1 #!/usr/bin/python
2
3 import sys
4 sys.path.append("../..")
5
6 import dialog
7 import GLIException, GLIInstallProfile, GLIClientConfiguration, GLIClientController, GLIUtility, GLIStorageDevice
8 from GLIGenDialog import GLIGenCF,GLIGenIP
9 import string, copy, time, re, glob, os, platform
10 import gettext
11 _ = gettext.gettext
12
13 class Setup_CConfig(GLIGenCF):
14 def __init__(self, client_profile, local_install, advanced_mode):
15 GLIGenCF.__init__(self, client_profile, local_install, advanced_mode)
16 self.set_arch_template()
17 self.set_logfile()
18 self.set_root_mount_point()
19 self.set_client_networking()
20 self.set_enable_ssh()
21 self.set_livecd_password()
22 self.set_client_kernel_modules()
23 self.client_config_xml_file = None
24 if advanced_mode:
25 if d.yesno(_(u"Do you want to save the ClientConfiguration XML file before continuing? (it will be automatically saved before the install begins)")) == DLG_YES:
26 self.client_config_xml_file = self.save_client_profile()
27
28 class Setup_InstallProfile(GLIGenIP):
29 def __init__(self, client_profile, install_profile, local_install, advanced_mode):
30 GLIGenIP.__init__(self, client_profile, install_profile, local_install, advanced_mode)
31 self.install_profile_xml_file = None
32 if d.yesno(_(u"Do you want to save the InstallProfile XML file?")) == DLG_YES:
33 self.install_profile_xml_file = self._save_install_profile()
34
35 # ------------------------------------------------------------------
36 if __name__ == '__main__':
37
38 d = dialog.Dialog()
39 client_profile = GLIClientConfiguration.ClientConfiguration()
40 install_profile = GLIInstallProfile.InstallProfile()
41 cc = GLIClientController.GLIClientController(pretend=False)
42 exception_waiting = None
43 client_config_xml_file = None
44 install_profile_xml_file = None
45 next_step_waiting = False
46 install_done = False
47 local_install = True
48 advanced_mode = False
49
50 DLG_OK = 0
51 DLG_YES = 0
52 DLG_CANCEL = 1
53 DLG_NO = 1
54 DLG_ESC = 2
55 DLG_ERROR = 3
56 DLG_EXTRA = 4
57 DLG_HELP = 5
58
59 d.setBackgroundTitle("Gentoo Linux Installer")
60 welcome_string = _(u"""Welcome to the Gentoo Linux Installer! This program will help install Gentoo on your computer.
61 Before proceeding please thoroughly read the Gentoo Installation Handbook available at
62 http://www.gentoo.org/doc/en/handbook/index.xml \n
63 This installer works by first asking a series of questions to generate an \"installation profile\",
64 which contains all the information needed to install Gentoo.\n
65 NO Changes will be made to your system until you select the "Install!" button.
66 You can save your profile at any time by exiting the installer.
67 You can also load a previously made profile at any time.\n
68 If choosing expert mode, you will make a second profile with configuration settings for the livecd environment and the installer.\n
69 Press OK to continue""")
70 d.msgbox(welcome_string, height=25, width=78, title="Welcome")
71
72 #Change the Yes/No buttons to new labels for this question.
73 d.add_persistent_args(["--yes-label", _(u"Simulate")])
74 d.add_persistent_args(["--no-label", _(u"Real Install")])
75 #This is a temporary question during the development process. In a beta release a real install will be implied.
76 if d.yesno(_(u"Are we performing an actual install or just simulating?"), width=45) == DLG_NO:
77 cc._pretend = False
78 else:
79 cc._pretend = True
80
81 #Set the Yes/No labels.
82 d.add_persistent_args(["--yes-label", "Standard"])
83 d.add_persistent_args(["--no-label","Advanced"])
84 advanced_string = _(u"""This installer has two modes, an advanced mode for those knowledgable with the inner details of their computer and a standard mode where many of the defaults will be chosen for the user for simplicity and to speed up the install process. The advanced mode offers full customizability and is required for generating profiles to be used other computers. \nThe advanced mode is recommended by the developers.
85 """)
86 if d.yesno(advanced_string, width=55, height=15) == DLG_NO:
87 advanced_mode = True
88 local_install = True
89
90 #Reset the Yes/No labels.
91 d.add_persistent_args(["--yes-label", "Yes"])
92 d.add_persistent_args(["--no-label","No"])
93 if advanced_mode:
94 #Local install affects the pre-selection of partitions on the local hard drives, amongst other things.
95 if d.yesno(_(u"Are the profiles being generated to be used for an install on the current computer?")) == DLG_NO:
96 local_install = False
97
98 #Ask
99 while 1:
100 string = _(u"""
101 The first profile needed for an advnaced install includes all the
102 necessary information for getting the livecd environment set up.
103 This includes the livecd networking configuration, where the
104 logfile and new root mount point are to be located, etc.
105 We call this the ClientConfiguration profile.
106 Do you have a previously generated XML file for the ClientConfiguration?
107 """)
108 if d.yesno(string, width=70, height=15, defaultno=1) == DLG_YES:
109 code, client_config_xml_file = d.inputbox(_(u"Enter the filename of the XML file"))
110 if code != DLG_OK:
111 break
112 if GLIUtility.is_file(client_config_xml_file):
113 break
114 d.msgbox(_(u"Cannot open file ") + client_config_xml_file, height=7, width=50)
115 client_config_xml_file = None
116 continue
117 else:
118 break
119
120 if client_config_xml_file != None:
121 client_profile.parse(client_config_xml_file)
122 # code to actually run the client_controller functions
123 else:
124 #This line does all the work.
125 gen_client_conf = Setup_CConfig(client_profile, local_install, advanced_mode)
126 client_profile = gen_client_conf.client_profile()
127
128 client_profile.set_interactive(None, True, None)
129 cc.set_configuration(client_profile)
130
131 #This will execute all of the CC functions, and set up networking if there is networking to set up.
132 cc.start_pre_install()
133
134 #Reset the Yes/No labels.
135 d.add_persistent_args(["--yes-label", "Yes"])
136 d.add_persistent_args(["--no-label","No"])
137 while 1:
138 if d.yesno(_(u"All of the installation settings are stored in an XML file, which we call the InstallProfile. If you have previously saved a profile and would like to load it for this install, say Yes. Otherwise say No. Do you have a previously generated InstallProfile XML file?"), width=55) == DLG_YES:
139 code, install_profile_xml_file = d.inputbox(_(u"Enter the filename of the XML file"))
140 if code != DLG_OK:
141 break
142 if GLIUtility.is_file(install_profile_xml_file):
143 break
144 d.msgbox(_(u"Cannot open file ") + install_profile_xml_file, height=7, width=50)
145 install_profile_xml_file = None
146 else:
147 break
148
149 if install_profile_xml_file != None:
150 install_profile.parse(install_profile_xml_file)
151 else:
152 gen_install_profile = Setup_InstallProfile(client_profile, install_profile, local_install, advanced_mode)
153 install_profile = gen_install_profile.install_profile()
154
155
156 # INSTALLATION TIME
157 current_item = 0
158 while 1:
159 cc.set_install_profile(install_profile)
160 cc.start_install()
161 d.gauge_start(_(u"Installation Started!"), title=_(u"Installation progress"))
162 num_steps_completed = 1
163 while 1:
164 notification = cc.getNotification()
165 if notification == None:
166 time.sleep(1)
167 continue
168 type_r = notification.get_type()
169 data = notification.get_data()
170 if type_r == "exception":
171 print "Exception received:"
172 print data
173 elif type_r == "int":
174 if data == GLIClientController.NEXT_STEP_READY:
175 next_step_waiting = False
176 next_step = cc.get_next_step_info()
177 num_steps = cc.get_num_steps()
178 i = (num_steps_completed*100)/num_steps
179 d.gauge_update(i, "On step %d of %d. Current step: %s" % (num_steps_completed, num_steps, next_step), update_text=1)
180 num_steps_completed += 1
181 #print "Next step: " + next_step
182 if cc.has_more_steps():
183 cc.next_step()
184 continue
185 if data == GLIClientController.INSTALL_DONE:
186 d.gauge_update(100, _(u"Install completed!"), update_text=1)
187 d.gauge_stop()
188 print _(u"Install done!")
189 sys.exit(0)

Properties

Name Value
svn:eol-style native
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20