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

Contents of /trunk/src/GLIGenDialog.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1463 - (show annotations) (download) (as text)
Sat Jun 17 18:22:44 2006 UTC (11 years, 10 months ago) by codeman
File MIME type: text/x-python
File size: 94767 byte(s)
abandoned local USE project.  no right way to do it.

1 # Copyright 1999-2005 Gentoo Foundation
2 # This source code is distributed under the terms of version 2 of the GNU
3 # General Public License as published by the Free Software Foundation, a copy
4 # of which can be found in the main directory of this project.
5 import dialog, platform, string, os, glob, copy, re
6 import GLIInstallProfile
7 import GLIClientConfiguration
8 import GLIStorageDevice
9 import GLIUtility
10 from GLIException import GLIException
11 import gettext
12 _ = gettext.gettext
13 #This is a parent class to centralize the code between UserGenCC and UserGenIP
14
15 class GLIGen(object):
16 def __init__(self):
17 self._d = dialog.Dialog()
18 self._DLG_OK = 0
19 self._DLG_YES = 0
20 self._DLG_CANCEL = 1
21 self._DLG_NO = 1
22 self._DLG_ESC = 2
23 self._DLG_ERROR = 3
24 self._DLG_EXTRA = 4
25 self._DLG_HELP = 5
26
27 def _dmenu_list_to_choices(self, list):
28 choices = []
29 for i in range(0, len(list)):
30 choices.append((str(i + 1), list[i]))
31
32 return choices
33
34 def client_profile(self):
35 return self._client_profile
36
37 def install_profile(self):
38 return self._install_profile
39
40 #This class will generate a client config and return it as a xml string
41 class GLIGenCF(GLIGen):
42 def __init__(self, client_profile, local_install=True, advanced_mode=True, networkless=False):
43 GLIGen.__init__(self)
44 self._client_profile = client_profile
45 self.local_install = local_install
46 self.advanced_mode = advanced_mode
47 self._networkless = networkless
48
49 def serialize(self):
50 return self._client_profile.serialize()
51 #-----------------------------------------------
52 #Functions for generating a client configuration
53 #-----------------------------------------------
54 def set_arch_template(self):
55 subarches = { 'i386': 'x86', 'i486': 'x86', 'i586': 'x86', 'i686': 'x86', 'x86_64': 'amd64', 'parisc': 'hppa' }
56 arch = platform.machine()
57 if arch in subarches:
58 arch = subarches[arch]
59 if self.local_install:
60 try:
61 self._client_profile.set_architecture_template(None, arch, None)
62 except:
63 self._d.msgbox(_(u"Error! Undefined architecture template specified or found on the current machine"))
64 else:
65 template_choices = ["x86", "amd64", "sparc", "alpha", "hppa", "ppc"]
66 arch_template_string = _(u"Please select the architecture of the computer that gentoo will be installed on. For pentium and AMD 32-bit processors, choose x86. If you don't know your architecture, you should consider another Linux distribution.")
67 code, menuitem = self._d.menu(arch_template_string, choices=self._dmenu_list_to_choices(template_choices), default_item=str(template_choices.index(arch)+1), height=20)
68 if code == self._DLG_OK:
69 menuitem = template_choices[int(menuitem)-1]
70 try:
71 self._client_profile.set_architecture_template(None, menuitem, None)
72 except:
73 self._d.msgbox(_(u"Error! Undefined architecture template specified or found on the current machine"))
74 def set_verbose(self):
75 #Don't show unless advanced.
76 if self.advanced_mode:
77 #Change the Yes/No buttons back.
78 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
79 self._d.add_persistent_args(["--no-label", _(u"No")])
80 if self._d.yesno(_(u"Do you want debugging output enabled during the install? This is mainly meant to help the developers debug any bugs."), width=60) == self._DLG_YES:
81 self._client_profile.set_verbose(None, True, None)
82 else:
83 self._client_profile.set_verbose(None, False, None)
84
85 def set_logfile(self):
86 #If not advanced, the default will suffice.
87 if self.advanced_mode:
88 logfile_string = _(u"""The installer logs all important events during the install process to a logfile for debugging purposes.
89 The file gets copied to the new system once the install is complete.
90 Enter the desired filename and path for the install log (the default is recommended):""")
91 initval = self._client_profile.get_log_file()
92 code, logfile = self._d.inputbox(logfile_string, init=initval, width=60, height=15)
93 if code == self._DLG_OK:
94 self._client_profile.set_log_file(None, logfile, None)
95
96 def set_root_mount_point(self):
97 #If not advanced, the default will suffice.
98 if self.advanced_mode:
99 root_mount_point_string = _(u"Enter the mount point to be used to mount the partition(s) where the new system will be installed. The default is /mnt/gentoo and is greatly recommended, but any mount point will do.")
100 initval = self._client_profile.get_root_mount_point()
101 code, rootmountpoint = self._d.inputbox(root_mount_point_string, init=initval, width=60, height=11)
102 if code == self._DLG_OK:
103 self._client_profile.set_root_mount_point(None, rootmountpoint, None)
104
105 def set_client_networking(self):
106 if self._networkless: return
107 if GLIUtility.ping("www.gentoo.org") and self.local_install: #If an active connection exists, ignore this step if doing a local install.
108 return
109 if self.local_install:
110 device_list = GLIUtility.get_eth_devices()
111 else:
112 device_list = []
113 choice_list = []
114 for device in device_list:
115 choice_list.append((device, GLIUtility.get_interface_realname(device)))
116 choice_list.append(("Other",_(u"Type your own.")))
117 cnet_string1 = _(u"In order to complete most installs, an active Internet connection is required. Listed are the network devices already detected. In this step you will need to setup one network connection for GLI to use to connect to the Internet. If your desired device does not show up in the list, you can select Other and input the device name manually.")
118 code, interface = self._d.menu(cnet_string1, width=75, height=20, choices=choice_list)
119 if code != self._DLG_OK:
120 return
121 if interface == "Other":
122 code, interface = self._d.inputbox(_(u"Enter the interface (NIC) you would like to use for installation (e.g. eth0):"))
123 if code != self._DLG_OK:
124 return
125
126 dhcp_options = ""
127
128 #Change the Yes/No buttons to new labels for this question.
129 self._d.add_persistent_args(["--yes-label", _(u"DHCP")])
130 self._d.add_persistent_args(["--no-label", _(u"Static IP/Manual")])
131 cnet_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:")
132 if self._d.yesno(cnet_string2, height=15, width=60) == self._DLG_YES: #DHCP
133 network_type = 'dhcp'
134 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)
135 else:
136 network_type = 'static'
137 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 you intend to fill out are complete!'),
138 ((_(u'Enter your IP address:'), 15),
139 (_(u'Enter your Broadcast address:'), 15),
140 (_(u'Enter your Netmask:'),15,'255.255.255.0'),
141 (_(u'Enter your default gateway:'),15),
142 (_(u'Enter a DNS server:'),15,'128.118.25.3'),
143 (_(u'Enter a HTTP Proxy IP:'), 15,self._client_profile.get_http_proxy()),
144 (_(u'Enter a FTP Proxy IP:'), 15, self._client_profile.get_ftp_proxy()),
145 (_(u'Enter a RSYNC Proxy:'),15,self._client_profile.get_rsync_proxy())
146 ))
147 (ip_address, broadcast, netmask, gateway, dnsservers, http_proxy, ftp_proxy, rsync_proxy) = data[:-1].split('\n')
148 if code != self._DLG_OK:
149 return
150 #Set the info now that it's all gathered.
151 try:
152 self._client_profile.set_network_type(None, network_type, None)
153 self._client_profile.set_network_interface(None, interface, None)
154 if not network_type == 'dhcp':
155 self._client_profile.set_network_ip(None, ip_address, None)
156 self._client_profile.set_network_broadcast(None, broadcast, None)
157 self._client_profile.set_network_netmask(None, netmask, None)
158 self._client_profile.set_network_gateway(None, gateway, None)
159 self._client_profile.set_dns_servers(None, dnsservers, None)
160 else:
161 if dhcp_options:
162 self._client_profile.set_network_dhcp_options(None, dhcp_options, None)
163 if http_proxy:
164 self._client_profile.set_http_proxy(None, http_proxy, None)
165 if ftp_proxy:
166 self._client_profile.set_ftp_proxy(None, ftp_proxy, None)
167 if rsync_proxy:
168 self._client_profile.set_rsync_proxy(None, rsync_proxy, None)
169
170 except:
171 self._d.msgbox(_(u"ERROR! Could not set networking information!"))
172
173 def set_enable_ssh(self):
174 #Change the Yes/No buttons back.
175 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
176 self._d.add_persistent_args(["--no-label", _(u"No")])
177 if self.advanced_mode and not self._networkless:
178 if self._d.yesno(_(u"Do you want SSH enabled during the install? This will allow you to login remotely during the installation process. If choosing Yes, be sure you select a new LiveCD root password!"), width=60) == self._DLG_YES:
179 self._client_profile.set_enable_ssh(None, True, None)
180 else:
181 self._client_profile.set_enable_ssh(None, False, None)
182
183 def set_livecd_password(self):
184 # The root password will be set here only if in advanced mode. Otherwise it is auto-scrambled.
185 if self.advanced_mode:
186 match = False;
187 while not match:
188 livecd_password_string = _(u"""If you want to be able to login to your machine from another console during the installation,
189 you will want to enter a new root password for the LIVECD.
190 Note that this can be different from your new system's root password.
191 Presss Enter twice to skip this step.
192 Enter the new LIVECD root password: """)
193 code, passwd1 = self._d.passwordbox(livecd_password_string, width=60, height=16)
194 if code != self._DLG_OK:
195 return
196 code, passwd2 = self._d.passwordbox(_(u"Enter the new LIVECD root password again to verify:"))
197 if code != self._DLG_OK:
198 return
199 if passwd1 != passwd2:
200 self._d.msgbox(_(u"The passwords do not match. Please try again."))
201 return
202 else:
203 match = True;
204 if passwd1 != "": #don't want to hash an empty password.
205 try:
206 self._client_profile.set_root_passwd(None, GLIUtility.hash_password(passwd1), None)
207 except:
208 d.msgbox(_(u"ERROR! Could not set the root password on the LiveCD!"))
209 self._d.msgbox(_(u"Password saved. Press Enter to continue."))
210
211 def set_client_kernel_modules(self):
212 if self.advanced_mode:
213 status, output = GLIUtility.spawn("lsmod", return_output=True)
214 cmodules_string1 = _(u"Here is a list of modules currently loaded on your machine.\n Please look through and see if any modules are missing\n that you would like loaded.\n\n")
215 self._d.add_persistent_args(["--exit-label", _(u"Continue")])
216 self._d.scrollbox(cmodules_string1+output, height=20, width=70, title=_(u"Loaded Modules"))
217 cmodules_string2 = _(u"\nIf you have additional modules you would like loaded before the installation begins (ex. a network driver), enter them in a space-separated list.")
218 code, kernel_modules_list = self._d.inputbox(cmodules_string2, init="", width=60, height=12)
219 if code == self._DLG_OK:
220 try:
221 self._client_profile.set_kernel_modules(None, kernel_modules_list, None)
222 except:
223 d.msgbox(_(u"ERROR! Could not set the list of kernel modules!"))
224
225 def save_client_profile(self, xmlfilename="", askforfilename=True):
226 code = 0
227 filename = xmlfilename
228 if askforfilename:
229 code, filename = self._d.inputbox(_(u"Enter a filename for the XML file. Use the full path!"), init=xmlfilename)
230 if code != self._DLG_OK or not filename:
231 return
232 if GLIUtility.is_file(filename):
233 #Change the Yes/No buttons back.
234 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
235 self._d.add_persistent_args(["--no-label", _(u"No")])
236 if not self._d.yesno(_(u"The file %s already exists. Do you want to overwrite it?") % filename) == self._DLG_YES:
237 return
238 try:
239 configuration = open(filename ,"w")
240 configuration.write(self._client_profile.serialize())
241 configuration.close()
242 except:
243 self._d.msgbox(_(u"Error. File couldn't be saved. It will be saved automatically to /tmp before the install."))
244
245 class GLIGenIP(GLIGen):
246 def __init__(self, client_profile, install_profile, local_install=True, advanced_mode=True, networkless=False):
247 GLIGen.__init__(self)
248 self._client_profile = client_profile
249 self._install_profile = install_profile
250 self._networkless = networkless
251 self.local_install = local_install
252 self.advanced_mode = advanced_mode
253 if self._networkless:
254 try:
255 self._install_profile.set_grp_install(None, True, None)
256 self._install_profile.set_install_stage(None, "3", None)
257 self._install_profile.set_dynamic_stage3(None, True, None)
258 self._install_profile.set_portage_tree_sync_type(None,"snapshot", None)
259 cd_snapshot_uri = GLIUtility.get_cd_snapshot_uri()
260 self._install_profile.set_portage_tree_snapshot_uri(None, cd_snapshot_uri, None)
261 self._install_profile.set_kernel_source_pkg(None, "livecd-kernel", None)
262 self._install_profile.set_cron_daemon_pkg(None, "vixie-cron", None)
263 self._install_profile.set_logging_daemon_pkg(None,"syslog-ng", None)
264 except:
265 self._d.msgbox("ERROR: Could not set networkless information in the profile")
266
267 def serialize(self):
268 return self._install_profile.serialize()
269 #---------------------------------------
270 #Functions to generate a install profile
271 #---------------------------------------
272
273 def set_partitions(self):
274 partitions_string1 = _("""The first thing on the new system to setup is the partitoning.
275 You will first select a drive and then edit its partitions.
276 No changes will be saved until the end of the step.
277 No changes to your disk will be made until the installation.
278 NOTE: YOU MUST AT LEAST SELECT ONE PARTITION AS YOUR ROOT PARTITION "/"
279 If your drive is pre-partitioned, just select the mountpoints and make
280 sure that the format option is set to FALSE or it will erase your data.
281 The installer does not yet support resizing of partitions (its not safe).
282 Please refer to the Gentoo Installation Handbook for more information
283 on partitioning and the various filesystem types available in Linux.""")
284 self._d.msgbox(partitions_string1, height=17, width=78)
285 devices = self._install_profile.get_partition_tables()
286 drives = devices.keys()
287 drives.sort()
288 choice_list = []
289 if not devices:
290 tmp_drives = GLIStorageDevice.detect_devices()
291 tmp_drives.sort()
292 for drive in tmp_drives:
293 devices[drive] = GLIStorageDevice.Device(drive)
294 #if self.local_install: #when uncommenting please indent the next line.
295 devices[drive].set_partitions_from_disk()
296 drives.append(drive)
297 choice_list.append((drive, devices[drive].get_model()))
298 else:
299 for drive in drives:
300 choice_list.append((drive, devices[drive].get_model()))
301 #choice_list.append(("Other", "Type your own drive name)) # I DONT THINK GLISD CAN DO NONEXISTANT DRIVES
302 while 1:
303 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"))
304 if code != self._DLG_OK: break
305 while 1:
306 # partitions = devices[drive_to_partition].get_partitions()
307 partlist = devices[drive_to_partition].get_ordered_partition_list()
308 tmpparts = devices[drive_to_partition] #.get_partitions()
309 partsmenu = []
310 for part in partlist:
311 tmppart = tmpparts[part]
312 entry = ""
313 if tmppart.get_type() == "free":
314 #partschoice = "New"
315 entry = _(u" - Unallocated space (")
316 if tmppart.is_logical():
317 entry += _(u"logical, ")
318 entry += str(tmppart.get_mb()) + "MB)"
319 elif tmppart.get_type() == "extended":
320 entry = str(int(tmppart.get_minor()))
321 entry += _(u" - Extended Partition (") + str(tmppart.get_mb()) + "MB)"
322 else:
323 entry = str(int(tmppart.get_minor())) + " - "
324 # Type: " + tmppart.get_type() + ", Mountpoint: " + tmppart.get_mountpoint() + ", Mountopts: " + tmppart.get_mountopts() + "("
325 if tmppart.is_logical():
326 entry += _(u"Logical (")
327 else:
328 entry += _(u"Primary (")
329 entry += tmppart.get_type() + ", "
330 entry += (tmppart.get_mkfsopts() or "none") + ", "
331 entry += (tmppart.get_mountpoint() or "none") + ", "
332 entry += (tmppart.get_mountopts() or "none") + ", "
333 entry += str(tmppart.get_mb()) + "MB)"
334 partsmenu.append(entry)
335 #Add recommended partitioning option and clear option
336 partsmenu.append(_(u"Set Recommended Layout (needs 4GB+)"))
337 partsmenu.append(_(u"Clear Partitions On This Drive."))
338 code, part_to_edit = self._d.menu(_(u"Select a partition or unallocated space to edit\nKey: Minor, Pri/Ext, Filesystem, MkfsOpts, Mountpoint, MountOpts, Size."), width=70, choices=self._dmenu_list_to_choices(partsmenu), cancel=_(u"Back"))
339 if code != self._DLG_OK: break
340 partmenuchoice = partsmenu[int(part_to_edit)-1]
341 #Check for recommended and clear here before setting the tmppart
342 if partmenuchoice == _(u"Set Recommended Layout (needs 4GB+)"):
343 try:
344 devices[drive_to_partition].do_recommended()
345 except GLIException, error:
346 self._d.msgbox(_(u"The recommended layout could NOT be set. The following message was received:")+error.get_error_msg(), width=70, height=15)
347 continue
348 if partmenuchoice == _(u"Clear Partitions On This Drive."):
349 try:
350 devices[drive_to_partition].clear_partitions()
351 self._d.msgbox(_(u"Partition table cleared successfully"))
352 except:
353 self._d.msgbox(_(u"ERROR: could not clear the partition table!"))
354 continue
355 #all other cases (partitions)
356 part_to_edit = partlist[int(part_to_edit)-1]
357 tmppart = tmpparts[part_to_edit]
358 if tmppart.get_type() == "free":
359 # partition size first
360 free_mb = tmppart.get_mb()
361 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))
362 if code != self._DLG_OK: continue
363 if int(new_mb) > free_mb:
364 self._d.msgbox(_(u"The size you entered (%s MB) is larger than the maximum of %s MB") % (new_mb, str(free_mb)))
365 continue
366 # partition type
367 part_types = [("ext2", _(u"Old, stable, but no journaling")),
368 ("ext3", _(u"ext2 with journaling and b-tree indexing (RECOMMENDED)")),
369 ("linux-swap", _(u"Swap partition for memory overhead")),
370 ("fat32", _(u"Windows filesystem format used in Win9X and XP")),
371 ("ntfs", _(u"Windows filesystem format used in Win2K and NT")),
372 ("jfs", _(u"IBM's journaling filesystem. stability unknown.")),
373 ("xfs", _(u"Don't use this unless you know you need it.")),
374 ("reiserfs", _(u"B*-tree based filesystem. great performance. Only V3 supported.")),
375 ("extended", _(u"Create an extended partition containing other logical partitions")),
376 ("Other", _(u"Something else we probably don't support."))]
377 code, type = self._d.menu(_(u"Choose the filesystem type for this new partition."), height=20, width=77, choices=part_types)
378 if code != self._DLG_OK: continue
379
380 # 'other' partition type
381 if type == "Other":
382 code, type = self._d.inputbox(_(u"Please enter the new partition's type:"))
383 if code != self._DLG_OK: continue
384
385 # now add it to the data structure
386 devices[drive_to_partition].add_partition(part_to_edit, int(new_mb), 0, 0, type)
387 else:
388 while 1:
389 tmppart = tmpparts[part_to_edit]
390 tmptitle = drive_to_partition + str(part_to_edit) + " - "
391 if tmppart.is_logical():
392 tmptitle += _(u"Logical (")
393 else:
394 tmptitle += _(u"Primary (")
395 tmptitle += tmppart.get_type() + ", "
396 tmptitle += (tmppart.get_mkfsopts() or "none") + ", "
397 tmptitle += (tmppart.get_mountpoint() or "none") + ", "
398 tmptitle += (tmppart.get_mountopts() or "none") + ", "
399 tmptitle += str(tmppart.get_mb()) + "MB)"
400 menulist = [_(u"Delete"), _(u"Mount Point"), _(u"Mount Options"), _(u"Format"), _(u"Extra mkfs.* Parameters")]
401 code, part_action = self._d.menu(tmptitle, choices=self._dmenu_list_to_choices(menulist), cancel=_(u"Back"))
402 if code != self._DLG_OK: break
403 part_action = menulist[int(part_action)-1]
404 if part_action == _(u"Delete"):
405 answer = (self._d.yesno(_(u"Are you sure you want to delete the partition ") + drive_to_partition + str(part_to_edit) + "?") == self._DLG_YES)
406 if answer == True:
407 tmpdev = tmppart.get_device()
408 tmpdev.remove_partition(part_to_edit)
409 break
410 elif part_action == _(u"Mount Point"):
411 mountpoint_menu = ["/","/boot","/etc","/home","/lib","/mnt","/mnt/windows","/opt","/root","/usr","/usr/local","/usr/portage","/var",_(u"Other")]
412 code, mountpt = self._d.menu(_(u"Choose a mountpoint from the list or choose Other to type your own for partition ")+str(part_to_edit)+_(u". It is currently set to:")+tmppart.get_mountpoint(), choices=self._dmenu_list_to_choices(mountpoint_menu)) #may have to make that an integer
413 if code == self._DLG_OK:
414 mountpt = mountpoint_menu[int(mountpt)-1]
415 if mountpt == _(u"Other"):
416 code, mountpt = self._d.inputbox(_(u"Enter a mountpoint for partition ") + str(part_to_edit), init=tmppart.get_mountpoint())
417 try: tmppart.set_mountpoint(mountpt)
418 except: self._d.msgbox(_(u"ERROR! Could not set mountpoint!"))
419 elif part_action == _(u"Mount Options"):
420 code, answer = self._d.inputbox(_(u"Enter your mount options for partition ") + str(part_to_edit), init=(tmppart.get_mountopts() or "defaults"))
421 if code == self._DLG_OK: tmppart.set_mountopts(answer)
422 elif part_action == _(u"Format"):
423 #Change the Yes/No buttons back.
424 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
425 self._d.add_persistent_args(["--no-label", _(u"No")])
426 code = self._d.yesno(_(u"Do you want to format this partition?"))
427 if code == self._DLG_YES:
428 tmppart.set_format(True)
429 else:
430 tmppart.set_format(False)
431 elif part_action == _(u"Extra mkfs.* Parameters"):
432 new_mkfsopts = tmppart.get_mkfsopts()
433 # extra mkfs options
434 if tmppart.get_type() != "extended":
435 code, new_mkfsopts = self._d.inputbox(_(u"Extra mkfs.* Parameters"), init=new_mkfsopts)
436 if code == self._DLG_OK: tmppart.set_mkfsopts(new_mkfsopts)
437 try:
438 self._install_profile.set_partition_tables(devices)
439 except:
440 self._d.msgbox(_(u"ERROR: The partition tables could not be set correctly!"))
441
442 def set_network_mounts(self):
443 # This is where any NFS mounts will be specified
444 network_mounts = copy.deepcopy(self._install_profile.get_network_mounts())
445 while 1:
446 menulist = []
447 for mount in network_mounts:
448 menulist.append(mount['host'] + ":" + mount['export'])
449 menulist.append(_(u"Add a new network mount"))
450 choices = self._dmenu_list_to_choices(menulist)
451 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"), height=18)
452 if code == self._DLG_CANCEL:
453 try:
454 self._install_profile.set_network_mounts(network_mounts)
455 except:
456 self._d.msgbox(_(u"ERROR: Could net set network mounts!"))
457 break
458 menuitem = menulist[int(menuitemidx)-1]
459 if menuitem == _(u"Add a new network mount"):
460 code, nfsmount = self._d.inputbox(_(u"Enter NFS mount or just enter the IP/hostname to search for available mounts"), height=13, width=50)
461 if code != self._DLG_OK:
462 continue
463 if not GLIUtility.is_nfs(nfsmount):
464 if GLIUtility.is_ip(nfsmount) or GLIUtility.is_hostname(nfsmount):
465 status, remotemounts = GLIUtility.spawn("/usr/sbin/showmount -e " + nfsmount + " 2>&1 | egrep '^/' | cut -d ' ' -f 1 && echo", return_output=True)
466 remotemounts = remotemounts.strip().split("\n")
467 if (not GLIUtility.exitsuccess(status)) or (not len(remotemounts)) or not remotemounts[0]:
468 self._d.msgbox(_(u"No NFS exports were detected on ") + nfsmount)
469 continue
470 code, nfsmount2 = self._d.menu(_(u"Select a NFS export"), choices=self._dmenu_list_to_choices(remotemounts), cancel=_(u"Back"))
471 if code != self._DLG_OK:
472 continue
473 nfsmount2 = remotemounts[int(nfsmount2)-1]
474 else:
475 self._d.msgbox(_(u"The address you entered, %s, is not a valid IP or hostname. Please try again.") % nfsmount)
476 continue
477 else:
478 colon_location = nfsmount.find(':')
479 menuitem = nfsmount
480 nfsmount = menuitem[:colon_location]
481 nfsmount2 = menuitem[colon_location+1:]
482 for mount in network_mounts:
483 if nfsmount == mount['host'] and nfsmount2 == mount['export']:
484 self._d.msgbox(_(u"There is already an entry for ") + nfsmount + ":" + nfsmount2 + ".")
485 nfsmount = None
486 break
487 if nfsmount == None:
488 continue
489 network_mounts.append({'export': nfsmount2, 'host': nfsmount, 'mountopts': '', 'mountpoint': '', 'type': 'nfs'})
490 menuitem = nfsmount + ":" + nfsmount2
491 menuitemidx = len(network_mounts)
492
493 if menuitem.find(':') != -1:
494 colon_location = menuitem.find(':')
495 tmpmount = network_mounts[int(menuitemidx)-1]
496 code, mountpoint = self._d.inputbox(_(u"Enter a mountpoint"), init=tmpmount['mountpoint'])
497 if code == self._DLG_OK:
498 tmpmount['mountpoint'] = mountpoint
499 code, mountopts = self._d.inputbox(_(u"Enter mount options"), init=tmpmount['mountopts'])
500 if code == self._DLG_OK:
501 tmpmount['mountopts'] = mountopts
502 network_mounts[int(menuitemidx)-1] = tmpmount
503
504 def set_install_stage(self):
505 if self._networkless: return
506 # The install stage and stage tarball will be selected here
507 install_stages = (("1",_(u"Stage1 is used when you want to bootstrap&build from scratch.")),
508 ("2",_(u"Stage2 is used for building from a bootstrapped semi-compiled state.")),
509 ("3",_(u"Stage3 is a basic system that has been built for you (no compiling).")),
510 ("3+GRP", _(u"A Stage3 install but using binaries from the LiveCD when able.")))
511 code, install_stage = self._d.menu(_(u"Which stage do you want to start at?"), choices=install_stages, cancel=_(u"Back"), width=78)
512 stage3warning = ""
513 if code == self._DLG_OK:
514 if install_stage == "3+GRP":
515 stage3warning = "\nWARNING: Since you are doing a GRP install it is HIGHLY recommended you choose Create from CD to avoid a potentially broken installation."
516 try:
517 self._install_profile.set_grp_install(None, True, None)
518 except:
519 self._d.msgbox(_(u"ERROR! Could not set install stage!"))
520 install_stage = "3"
521 try:
522 self._install_profile.set_install_stage(None, install_stage, None)
523 except:
524 self._d.msgbox(_(u"ERROR! Could not set install stage!"))
525 has_systempkgs = GLIUtility.is_file("/usr/livecd/systempkgs.txt")
526 if install_stage == "3" and has_systempkgs:
527 #Change the Yes/No buttons to new labels for this question.
528 self._d.add_persistent_args(["--yes-label", _(u"Create from CD")])
529 self._d.add_persistent_args(["--no-label", _(u"Specify URI")])
530 if self._d.yesno(_(u"Do you want to generate a stage3 on the fly using the files on the LiveCD (fastest) or do you want to grab your stage tarball from the Internet?"+stage3warning), width=55) == self._DLG_YES:
531 #Generate on the FLY
532 try:
533 self._install_profile.set_dynamic_stage3(None, True, None)
534 except:
535 self._d.msgbox(_(u"ERROR: Could not set the stage tarball URI!"))
536 return
537 #Specify URI
538 #subarches = { 'x86': ("x86", "i686", "pentium3", "pentium4", "athlon-xp"), 'hppa': ("hppa1.1", "hppa2.0"), 'ppc': ("g3", "g4", "g5", "ppc"), 'sparc': ("sparc32", "sparc64")}
539 type_it_in = False
540 stage_tarball = ""
541 if GLIUtility.ping("www.gentoo.org"): #Test for network connectivity
542 mirrors = GLIUtility.list_mirrors()
543 mirrornames = []
544 mirrorurls = []
545 for item in mirrors:
546 mirrornames.append(item[1])
547 mirrorurls.append(item[0])
548 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)
549 if code != self._DLG_OK:
550 type_it_in = True
551 else:
552 mirror = mirrorurls[int(mirror)-1]
553 arch = self._client_profile.get_architecture_template()
554 tarballs = GLIUtility.list_stage_tarballs_from_mirror(mirror, arch)
555 code, stage_tarball = self._d.menu(_(u"Select your desired stage tarball:"), choices=self._dmenu_list_to_choices(tarballs), width=77, height=20)
556 if (code != self._DLG_OK):
557 type_it_in = True
558 else:
559 stage_tarball = mirror + "/releases/" + arch + "/current/stages/" + tarballs[int(stage_tarball)-1]
560 #get portageq envvar value of cflags and look for x86, i686,etc.
561 #URL SYNTAX
562 #http://gentoo.osuosl.org/releases/ARCHITECTURE/current/stages/
563 else:
564 type_it_in = True
565 if type_it_in:
566 code, stage_tarball = self._d.inputbox(_(u"Specify the stage tarball URI or local file:"), init=self._install_profile.get_stage_tarball_uri())
567 if code != self._DLG_OK:
568 return
569 #If Doing a local install, check for valid file:/// uri
570 if stage_tarball:
571 if not GLIUtility.is_uri(stage_tarball, checklocal=self.local_install):
572 self._d.msgbox(_(u"The specified URI is invalid. It was not saved. Please go back and try again."));
573 else: self._install_profile.set_stage_tarball_uri(None, stage_tarball, None)
574 else: self._d.msgbox(_(u"No URI was specified!"))
575 #if d.yesno("The specified URI is invalid. Use it anyway?") == DLG_YES: install_profile.set_stage_tarball_uri(None, stage_tarball, None)
576
577 def set_portage_tree(self):
578 # This section will ask whether to sync the tree, whether to use a snapshot, etc.
579 if self._install_profile.get_dynamic_stage3(): #special case
580 try:
581 self._install_profile.set_portage_tree_sync_type(None,"snapshot", None)
582 cd_snapshot_uri = GLIUtility.get_cd_snapshot_uri()
583 self._install_profile.set_portage_tree_snapshot_uri(None, cd_snapshot_uri, None)
584 except:
585 self._d.msgbox(_(u"ERROR! Could not set the portage cd snapshot URI!"))
586 return
587
588 #Normal case
589 menulist = [("Sync", _(u"Normal. Use emerge sync RECOMMENDED!")),
590 ("Webrsync", _(u"HTTP daily snapshot. Use when rsync is firewalled.")),
591 ("Snapshot", _(u"Use a portage snapshot, either a local file or a URL")),
592 ("None", _(u"Extra cases such as if /usr/portage is an NFS mount"))]
593 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=75, height=17, choices=menulist)
594 if code != self._DLG_OK:
595 return
596 self._install_profile.set_portage_tree_sync_type(None, portage_tree_sync.lower(), None)
597 if portage_tree_sync == "Snapshot":
598 if self._install_profile.get_portage_tree_snapshot_uri():
599 initval = self._install_profile.get_portage_tree_snapshot_uri()
600 else:
601 initval = GLIUtility.get_cd_snapshot_uri()
602 code, snapshot = self._d.inputbox(_(u"Enter portage tree snapshot URI"), init=initval)
603 if code == self._DLG_OK:
604 if snapshot:
605 if not GLIUtility.is_uri(snapshot, checklocal=self.local_install):
606 self._d.msgbox(_(u"The specified URI is invalid. It was not saved. Please go back and try again."))
607 else:
608 self._install_profile.set_portage_tree_snapshot_uri(None, snapshot, None)
609
610 else:
611 self._d.msgbox(_(u"No URI was specified! Returning to default emerge sync."))
612 #if d.yesno("The specified URI is invalid. Use it anyway?") == DLG_YES: install_profile.set_stage_tarball_uri(None, stage_tarball, None)
613
614
615
616 def set_make_conf(self):
617 # This section will be for setting things like CFLAGS, ACCEPT_KEYWORDS, and USE
618 #special case for dynamic stage3
619 if self._install_profile.get_dynamic_stage3() or not self.advanced_mode:
620 return
621
622 etc_files = self._install_profile.get_etc_files()
623 if etc_files.has_key("make.conf"):
624 make_conf = etc_files['make.conf']
625 else:
626 make_conf = {}
627
628 self._d.msgbox(_(u"""The installer will now gather information regarding the contents of /etc/make.conf
629 One of the unique (and best) features of Gentoo is the ability to
630 define flags (called USE flags) that define what components are
631 compiled into applications. For example, you can enable the alsa
632 flag and programs that have alsa capability will use it.
633 The result is a finely tuned OS with no unnecessary components to
634 slow you down.
635 The installer divides USE flag selection into two screens, one for
636 global USE flags and one for local flags specific to each program.
637 Please be patient while the screens load. It may take awhile."""), width=73, height=16)
638
639 #First set the USE flags, this is a biggie.
640 if make_conf.has_key("USE"):
641 system_use_flags = make_conf["USE"]
642 else: #not a preloaded config. this is the NORMAL case.
643 system_use_flags = GLIUtility.spawn("portageq envvar USE", return_output=True)[1].strip().split()
644 use_flags = []
645 use_local_flags = []
646 use_desc = GLIUtility.get_global_use_flags()
647 use_local_desc = GLIUtility.get_local_use_flags()
648
649 #populate the choices list
650 sorted_use = use_desc.keys()
651 sorted_use.sort()
652 for flagname in sorted_use:
653 use_flags.append((flagname, use_desc[flagname], int(flagname in system_use_flags)))
654 #present the menu
655 code, use_flags = self._d.checklist(_(u"Choose which *global* USE flags you want on the new system"), height=25, width=80,list_height=17, choices=use_flags)
656
657 #populate the chocies list
658 sorted_use = use_local_desc.keys()
659 sorted_use.sort()
660 for flagname in sorted_use:
661 use_local_flags.append((flagname, use_local_desc[flagname], int(flagname in system_use_flags)))
662 #present the menu
663 code, use_local_flags = self._d.checklist(_(u"Choose which *local* USE flags you want on the new system"), height=25, width=80,list_height=17, choices=use_local_flags)
664 temp_use = ""
665 for flag in use_flags:
666 temp_use += flag + " "
667 for flag in use_local_flags:
668 temp_use += flag + " "
669 make_conf["USE"] = temp_use
670
671 if not self._install_profile.get_dynamic_stage3() and self.advanced_mode:
672 #Second, set the ACCEPT_KEYWORDS
673 #Change the Yes/No buttons to new labels for this question.
674 self._d.add_persistent_args(["--yes-label", _(u"Stable")])
675 self._d.add_persistent_args(["--no-label", _(u"Unstable")])
676 if self._d.yesno(_(u"Do you want to run the normal stable portage tree, or the bleeding edge unstable (i.e. ACCEPT_KEYWORDS=arch)? If unsure select stable. Stable is required for GRP installs."), height=12, width=55) == self._DLG_YES:
677 #Stable
678 make_conf["ACCEPT_KEYWORDS"] = ""
679 else: #Unstable
680 make_conf["ACCEPT_KEYWORDS"] = "~" + self._client_profile.get_architecture_template()
681 #Third, misc. stuff.
682 while self.advanced_mode:
683 menulist = [("CFLAGS",_(u"Edit your C Flags and Optimization level")),
684 ("CHOST", _(u"Change the Host Setting")),
685 ("MAKEOPTS", _(u"Specify number of parallel makes (-j) to perform.")),
686 ("FEATURES", _(u"Change portage functionality settings. (distcc/ccache)")),
687 ("GENTOO_MIRRORS", _(u"Specify mirrors to use for source retrieval.")),
688 ("SYNC", _(u"Specify server used by rsync to sync the portage tree.")),
689 (_(u"Other"), _(u"Specify your own variable and value."))]
690 if self._install_profile.get_dynamic_stage3(): #SPECIAL LIST WITHOUT CHOST
691 menulist = [("CFLAGS",_(u"Edit your C Flags and Optimization level")),
692 ("MAKEOPTS", _(u"Specify number of parallel makes (-j) to perform.")),
693 ("FEATURES", _(u"Change portage functionality settings. (distcc/ccache)")),
694 ("GENTOO_MIRRORS", _(u"Specify mirrors to use for source retrieval.")),
695 ("SYNC", _(u"Specify server used by rsync to sync the portage tree.")),
696 (_(u"Other"), _(u"Specify your own variable and value."))]
697 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"), width=77)
698 if code != self._DLG_OK:
699 break
700 if menuitem == _(u"Other"):
701 code,menuitem = self._d.inputbox(_(u"Enter the variable name: "))
702 if code != self._DLG_OK:
703 continue
704 oldval = ""
705 if make_conf.has_key(menuitem):
706 oldval = make_conf[menuitem]
707 if oldval:
708 code, newval = self._d.inputbox(_(u"Enter new value for ") + menuitem, init=oldval)
709 if code == self._DLG_OK:
710 make_conf[menuitem] = newval
711 continue
712 #SPECIAL CASES here with their own menus.
713 if menuitem == "CFLAGS":
714 if not make_conf.has_key("CFLAGS"):
715 try:
716 cflags = GLIUtility.get_value_from_config("/etc/make.conf","CFLAGS")
717 except:
718 cflags = ""
719 else:
720 cflags = make_conf['CFLAGS']
721 while 1:
722 choices_list = [
723 ("CLEAR",_(u"Erase the current value and start over.")),
724 ("-mcpu",_(u"Add a CPU optimization (deprecated in GCC 3.4)")),
725 ("-mtune",_(u"Add a CPU optimization (GCC 3.4+)")),
726 ("-march",_(u"Add an Architecture optimization")),
727 ("-O",_(u"Add optimization level (please do NOT go over 2)")),
728 ("-fomit-frame-pointer",_(u"For advanced users only.")),
729 ("-pipe",_(u"Common additional flag")),
730 (_(u"Manual"),_(u"Specify your CFLAGS manually"))
731 ]
732 code, choice = self._d.menu(_(u"Choose a flag to add to the CFLAGS variable or Done to go back. The current value is: ")+ cflags, choices=choices_list, cancel=_(u"Done"), width=70)
733 if code != self._DLG_OK:
734 break
735 if choice == "CLEAR":
736 cflags = ""
737 elif choice == _(u"Manual"):
738 code, cflags = self._d.inputbox(_(u"Enter new value for ") + menuitem)
739 break
740 elif choice in ["-fomit-frame-pointer","-pipe"]:
741 cflags += " "+choice
742 else:
743 code, newval = self._d.inputbox(_(u"Enter the new value for %s (value only):") % choice)
744 if code != self._DLG_OK or not newval:
745 continue
746 if choice == "-O":
747 cflags += " "+choice+newval
748 else:
749 cflags += " "+choice+"="+newval
750 if cflags:
751 make_conf['CFLAGS'] = cflags
752 elif menuitem == "CHOST":
753 choices_list = GLIUtility.get_chosts(self._client_profile.get_architecture_template())
754 code, chost = self._d.menu(_(u"Choose from the available CHOSTs for your architecture."), choices=self._dmenu_list_to_choices(choices_list), width=77)
755 if code != self._DLG_OK:
756 continue
757 chost = choices_list[int(chost)-1]
758 make_conf['CHOST'] = chost
759 elif menuitem == "MAKEOPTS":
760 makeopt_string = _(u"Presently the only use is for specifying the number of parallel makes (-j) to perform. The suggested number for parallel makes is CPUs+1. Enter the NUMBER ONLY:")
761 code, newval = self._d.inputbox(makeopt_string, width=60)
762 if code != self._DLG_OK:
763 continue
764 make_conf['MAKEOPTS'] = "-j "+str(newval)
765 elif menuitem == "FEATURES":
766 choices_list = [("sandbox",_(u"enables sandboxing when running emerge and ebuild."),0),
767 ("ccache",_(u"enables ccache support via CC."),0),
768 ("distcc",_(u"enables distcc support via CC."),0),
769 ("distlocks",_(u"enables distfiles locking using fcntl or hardlinks."),0),
770 ("buildpkg",_(u"create binaries of all packages emerged"),0),
771 (_(u"Other"),_(u"Input your list of FEATURES manually."),0) ]
772 features_string = _(u"FEATURES are settings that affect the functionality of portage. Most of these settings are for developer use, but some are available to non-developers as well.")
773 code, choices = self._d.checklist(features_string, choices=choices_list, width=75)
774 if code != self._DLG_OK:
775 continue
776 if _(u"Other") in choices:
777 code, features = self._d.inputbox(_(u"Enter the value of FEATURES: "))
778 elif choices:
779 features = string.join(choices, ' ')
780 else:
781 features = ""
782 if features:
783 make_conf['FEATURES'] = features
784 else:
785 code, newval = self._d.inputbox(_(u"Enter new value for ") + menuitem)
786 if code == self._DLG_OK and newval:
787 make_conf[menuitem] = newval
788
789 try:
790 if make_conf:
791 etc_files['make.conf'] = make_conf
792 self._install_profile.set_etc_files(etc_files)
793 except:
794 self._d.msgbox(_(u"ERROR! Could not set the make_conf correctly!"))
795
796 def set_distcc(self):
797 #Change the Yes/No buttons for this question.
798 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
799 self._d.add_persistent_args(["--no-label", _(u"No")])
800 if self._d.yesno(_(u"Do you want to use distcc to compile your extra packages during the install and for future compilations as well?"), height=12, width=60) == self._DLG_YES:
801 #Add distcc to the services list.
802 if self._install_profile.get_services():
803 services = self._install_profile.get_services()
804 if isinstance(services, str):
805 services = services.split(',')
806 else:
807 services = []
808 if not "distccd" in services:
809 services.append("distccd")
810 try:
811 services = string.join(services, ',')
812 if services:
813 self._install_profile.set_services(None, services, None)
814 except:
815 self._d.msgbox(_(u"ERROR! Could not set the services list."))
816 return
817 #Set the distcc flag to emerge earlier than other packages.
818 try:
819 self._install_profile.set_install_distcc(None, True, None)
820 except:
821 self._d.msgbox(_(u"ERROR! Could not set the install distcc flag!"))
822 return
823
824 #Add distcc to the FEATURES in make.conf and add DISTCC_HOSTS too.
825 etc_files = self._install_profile.get_etc_files()
826 #load up the make.conf
827 if etc_files.has_key("make.conf"):
828 make_conf = etc_files['make.conf']
829 else:
830 make_conf = {}
831 #Check for FEATURES and add if not already there.
832 if make_conf.has_key("FEATURES"):
833 if not "distcc" in make_conf['FEATURES']:
834 make_conf['FEATURES'] += " distcc"
835 else:
836 make_conf['FEATURES'] = "distcc"
837 #Now while still working in make.conf, figure out what HOSTS to set.
838 if make_conf.has_key("DISTCC_HOSTS"):
839 initval = make_conf['DISTCC_HOSTS']
840 else:
841 initval = "localhost "
842 distcc_string = _(u"Enter the hosts to be used by distcc for compilation:\nExample: localhost 192.168.0.2 192.168.0.3:4000/10")
843 code, hosts = self._d.inputbox(distcc_string, width=75, init=initval)
844 if code != self._DLG_OK:
845 hosts = initval
846 make_conf['DISTCC_HOSTS'] = hosts
847 try:
848 etc_files['make.conf'] = make_conf
849 self._install_profile.set_etc_files(etc_files)
850 except:
851 self._d.msgbox(_(u"ERROR! Could not set the make_conf correctly!"))
852
853 def set_etc_portage(self):
854 if self._networkless: return
855 #This section will be for editing the /etc/portage/* files and other /etc/* files. This should be for advanced users only.
856 etc_files = self._install_profile.get_etc_files()
857 while self.advanced_mode:
858
859 menulist = [("portage/package.mask",_(u"A list of DEPEND atoms to mask.")),
860 ("portage/package.unmask",_(u"A list of packages to unmask.")),
861 ("portage/package.keywords",_(u"Per-package KEYWORDS (like ACCEPT_KEYWORDS).")),
862 ("portage/package.use",_(u"Per-package USE flags.")),
863 (_(u"Other"),_(u"Type your own name of a file to edit in /etc/"))]
864 code, menuitem = self._d.menu(_(u"For experienced users, the following /etc/* variables can also be defined. Choose a variable to edit or Done to continue."), choices=menulist, cancel=_(u"Done"), width=77)
865 if code != self._DLG_OK:
866 break #get out of the while loop. then save and continue
867
868 if menuitem == _(u"Other"):
869 code, menuitem = self._d.inputbox(_(u"Enter the name of the /etc/ file you would like to edit (DO NOT type /etc/)"))
870 if code != self._DLG_OK:
871 return
872 oldval = ""
873 if etc_files.has_key(menuitem):
874 oldval = etc_files[menuitem]
875
876 code, newval = self._d.inputbox(_(u"Enter new contents (use \\n for newline) of ") + menuitem, init=oldval)
877 if code == self._DLG_OK:
878 etc_files[menuitem] = []
879 etc_files[menuitem].append(newval)
880 try:
881 self._install_profile.set_etc_files(etc_files)
882 except:
883 self._d.msgbox(_(u"ERROR! Could not set etc/portage/* correctly!"))
884
885
886
887 def set_kernel(self):
888 if self._networkless: return
889 # This section will be for choosing kernel sources, choosing (and specifying) a custom config or genkernel, modules to load at startup, etc.
890 kernel_sources = [("livecd-kernel", _(u"Copy over the current running kernel (fastest)")),
891 ("vanilla-sources", _(u"The Unaltered Linux Kernel ver 2.6+ (safest)")),
892 ("gentoo-sources", _(u"Gentoo's optimized 2.6+ kernel. (less safe)")),
893 ("hardened-sources", _(u"Hardened sources for the 2.6 kernel tree")),
894 ("grsec-sources",_(u"Vanilla sources with grsecurity patches")),
895 (_(u"Other"), _(u"Choose one of the other sources available."))]
896 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, width=77, height=17)
897 if code != self._DLG_OK:
898 return
899 if menuitem == _(u"Other"):
900 code, menuitem = self._d.inputbox(_(u"Please enter the desired kernel sources package name:"))
901 if code != self._DLG_OK: return
902 try:
903 self._install_profile.set_kernel_source_pkg(None, menuitem, None)
904 except:
905 self._d.msgbox(_(u"ERROR! Could not set the kernel source package!"))
906 if not menuitem == "livecd-kernel":
907 #Change the Yes/No buttons to new labels for this question.
908 self._d.add_persistent_args(["--yes-label", _(u"Genkernel")])
909 self._d.add_persistent_args(["--no-label", _(u"Traditional (requires a config!)")])
910 kernel_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.")
911 if self._d.yesno(kernel_string1, width=76,height=13) == self._DLG_YES: #Genkernel
912 self._install_profile.set_kernel_build_method(None,"genkernel", None)
913 if self.advanced_mode:
914 #Change the Yes/No buttons back.
915 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
916 self._d.add_persistent_args(["--no-label", _(u"No")])
917 if self._d.yesno(_(u"Do you want the bootsplash screen to show up on bootup?")) == self._DLG_YES:
918 self._install_profile.set_kernel_bootsplash(None, True, None)
919 else:
920 self._install_profile.set_kernel_bootsplash(None, False, None)
921 else: #Custom
922 self._install_profile.set_kernel_build_method(None,"custom", None)
923 if self.advanced_mode:
924 code, custom_kernel_uri = self._d.inputbox(_(u"If you have a custom kernel configuration, enter its location (otherwise just press Enter to continue):"), height=13, width=50)
925 if code == self._DLG_OK:
926 if custom_kernel_uri:
927 if not GLIUtility.is_uri(custom_kernel_uri, checklocal=self.local_install):
928 self._d.msgbox(_(u"The specified URI is invalid. It was not saved. Please go back and try again."))
929 else:
930 try:
931 self._install_profile.set_kernel_config_uri(None, custom_kernel_uri, None)
932 except:
933 self._d.msgbox(_(u"ERROR! Could not set the kernel config URI!"))
934 #else: self._d.msgbox(_(u"No URI was specified! Reverting to using genkernel"))
935
936 def set_boot_loader(self):
937 arch = self._client_profile.get_architecture_template()
938 parts = self._install_profile.get_partition_tables()
939 #Bootloader code yanked from the x86ArchTemplate
940 if self._install_profile.get_boot_device():
941 boot_device = self._install_profile.get_boot_device()
942 else:
943 boot_device = ""
944 foundboot = False
945 for device in parts:
946 tmp_partitions = parts[device] #.get_install_profile_structure()
947 for partition in tmp_partitions:
948 mountpoint = tmp_partitions[partition]['mountpoint']
949 if (mountpoint == "/boot"):
950 foundboot = True
951 if (( (mountpoint == "/") and (not foundboot) ) or (mountpoint == "/boot")):
952 boot_device = device
953
954 arch_loaders = { 'x86': [
955 ("grub",_(u"GRand Unified Bootloader, newer, RECOMMENDED")),
956 ("lilo",_(u"LInux LOader, older, traditional.(detects windows partitions)"))],
957 'amd64': [
958 ("grub",_(u"GRand Unified Bootloader, newer, RECOMMENDED"))]} #FIXME ADD OTHER ARCHS
959 boot_loaders = arch_loaders[arch]
960 boot_loaders.append(("none", _(u"Do not install a bootloader. (System may be unbootable!)")))
961 boot_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")
962 code, menuitem = self._d.menu(boot_string1, choices=boot_loaders, height=16, width=74)
963 if code != self._DLG_OK:
964 return
965 try:
966 self._install_profile.set_boot_loader_pkg(None, menuitem, None)
967 except:
968 self._d.msgbox(_(u"ERROR! Could not set boot loader pkg! ")+menuitem)
969 if menuitem != "none" and self.advanced_mode:
970 #Reset the Yes/No labels.
971 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
972 self._d.add_persistent_args(["--no-label",_(u"No")])
973 boot_string2 = _(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)")
974 if self._d.yesno(boot_string2, height=13, width=55) == self._DLG_YES:
975 self._install_profile.set_boot_loader_mbr(None, True, None)
976 else:
977 self._install_profile.set_boot_loader_mbr(None, False, None)
978 if self._install_profile.get_boot_loader_mbr(): #If we're installing to MBR gotta check the device.
979 if self.advanced_mode or (boot_device[-1] != 'a'):
980 #show the menu.
981 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
982 boot_string3 = _(u" Please confirm your boot device by choosing it from the menu.")
983 if not self.advanced_mode:
984 boot_string3 = boot_string3_std + boot_string3
985 #grab choies from the partiton list.
986 boot_drive_choices = []
987 for device in parts:
988 boot_drive_choices.append(device)
989 if not boot_drive_choices:
990 self._d.msgbox(_(u"ERROR: No drives set up. Please complete the Partitioning screen first!"))
991 return
992 code, boot_drive_choice = self._d.menu(boot_string3, choices=self._dmenu_list_to_choices(boot_drive_choices), height=16, width=70)
993 if code != self._DLG_OK:
994 return
995 boot_drive_choice = boot_drive_choices[int(boot_drive_choice)-1]
996 try:
997 self._install_profile.set_boot_device(None,boot_drive_choice,None)
998 except:
999 self._d.msgbox(_(u"ERROR! Could not set the boot device!")+boot_drive_choice)
1000 if self.advanced_mode:
1001 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:"), height=12, width=55)
1002 if code == self._DLG_OK:
1003 try:
1004 self._install_profile.set_bootloader_kernel_args(None, bootloader_kernel_args, None)
1005 except:
1006 self._d.msgbox(_(u"ERROR! Could not set bootloader kernel arguments! ")+bootloader_kernel_args)
1007
1008
1009 def set_timezone(self):
1010 # This section will be for setting the timezone.
1011 zonepath = "/usr/share/zoneinfo"
1012 skiplist = ["zone.tab","iso3166.tab","posixrules"]
1013 while 1:
1014 tzlist = []
1015 for entry in os.listdir(zonepath):
1016 if entry not in skiplist:
1017 if os.path.isdir(zonepath + "/" + entry): entry += "/"
1018 tzlist.append(entry)
1019 tzlist.sort()
1020 timezone_string = _(u"Please select the timezone for the new installation. Entries ending with a / can be selected to reveal a sub-list of more specific locations. For example, you can select America/ and then Chicago.")
1021 code, tznum = self._d.menu(timezone_string, choices=self._dmenu_list_to_choices(tzlist), height=20, cancel="Back")
1022 if code == self._DLG_OK:
1023 zonepath = os.path.join(zonepath,tzlist[int(tznum)-1])
1024 if tzlist[int(tznum)-1][-1:] != "/":
1025 break
1026 else:
1027 if zonepath == "/usr/share/zoneinfo":
1028 return
1029 slashloc = zonepath[:-1].rfind("/")
1030 zonepath = zonepath[:slashloc]
1031 try:
1032 self._install_profile.set_time_zone(None, zonepath[20:], None)
1033 except:
1034 self._d.msgbox(_(u"ERROR: Could not set that timezone!"))
1035
1036 def set_networking(self):
1037 # This section will be for setting up network interfaces
1038 interfaces = self._install_profile.get_network_interfaces()
1039 CC_iface = self._client_profile.get_network_interface()
1040 if CC_iface and (CC_iface not in interfaces):
1041 #The CC has a network config that's not already there. Preload it.
1042 CC_net_type = self._client_profile.get_network_type()
1043 if CC_net_type == 'dhcp':
1044 try:
1045 interfaces[CC_iface] = ('dhcp', self._client_profile.get_network_dhcp_options(), None)
1046 except:
1047 pass
1048 else:
1049 try:
1050 interfaces[CC_iface] = (self._client_profile.get_network_ip(), self._client_profile.get_network_broadcast(), self._client_profile.get_network_netmask())
1051 except:
1052 pass
1053
1054 while 1:
1055 net_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.")
1056 net_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:")
1057 choice_list = []
1058 for iface in interfaces:
1059 if interfaces[iface][0] == 'dhcp':
1060 choice_list.append((iface, _(u"Settings: DHCP. Options: ")+ interfaces[iface][1]))
1061 else:
1062 choice_list.append((iface, _(u"IP: ")+interfaces[iface][0]+_(u" Broadcast: ")+interfaces[iface][1]+_(u" Netmask: ")+interfaces[iface][2]))
1063 choice_list.append(("Add",_(u"Add a new network interface")))
1064 code, iface_choice = self._d.menu(net_string1, choices=choice_list, cancel=_(u"Save and Continue"), height=18, width=77)
1065 if code != self._DLG_OK:
1066 try:
1067 self._install_profile.set_network_interfaces(interfaces)
1068 except:
1069 self_d.msgbox(_(u"ERROR! Could not set the network interfaces!"))
1070 break #This should hopefully move the user down to part two of set_networking
1071 if iface_choice == "Add":
1072 if self.local_install:
1073 device_list = GLIUtility.get_eth_devices()
1074 newchoice_list = []
1075 for device in device_list:
1076 if device not in interfaces:
1077 newchoice_list.append((device, GLIUtility.get_interface_realname(device)))
1078 newchoice_list.append((_(u"Other"),_(u"Type your own.")))
1079 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)
1080 else:
1081 newnic == _(u"Other")
1082 if newnic == _(u"Other"):
1083 code, newnic = self._d.inputbox(_(u"Enter name for new interface (eth0, ppp0, etc.)"))
1084 if code != self._DLG_OK:
1085 continue
1086 if newnic in interfaces:
1087 self._d.msgbox(_(u"An interface with the name is already defined."))
1088 continue
1089 #create the interface in the data structure.
1090 #interfaces[newnic] = ("", "", "")
1091 #Change the Yes/No buttons to new labels for this question.
1092 self._d.add_persistent_args(["--yes-label", _(u"DHCP")])
1093 self._d.add_persistent_args(["--no-label", _(u"Static IP/Manual")])
1094 if self._d.yesno(net_string2, height=15, width=60) == self._DLG_YES: #DHCP
1095 dhcp_options = ""
1096 if self.advanced_mode:
1097 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)
1098 interfaces[newnic] = ('dhcp', dhcp_options, None)
1099 else:
1100 network_type = 'static'
1101 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!'),
1102 ((_(u'Enter your IP address:'), 15),
1103 (_(u'Enter your Broadcast address:'), 15),
1104 (_(u'Enter your Netmask:'),15,'255.255.255.0')))
1105 (ip_address, broadcast, netmask) = data[:-1].split('\n')
1106 if code != self._DLG_OK:
1107 continue
1108 #Set the info now that it's all gathered.
1109 interfaces[newnic] = (ip_address, broadcast, netmask)
1110 else: #they have chosen an interface, present them with edit/delete
1111 #Change the Yes/No buttons to new labels for this question.
1112 self._d.add_persistent_args(["--yes-label", _(u"Edit")])
1113 self._d.add_persistent_args(["--no-label", _(u"Delete")])
1114 if self._d.yesno(_(u"For interface %s, you can either edit the interface information (IP Address, Broadcast, Netmask) or Delete the interface.") % iface_choice) == self._DLG_YES:
1115 #Edit
1116 #Change the Yes/No buttons to new labels for this question.
1117 self._d.add_persistent_args(["--yes-label", _(u"DHCP")])
1118 self._d.add_persistent_args(["--no-label", _(u"Static IP/Manual")])
1119 if self._d.yesno(net_string2, height=15, width=60) == self._DLG_YES: #DHCP
1120 dhcp_options = ""
1121 if self.advanced_mode:
1122 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)
1123 interfaces[iface_choice] = ('dhcp', dhcp_options, None)
1124 else:
1125 network_type = 'static'
1126 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!'),
1127 ((_(u'Enter your IP address:'), 15, interfaces[iface_choice][0]),
1128 (_(u'Enter your Broadcast address:'), 15, interfaces[iface_choice][1]),
1129 (_(u'Enter your Netmask:'),15,interfaces[iface_choice][2])))
1130 (ip_address, broadcast, netmask) = data[:-1].split('\n')
1131 if code != self._DLG_OK:
1132 continue
1133 #Set the info now that it's all gathered.
1134 interfaces[iface_choice] = (ip_address, broadcast, netmask)
1135 else:
1136 #Delete
1137 #Reset the Yes/No buttons
1138 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
1139 self._d.add_persistent_args(["--no-label", _(u"No")])
1140 if self._d.yesno(_(u"Are you sure you want to remove the interface ") + iface_choice + "?") == self._DLG_YES:
1141 del interfaces[iface_choice]
1142
1143 #This section is for defining DNS servers, default routes/gateways, hostname, etc.
1144 #First ask for the default gateway device and IP
1145 interfaces = self._install_profile.get_network_interfaces()
1146 choice_list = []
1147 for iface in interfaces:
1148 if interfaces[iface][0] == 'dhcp':
1149 choice_list.append((iface, _(u"Settings: DHCP. Options: ")+ interfaces[iface][1],0))
1150 else:
1151 choice_list.append((iface, _(u"IP: ")+interfaces[iface][0]+_(u" Broadcast: ")+interfaces[iface][1]+_(u" Netmask: ")+interfaces[iface][2],0))
1152 net_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:")
1153 if choice_list:
1154 code, gateway_iface = self._d.radiolist(net_string3, choices=choice_list, height=20, width=67)
1155 if (code == self._DLG_OK) and gateway_iface: #They made a choice. Ask the IP if not DHCP.
1156 while interfaces[gateway_iface][0] != 'dhcp':
1157 code, ip = self._d.inputbox(_(u"Enter the gateway IP address for ") + gateway_iface, init=interfaces[gateway_iface][0])
1158 if code != self._DLG_OK:
1159 break
1160 if not GLIUtility.is_ip(ip):
1161 self._d.msgbox(_(u"Invalid IP Entered! Please try again."))
1162 continue
1163 try:
1164 self._install_profile.set_default_gateway(None, ip,{'interface': gateway_iface})
1165 except:
1166 self._d.msgbox(_(u"ERROR! Coult not set the default gateway with IP %s for interface %s") % (ip, gateway_iface))
1167 break
1168 #Now ask for the other info in a large form.
1169 error = True
1170 hostname = ""
1171 domainname = ""
1172 nisdomainname = ""
1173 primary_dns = ""
1174 backup_dns = ""
1175 http_proxy = ""
1176 ftp_proxy = ""
1177 rsync_proxy = ""
1178 while error:
1179 error = False
1180 if self.advanced_mode:
1181 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!'),
1182 ((_(u'Enter your Hostname:'), 25, self._install_profile.get_hostname()),
1183 (_(u'Enter your Domain Name:'), 25, self._install_profile.get_domainname()),
1184 (_(u'Enter your NIS Domain Name:'),25,self._install_profile.get_nisdomainname()),
1185 (_(u'Enter a primary DNS server:'),15),
1186 (_(u'Enter a backup DNS server:'),15),
1187 (_(u'Enter a HTTP Proxy IP:'), 15,self._install_profile.get_http_proxy()),
1188 (_(u'Enter a FTP Proxy IP:'), 15, self._install_profile.get_ftp_proxy()),
1189 (_(u'Enter a RSYNC Proxy:'),15,self._install_profile.get_rsync_proxy())))
1190 if code != self._DLG_OK:
1191 return
1192 (hostname, domainname, nisdomainname, primary_dns, backup_dns, http_proxy, ftp_proxy, rsync_proxy) = data[:-1].split('\n')
1193 else: #standard mode
1194 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!'),
1195 ((_(u'Enter your Hostname:'), 25, self._install_profile.get_hostname()),
1196 (_(u'Enter your Domain Name:'), 25, self._install_profile.get_domainname()),
1197 (_(u'Enter a primary DNS server:'),15),
1198 (_(u'Enter a backup DNS server:'),15)))
1199 if code != self._DLG_OK:
1200 return
1201 (hostname, domainname, primary_dns, backup_dns) = data[:-1].split('\n')
1202 #Check the data before entering it.
1203 if hostname:
1204 if type(hostname) != str:
1205 self._d.msgbox(_(u"Incorrect hostname! It must be a string. Not saved."))
1206 error = True
1207 else:
1208 try:
1209 self._install_profile.set_hostname(None, hostname, None)
1210 except:
1211 self._d.msgbox(_(u"ERROR! Could not set the hostname:")+hostname)
1212 error = True
1213 if domainname:
1214 if type(domainname) != str:
1215 self._d.msgbox(_(u"Incorrect domainname! It must be a string. Not saved."))
1216 error = True
1217 else:
1218 try:
1219 self._install_profile.set_domainname(None, domainname, None)
1220 except:
1221 self._d.msgbox(_(u"ERROR! Could not set the domainname:")+domainname)
1222 error = True
1223 if nisdomainname:
1224 if type(nisdomainname) != str:
1225 self._d.msgbox(_(u"Incorrect nisdomainname! It must be a string. Not saved."))
1226 error = True
1227 else:
1228 try:
1229 self._install_profile.set_nisdomainname(None, nisdomainname, None)
1230 except:
1231 self._d.msgbox(_(u"ERROR! Could not set the nisdomainname:")+nisdomainname)
1232 error = True
1233 if primary_dns:
1234 if not GLIUtility.is_ip(primary_dns):
1235 self._d.msgbox(_(u"Incorrect Primary DNS Server! Not saved."))
1236 error = True
1237 else:
1238 if backup_dns:
1239 if not GLIUtility.is_ip(backup_dns):
1240 self._d.msgbox(_(u"Incorrect Backup DNS Server! Not saved."))
1241 error = True
1242 else:
1243 primary_dns = primary_dns + " " + backup_dns
1244 try:
1245 self._install_profile.set_dns_servers(None, primary_dns, None)
1246 except:
1247 self._d.msgbox(_(u"ERROR! Could not set the DNS Servers:")+primary_dns)
1248 error = True
1249 if http_proxy:
1250 if not GLIUtility.is_uri(http_proxy):
1251 self._d.msgbox(_(u"Incorrect HTTP Proxy! It must be a uri. Not saved."))
1252 error = True
1253 else:
1254 try:
1255 self._install_profile.set_http_proxy(None, http_proxy, None)
1256 except:
1257 self._d.msgbox(_(u"ERROR! Could not set the HTTP Proxy:")+http_proxy)
1258 error = True
1259 if ftp_proxy:
1260 if not GLIUtility.is_uri(ftp_proxy):
1261 self._d.msgbox(_(u"Incorrect FTP Proxy! It must be a uri. Not saved."))
1262 error = True
1263 else:
1264 try:
1265 self._install_profile.set_ftp_proxy(None, ftp_proxy, None)
1266 except:
1267 self._d.msgbox(_(u"ERROR! Could not set the FTP Proxy:")+ftp_proxy)
1268 error = True
1269 if rsync_proxy:
1270 if not GLIUtility.is_uri(rsync_proxy):
1271 self._d.msgbox(_(u"Incorrect RSYNC Proxy! It must be a uri. Not saved."))
1272 error = True
1273 else:
1274 try:
1275 self._install_profile.set_rsync_proxy(None, rsync_proxy, None)
1276 except:
1277 self._d.msgbox(_(u"ERROR! Could not set the RSYNC Proxy:")+rsync_proxy)
1278 error = True
1279
1280
1281 def set_cron_daemon(self):
1282 if self._networkless: return
1283 cron_daemons = (("vixie-cron", _(u"Paul Vixie's cron daemon, fully featured, RECOMMENDED.")),
1284 ("dcron",_(u"A cute little cron from Matt Dillon.")),
1285 ("fcron", _(u"A scheduler with extended capabilities over cron & anacron")),
1286 ("None", _(u"Don't use a cron daemon. (NOT Recommended!)")))
1287 cron_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:")
1288 code, menuitem = self._d.menu(cron_string, choices=cron_daemons, height=21, width=77)
1289 if code == self._DLG_OK:
1290 if menuitem == "None":
1291 menuitem = ""
1292 self._install_profile.set_cron_daemon_pkg(None, menuitem, None)
1293
1294 def set_logger(self):
1295 if self._networkless: return
1296 loggers = (("syslog-ng", _(u"An advanced system logger.")),
1297 ("metalog", _(u"A Highly-configurable system logger.")),
1298 ("syslogkd", _(u"The traditional set of system logging daemons.")))
1299 logger_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. If doing networkless, choose syslog-ng. Choose a system logger:")
1300 code, menuitem = self._d.menu(logger_string, choices=loggers, height=21, width=68)
1301 if code == self._DLG_OK:
1302 self._install_profile.set_logging_daemon_pkg(None, menuitem, None)
1303
1304 def set_extra_packages(self):
1305 #d.msgbox("This section is for selecting extra packages (pcmcia-cs, rp-pppoe, xorg-x11, etc.) and setting them up")
1306 if self._install_profile.get_install_packages():
1307 install_packages = self._install_profile.get_install_packages()
1308 if isinstance(install_packages, str):
1309 install_packages = install_packages.split()
1310 else:
1311 install_packages = []
1312 package_list = self._install_profile.get_install_package_list()
1313 highlevel_menu = []
1314 for group in package_list:
1315 highlevel_menu.append( (group, package_list[group][0]) )
1316 highlevel_menu.append( ("Manual", "Type your own space-separated list of packages.") )
1317
1318 while 1:
1319 extra_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'.")
1320 code, submenu = self._d.menu(extra_string1+ _(u"\nYour current package list is: ")+string.join(install_packages, ','), choices=highlevel_menu, cancel=_(u"Save and Continue"), width=70, height=23)
1321 if code != self._DLG_OK: #Save and move on.
1322 try:
1323 packages = string.join(install_packages, ' ')
1324 if packages:
1325 self._install_profile.set_install_packages(None, packages, None)
1326 except:
1327 self._d.msgbox(_(u"ERROR! Could not set the install packages! List of packages:"))
1328 return
1329 #Popular Desktop Applications
1330 choices_list = []
1331 #pkgs = {}
1332
1333 #Special case first.
1334 if submenu == "Manual":
1335 code, tmp_install_packages = self._d.inputbox(_(u"Enter a space-separated list of extra packages to install on the system"), init=string.join(install_packages, ' '), width=70)
1336 if code == self._DLG_OK:
1337 install_packages = tmp_install_packages.split()
1338 continue
1339
1340 #All other cases load pkgs and GRP
1341 pkgs = package_list[submenu][1]
1342 grp_list = GLIUtility.get_grp_pkgs_from_cd()
1343 for pkg in pkgs:
1344 if pkg in grp_list:
1345 choices_list.append((pkg, "(GRP) "+pkgs[pkg], int(pkg in install_packages)))
1346 else:
1347 if not self._networkless:
1348 choices_list.append((pkg, pkgs[pkg], int(pkg in install_packages)))
1349 if not choices_list: continue
1350 code, choices = self._d.checklist(_(u"Choose from the listed packages. If doing a networkless install, only choose (GRP) packages."), choices=choices_list, height=19, list_height=10, width=77)
1351 if code != self._DLG_OK:
1352 continue
1353 for pkg in pkgs: #clear out packages from this list that are already in install_packages so that you can uncheck packages and they will be removed. the ones that remain checked will be re-added.
1354 for i, tmppkg in enumerate(install_packages):
1355 if tmppkg == pkg:
1356 del install_packages[i]
1357
1358 for package in choices:
1359 install_packages.append(package)
1360 #special cases for desktop environments
1361 if package in ["xorg-x11", "gnome","kde","blackbox","enlightenment","fluxbox","xfce4"]: #ask about X
1362 #Reset the Yes/No buttons
1363 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
1364 self._d.add_persistent_args(["--no-label", _(u"No")])
1365 if not self.advanced_mode or self._d.yesno(_(u"Do you want to start X on bootup?")) == self._DLG_YES:
1366 services = self._install_profile.get_services() or 'xdm'
1367 if isinstance(services, list):
1368 services = string.join(services, ',')
1369 if 'xdm' not in services:
1370 services += ',xdm'
1371 try:
1372 self._install_profile.set_services(None, services, None)
1373 except:
1374 self._d.msgbox(_(u"ERROR! Could not set the services list."))
1375 #rc.conf changes specific to packages.
1376 if package == "gnome":
1377 etc_files = self._install_profile.get_etc_files()
1378 if not "rc.conf" in etc_files:
1379 etc_files['rc.conf'] = {}
1380 etc_files['rc.conf']['DISPLAYMANAGER'] = "gdm"
1381 self._install_profile.set_etc_files(etc_files)
1382 if package == "kde":
1383 etc_files = self._install_profile.get_etc_files()
1384 if not "rc.conf" in etc_files:
1385 etc_files['rc.conf'] = {}
1386 etc_files['rc.conf']['DISPLAYMANAGER'] = "kdm"
1387 self._install_profile.set_etc_files(etc_files)
1388 if package == "enlightenment":
1389 etc_files = self._install_profile.get_etc_files()
1390 if not "rc.conf" in etc_files:
1391 etc_files['rc.conf'] = {}
1392 etc_files['rc.conf']['DISPLAYMANAGER'] = "entrance"
1393 self._install_profile.set_etc_files(etc_files)
1394 if package == "fluxbox":
1395 etc_files = self._install_profile.get_etc_files()
1396 if not "rc.conf" in etc_files:
1397 etc_files['rc.conf'] = {}
1398 etc_files['rc.conf']['XSESSION'] = "fluxbox"
1399 self._install_profile.set_etc_files(etc_files)
1400
1401
1402
1403 def set_services(self):
1404 if self._install_profile.get_services():
1405 services = self._install_profile.get_services()
1406 if isinstance(services, str):
1407 services = services.split(',')
1408 else:
1409 services = []
1410 choice_list = [("alsasound", _(u"ALSA Sound Daemon"),int("alsasound" in services)),
1411 ("apache", _(u"Common web server (version 1.x)"),int("apache" in services)),
1412 ("apache2", _(u"Common web server (version 2.x)"),int("apache2" in services)),
1413 ("distccd", _(u"Distributed Compiling System"),int("distccd" in services)),
1414 ("esound", _(u"ESD Sound Daemon"),int("esound" in services)),
1415 ("hdparm", _(u"Hard Drive Tweaking Utility"),int("hdparm" in services)),
1416 ("local", _(u"Run scripts found in /etc/conf.d/local.start"),int("local" in services)),
1417 ("portmap", _(u"Port Mapping Service"),int("portmap" in services)),
1418 ("proftpd", _(u"Common FTP server"),int("proftpd" in services)),
1419 ("sshd", _(u"SSH Daemon (allows remote logins)"),int("sshd" in services)),
1420 ("xfs", _(u"X Font Server"),int("xfs" in services)),
1421 ("xdm", _(u"X Daemon"),int("xdm" in services)),
1422 (_(u"Other"),_(u"Manually specify your services in a comma-separated list."),0)]
1423 services_string = _(u"Choose the services you want started on bootup. Note that depending on what packages are selected, some services listed will not exist.")
1424 code, services_list = self._d.checklist(services_string, choices=choice_list, height=21, list_height=12, width=77)
1425 if code != self._DLG_OK:
1426 return
1427 services = []
1428 for service in services_list:
1429 services.append(service)
1430 if _(u"Other") in services_list:
1431 code, services = self._d.inputbox(_(u"Enter a comma-separated list of services to start on boot"), init=string.join(services, ','))
1432 if code != self._DLG_OK:
1433 return
1434 try:
1435 services = string.join(services, ',')
1436 if services:
1437 self._install_profile.set_services(None, services, None)
1438 except:
1439 self._d.msgbox(_(u"ERROR! Could not set the services list."))
1440 return
1441
1442 def set_rc_conf(self):
1443 # This section is for editing /etc/rc.conf
1444 if not self.advanced_mode:
1445 return
1446 etc_files = self._install_profile.get_etc_files()
1447 keymap = ""
1448 windowkeys = ""
1449 ext_keymap = ""
1450 font = ""
1451 trans = ""
1452 clock = ""
1453 editor = ""
1454 disp_manager = ""
1455 xsession = ""
1456 rc_string1 = _(u"Additional configuration settings for Advanced users (rc.conf)\nHere are some other variables you can set in various configuration files on the new system. If you don't know what a variable does, don't change it!")
1457 menulist = [("KEYMAP",_(u"Use KEYMAP to specify the default console keymap.")),
1458 ("SET_WINDOWSKEYS", _(u"Decision to first load the 'windowkeys' console keymap")),
1459 ("EXTENDED_KEYMAPS", _(u"maps to load for extended keyboards. Most users will leave this as is.")),
1460 ("CONSOLEFONT", _(u"Specifies the default font that you'd like Linux to use on the console.")),
1461 ("CONSOLETRANSLATION", _(u"The charset map file to use.")),
1462 ("CLOCK", _(u"Set the clock to either UTC or local")),
1463 ("EDITOR", _(u"Set EDITOR to your preferred editor.")),
1464 ("DISPLAYMANAGER", _(u"What display manager do you use ? [ xdm | gdm | kdm | entrance ]")),
1465 ("XSESSION", _(u"a new variable to control what window manager to start default with X"))]
1466 while 1:
1467 code, variable = self._d.menu(rc_string1, choices=menulist, cancel=_(u"Save and Continue"), width=77, height=19)
1468 if code != self._DLG_OK:
1469 break
1470 if variable == "KEYMAP":
1471 keymap_list = GLIUtility.generate_keymap_list()
1472 code, keymap = self._d.menu(_(u"Choose your desired keymap:"), choices=self._dmenu_list_to_choices(keymap_list), height=19)
1473 if code != self._DLG_OK:
1474 continue
1475 keymap = keymap_list[int(keymap)-1]
1476
1477 elif variable == "SET_WINDOWSKEYS":
1478 #Reset the Yes/No buttons
1479 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
1480 self._d.add_persistent_args(["--no-label", _(u"No")])
1481 if self._d.yesno(_(u"Should we first load the 'windowkeys' console keymap? Most x86 users will say 'yes' here. Note that non-x86 users should leave it as 'no'.")) == self._DLG_YES:
1482 windowkeys = "yes"
1483 else:
1484 windowkeys = "no"
1485 elif variable == "EXTENDED_KEYMAPS":
1486 code, ext_keymap = self._d.inputbox(_(u"This sets the maps to load for extended keyboards. Most users will leave this as is. Enter new value for EXTENDED_KEYMAPS"), width=60)
1487 elif variable == "CONSOLEFONT":
1488 font_list = GLIUtility.generate_consolefont_list()
1489 code, font = self._d.menu(_(u"Choose your desired console font:"), choices=self._dmenu_list_to_choices(font_list), height=19)
1490 if code != self._DLG_OK:
1491 continue
1492 font = font_list[int(font)-1]
1493 elif variable == "CONSOLETRANSLATION":
1494 trans_list = GLIUtility.generate_consoletranslation_list()
1495 code, trans = self._d.menu(_(u"Choose your desired console translation:"), choices=self._dmenu_list_to_choices(trans_list), height=19)
1496 if code != self._DLG_OK:
1497 continue
1498 trans = trans_list[int(trans)-1]
1499 elif variable == "CLOCK":
1500 #Change the Yes/No buttons to new labels for this question.
1501 self._d.add_persistent_args(["--yes-label", "UTC"])
1502 self._d.add_persistent_args(["--no-label", "local"])
1503 if self._d.yesno(_(u"Should CLOCK be set to UTC or local? Unless you set your timezone to UTC you will want to choose local.")) == self._DLG_YES:
1504 clock = "UTC"
1505 else:
1506 clock = "local"
1507 elif variable == "EDITOR":
1508 choice_list = [("/bin/nano", _(u"Default editor.")), ("/usr/bin/vim", _(u"vi improved editor.")), ("/usr/bin/emacs", _(u"The emacs editor."))]
1509 code, editor = self._d.menu(_(u"Choose your default editor: "), choices=choice_list)
1510 elif variable == "DISPLAYMANAGER":
1511 choice_list = [("xdm", _(u"X Display Manager")),
1512 ("gdm", _(u"Gnome Display Manager")),
1513 ("kdm", _(u"KDE Display Manager")),
1514 ("entrance", _(u"Login Manager for Enlightenment"))]
1515 code, disp_manager = self._d.menu(_(u"Choose your desired display manager to use when starting X (note you must make sure that package also gets installed for it to work):"), choices=choice_list, width=65)
1516 elif variable == "XSESSION":
1517 code, xsession = self._d.inputbox(_(u"Choose what window manager you want to start default with X if run with xdm, startx, or xinit. (common options are Gnome or Xsession:"), width=65, height=12)
1518
1519 if not "conf.d/keymaps" in etc_files:
1520 if keymap or windowkeys or ext_keymap:
1521 etc_files['conf.d/keymaps'] = {}
1522 if not "conf.d/consolefont" in etc_files:
1523 if font or trans:
1524 etc_files['conf.d/consolefont'] = {}
1525 if not "conf.d/clock" in etc_files:
1526 if clock:
1527 etc_files['conf.d/clock'] = {}
1528 if not "rc.conf" in etc_files:
1529 if editor or disp_manager or xsession:
1530 etc_files['rc.conf'] = {}
1531 if keymap:
1532 etc_files['conf.d/keymaps']['KEYMAP'] = keymap
1533 if windowkeys:
1534 etc_files['conf.d/keymaps']['SET_WINDOWSKEYS'] = windowkeys
1535 if ext_keymap:
1536 etc_files['conf.d/keymaps']['EXTENDED_KEYMAPS'] = ext_keymap
1537 if font:
1538 etc_files['conf.d/consolefont']['CONSOLEFONT'] = font
1539 if trans:
1540 etc_files['conf.d/consolefont']['CONSOLETRANSLATION'] = trans
1541 if clock:
1542 etc_files['conf.d/clock']['CLOCK'] = clock
1543 if editor:
1544 etc_files['rc.conf']['EDITOR'] = editor
1545 if disp_manager:
1546 etc_files['rc.conf']['DISPLAYMANAGER'] = disp_manager
1547 if xsession:
1548 etc_files['rc.conf']['XSESSION'] = xsession
1549 self._install_profile.set_etc_files(etc_files)
1550
1551 def set_root_password(self):
1552 # The root password will be set here
1553 while 1:
1554 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.):"))
1555 if code != self._DLG_OK:
1556 return
1557 code, passwd2 = self._d.passwordbox(_(u"Enter the new root password again for confirmation"))
1558 if code != self._DLG_OK:
1559 return
1560 if passwd1 != passwd2:
1561 self._d.msgbox(_(u"The passwords do not match. Please try again or cancel."))
1562 else:
1563 try:
1564 self._install_profile.set_root_pass_hash(None, GLIUtility.hash_password(passwd1), None)
1565 except:
1566 self._d.msgbox(_(u"ERROR! Could not set the new system root password!"))
1567 self._d.msgbox(_(u"Password saved. Press Enter to continue."))
1568 return
1569
1570 def set_additional_users(self):
1571 # This section will be for adding non-root users
1572 users = {}
1573 for user in self._install_profile.get_users():
1574 users[user[0]] = (user[0], user[1], user[2], user[3], user[4], user[5], user[6])
1575 while 1:
1576 menu_list = []
1577 for user in users:
1578 menu_list.append(user)
1579 menu_list.sort()
1580 menu_list.append(_(u"Add user"))
1581 users_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:")
1582 code, menuitem = self._d.menu(users_string1, choices=self._dmenu_list_to_choices(menu_list), cancel="Save and Continue", height=19)
1583 if code != self._DLG_OK:
1584 #if self._d.yesno("Do you want to save changes?") == self._DLG_YES:
1585 tmpusers = []
1586 for user in users:
1587 tmpusers.append(users[user])
1588 try:
1589 self._install_profile.set_users(tmpusers)
1590 except:
1591 self._d.msgbox(_(u"ERROR! Could not set the additional users!"))
1592 break
1593 menuitem = menu_list[int(menuitem)-1]
1594 if menuitem == _(u"Add user"):
1595 code, newuser = self._d.inputbox(_(u"Enter the username for the new user"))
1596 if code != self._DLG_OK:
1597 continue
1598 if newuser in users:
1599 self._d.msgbox(_(u"A user with that name already exists"))
1600 continue
1601 code, passwd1 = self._d.passwordbox(_(u"Enter the new password for user ")+ newuser)
1602 code, passwd2 = self._d.passwordbox(_(u"Enter the new password again for confirmation"))
1603 if code == self._DLG_OK:
1604 if passwd1 != passwd2:
1605 self._d.msgbox(_(u"The passwords do not match! Go to the menu and try again."))
1606 #Create the entry for the new user
1607 new_user = [newuser, GLIUtility.hash_password(passwd1), ('users',), '/bin/bash', '/home/' + newuser, '', '']
1608 users[newuser] = new_user
1609 menuitem = newuser
1610 while 1:
1611 menulist = [_(u"Password"), _(u"Group Membership"), _(u"Shell"), _(u"Home Directory"), _(u"UID"), _(u"Comment"), _(u"Delete")]
1612 code, menuitem2 = self._d.menu(_(u"Choose an option for user ") + menuitem, choices=self._dmenu_list_to_choices(menulist), cancel=_(u"Back"))
1613 if code != self._DLG_OK:
1614 break
1615 menuitem2 = menulist[int(menuitem2)-1]
1616 if menuitem2 == _(u"Password"):
1617 code, passwd1 = self._d.passwordbox(_(u"Enter the new password"))
1618 if code != self._DLG_OK:
1619 continue
1620 code, passwd2 = self._d.passwordbox(_(u"Enter the new password again"))
1621 if code != self._DLG_OK:
1622 continue
1623 if passwd1 != passwd2:
1624 self._d.msgbox(_(u"The passwords do not match! Try again."))
1625 continue
1626 self._d.msgbox(_(u"Password saved. Press Enter to continue."))
1627 users[menuitem][1] = GLIUtility.hash_password(passwd1)
1628 elif menuitem2 == _(u"Group Membership"):
1629 prechk = users[menuitem][2]
1630 choice_list = [("users", _(u"The usual group for normal users."), int("users" in prechk)),
1631 ("wheel", _(u"Allows users to attempt to su to root."), int("wheel" in prechk)),
1632 ("audio", _(u"Allows access to audio devices."), int("audio" in prechk)),
1633 ("games", _(u"Allows access to games."), int("games" in prechk)),
1634 ("apache", _(u"For users who know what they're doing only."), int("apache" in prechk)),
1635 ("cdrom", _(u"For users who know what they're doing only."), int("cdrom" in prechk)),
1636 ("ftp", _(u"For users who know what they're doing only."), int("ftp" in prechk)),
1637 ("video", _(u"For users who know what they're doing only."), int("video" in prechk)),
1638 (_(u"Other"), _(u"Manually specify your groups in a comma-separated list."), 0)]
1639 users_string2 = _(u"Select which groups you would like the user %s to be in." % menuitem)
1640 code, group_list = self._d.checklist(users_string2, choices=choice_list, height=19, list_height=10, width=77)
1641 if code != self._DLG_OK:
1642 break
1643 groups = ""
1644 for group in group_list:
1645 groups += group + ","
1646 if groups:
1647 groups = groups[:-1]
1648 if _(u"Other") in group_list:
1649 code, groups = self._d.inputbox(_(u"Enter a comma-separated list of groups the user is to be in"), init=",".join(users[menuitem][2]))
1650 if code != self._DLG_OK: continue
1651 users[menuitem][2] = string.split(groups, ",")
1652 elif menuitem2 == _(u"Shell"):
1653 code, shell = self._d.inputbox(_(u"Enter the shell you want the user to use. default is /bin/bash. "), init=users[menuitem][3])
1654 if code != self._DLG_OK:
1655 continue
1656 users[menuitem][3] = shell
1657 elif menuitem2 == _(u"Home Directory"):
1658 code, homedir = self._d.inputbox(_(u"Enter the user's home directory. default is /home/username. "), init=users[menuitem][4])
1659 if code != self._DLG_OK:
1660 continue
1661 users[menuitem][4] = homedir
1662 elif menuitem2 == _(u"UID"):
1663 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], height=11, width=55)
1664 if code != self._DLG_OK:
1665 continue
1666 if type(uid) != int:
1667 continue
1668 users[menuitem][5] = uid
1669 elif menuitem2 == _(u"Comment"):
1670 code, comment = self._d.inputbox(_(u"Enter the user's comment. This is completely optional."), init=users[menuitem][6])
1671 if code != self._DLG_OK:
1672 continue
1673 users[menuitem][6] = comment
1674 elif menuitem2 == _(u"Delete"):
1675 #Reset the Yes/No buttons
1676 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
1677 self._d.add_persistent_args(["--no-label", _(u"No")])
1678 if self._d.yesno(_(u"Are you sure you want to delete the user ") + menuitem + "?") == self._DLG_YES:
1679 del users[menuitem]
1680 break
1681
1682
1683 def save_install_profile(self, xmlfilename="", askforfilename=True):
1684 code = 0
1685 filename = xmlfilename
1686 if askforfilename:
1687 code, filename = self._d.inputbox(_(u"Enter a filename for the XML file. Use full path!"), init=xmlfilename)
1688 if code != self._DLG_OK or not filename:
1689 return None
1690 if GLIUtility.is_file(filename):
1691 if not self._d.yesno(_(u"The file %s already exists. Do you want to overwrite it?") % filename) == self._DLG_YES:
1692 return None
1693 try:
1694 configuration = open(filename ,"w")
1695 configuration.write(self._install_profile.serialize())
1696 configuration.close()
1697 except:
1698 self._d.msgbox(_(u"Error. File couldn't be saved. It will be saved automatically to /tmp before the install."))
1699 return filename
1700 def show_settings(self):
1701 settings = _(u"Look carefully at the following settings to check for mistakes.\nThese are the installation settings you have chosen:\n\n")
1702 #Partitioning
1703 settings += "Partitioning: \n Key: Minor, Pri/Ext, Filesystem, MkfsOpts, Mountpoint, MountOpts, Size.\n"
1704 devices = self._install_profile.get_partition_tables()
1705 drives = devices.keys()
1706 drives.sort()
1707 for drive in drives:
1708 settings += " Drive: " + drive + devices[drive].get_model() + "\n"
1709 partlist = devices[drive].get_ordered_partition_list()
1710 tmpparts = devices[drive] #.get_partitions()
1711 for part in partlist:
1712 tmppart = tmpparts[part]
1713 entry = " "
1714 if tmppart.get_type() == "free":
1715 #partschoice = "New"
1716 entry += _(u" - Unallocated space (")
1717 if tmppart.is_logical():
1718 entry += _(u"logical, ")
1719 entry += str(tmppart.get_mb()) + "MB)"
1720 elif tmppart.get_type() == "extended":
1721 entry += str(int(tmppart.get_minor()))
1722 entry += _(u" - Extended Partition (") + str(tmppart.get_mb()) + "MB)"
1723 else:
1724 entry += str(int(tmppart.get_minor())) + " - "
1725 if tmppart.is_logical():
1726 entry += _(u"Logical (")
1727 else:
1728 entry += _(u"Primary (")
1729 entry += tmppart.get_type() + ", "
1730 entry += (tmppart.get_mkfsopts() or "none") + ", "
1731 entry += (tmppart.get_mountpoint() or "none") + ", "
1732 entry += (tmppart.get_mountopts() or "none") + ", "
1733 entry += str(tmppart.get_mb()) + "MB)"
1734 settings += entry + "\n"
1735
1736 #Network Mounts:
1737 network_mounts = copy.deepcopy(self._install_profile.get_network_mounts())
1738 settings += "\nNetwork Mounts: \n"
1739 for mount in network_mounts:
1740 settings += " "+mount['host']+":"+mount['export']+"\n"
1741
1742 #Install Stage:
1743 settings += "\nInstall Stage: " + str(self._install_profile.get_install_stage()) + "\n"
1744 if self._install_profile.get_dynamic_stage3():
1745 settings += " Tarball will be generated on the fly from the CD.\n"
1746 else:
1747 settings += " Tarball URI: " + self._install_profile.get_stage_tarball_uri() + "\n"
1748
1749 #Portage Tree Sync Type:
1750 settings += "\nPortage Tree Sync Type: " + self._install_profile.get_portage_tree_sync_type() + "\n"
1751 if self._install_profile.get_portage_tree_sync_type() == "snapshot":
1752 settings += " Portage snapshot URI: " + self._install_profile.get_portage_tree_snapshot_uri() + "\n"
1753
1754 #Kernel Settings:
1755 settings += "\nKernel Settings:\n"
1756 settings += " Kernel Sources: " + self._install_profile.get_kernel_source_pkg() + "\n"
1757 if self._install_profile.get_kernel_source_pkg() != "livecd-kernel":
1758 settings += " Kernel Build Method: " + self._install_profile.get_kernel_build_method() + "\n"
1759 if self._install_profile.get_kernel_build_method() == "genkernel":
1760 settings += " Kernel Bootsplash Option: " + str(self._install_profile.get_kernel_bootsplash()) + "\n"
1761 if self._install_profile.get_kernel_config_uri():
1762 settings += " Kernel Configuration URI: " + self._install_profile.get_kernel_config_uri() + "\n"
1763
1764 #Bootloader Settings:
1765 settings += "\nBootloader Settings:\n"
1766 settings += " Bootloader package: " + self._install_profile.get_boot_loader_pkg() + "\n"
1767 if self._install_profile.get_boot_loader_pkg() != "none":
1768 settings += " Install bootloader to MBR: " + str(self._install_profile.get_boot_loader_mbr()) + "\n"
1769 settings += " Bootloader kernel arguments: " +self._install_profile.get_bootloader_kernel_args() + "\n"
1770
1771 #Timezone:
1772 settings += "\nTimezone: " + self._install_profile.get_time_zone() + "\n"
1773
1774 #Networking Settings:
1775 settings += "\nNetworking Settings: \n"
1776 interfaces = self._install_profile.get_network_interfaces()
1777 for iface in interfaces:
1778 if interfaces[iface][0] == 'dhcp':
1779 settings += " " + iface + _(u": Settings: DHCP. Options: ") + interfaces[iface][1] + "\n"
1780 else:
1781 settings += " " + iface + _(u"IP: ") + interfaces[iface][0] + _(u" Broadcast: ") + interfaces[iface][1] + _(u" Netmask: ") + interfaces[iface][2] + "\n"
1782 default_gateway = self._install_profile.get_default_gateway()
1783 if default_gateway:
1784 settings += " Default Gateway: " + default_gateway[0] + "/" + default_gateway[1] + "\n"
1785 settings += " Hostname: " + self._install_profile.get_hostname() + "\n"
1786 if self._install_profile.get_domainname():
1787 settings += " Domainname: " +self._install_profile.get_domainname() + "\n"
1788 if self._install_profile.get_nisdomainname():
1789 settings += " NIS Domainname: " +self._install_profile.get_nisdomainname() + "\n"
1790 if self._install_profile.get_dns_servers():
1791 for dns_server in self._install_profile.get_dns_servers():
1792 settings += " DNS Server: " +dns_server + "\n"
1793 if self._install_profile.get_http_proxy():
1794 settings += " HTTP Proxy: " +self._install_profile.get_http_proxy() + "\n"
1795 if self._install_profile.get_ftp_proxy():
1796 settings += " FTP Proxy: " +self._install_profile.get_ftp_proxy() + "\n"
1797 if self._install_profile.get_rsync_proxy():
1798 settings += " RSYNC Proxy: " +self._install_profile.get_rsync_proxy() + "\n"
1799
1800 #Cron Daemon:
1801 settings += "\nCron Daemon: " + self._install_profile.get_cron_daemon_pkg() + "\n"
1802
1803 #Logger:
1804 settings += "\nLogging Daemon: " + self._install_profile.get_logging_daemon_pkg() + "\n"
1805
1806 #Extra packages:
1807 if self._install_profile.get_install_packages():
1808 install_packages = self._install_profile.get_install_packages()
1809 else:
1810 install_packages = []
1811 settings += "\nExtra Packages: "
1812 for package in install_packages:
1813 settings += package + " "
1814 settings += "\n"
1815 #Services:
1816 if self._install_profile.get_services():
1817 services = self._install_profile.get_services()
1818 else:
1819 services = []
1820 settings += "\nAdditional Services: "
1821 for service in services:
1822 settings += service + " "
1823 settings += "\n"
1824
1825 #Other Configuration Settings (rc.conf):
1826 #Make.conf Settings:
1827 settings += "\nConfiguration Files Settings:\n"
1828 etc_files = self._install_profile.get_etc_files()
1829 for etc_file in etc_files:
1830 settings += " File:" + etc_file + "\n"
1831 if isinstance(etc_files[etc_file], dict):
1832 for name in etc_files[etc_file]:
1833 settings += " Variable: " + name + " Value: " + etc_files[etc_file][name] + "\n"
1834 else:
1835 for entry in etc_files[etc_file]:
1836 settings += " Value: "+ entry + "\n"
1837
1838 #Additional Users:
1839 settings += "\nAdditional Users:\n"
1840 users = {}
1841 for user in self._install_profile.get_users():
1842 users[user[0]] = (user[0], user[1], user[2], user[3], user[4], user[5], user[6])
1843 for user in users:
1844 settings += " Username: " + user
1845 settings += "\n Group Membership: " + string.join(users[user][2], ",")
1846 settings += "\n Shell: " + users[user][3]
1847 settings += "\n Home Directory: " + users[user][4]
1848 if users[user][5]:
1849 settings += "\n User Id: " + users[user][5]
1850 if users[user][6]:
1851 settings += "\n User Comment: " + users[user][6]
1852
1853 self._d.scrollbox(settings, height=20, width=77, title=_(u"A Review of your settings"))

Properties

Name Value
svn:eol-style native

  ViewVC Help
Powered by ViewVC 1.1.20