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

Contents of /trunk/src/GLIGenDialog.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1471 - (show annotations) (download) (as text)
Mon Jul 10 02:54:10 2006 UTC (12 years, 5 months ago) by codeman
File MIME type: text/x-python
File size: 95304 byte(s)
src/GLIGenDialog.py
make lilo only show up for x86 if non-networkless

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 kernel_params = self._install_profile.get_bootloader_kernel_args()
941 if self._install_profile.get_boot_device():
942 boot_device = self._install_profile.get_boot_device()
943 else:
944 boot_device = ""
945 foundboot = False
946 for device in parts:
947 tmp_partitions = parts[device] #.get_install_profile_structure()
948 for partition in tmp_partitions:
949 mountpoint = tmp_partitions[partition]['mountpoint']
950 if (mountpoint == "/boot"):
951 foundboot = True
952 if (( (mountpoint == "/") and (not foundboot) ) or (mountpoint == "/boot")):
953 boot_device = device
954 if not "doscsi" in kernel_params.split():
955 if device.startswith("/dev/sd"): kernel_params += " doscsi"
956 arch_loaders = { 'x86': [
957 ("grub",_(u"GRand Unified Bootloader, newer, RECOMMENDED"))],
958 'amd64': [
959 ("grub",_(u"GRand Unified Bootloader, newer, RECOMMENDED"))]} #FIXME ADD OTHER ARCHS
960 if not self._networkless:
961 arch_loaders['x86'].append(("lilo",_(u"LInux LOader, older, traditional.(detects windows partitions)")))
962 boot_loaders = arch_loaders[arch]
963 boot_loaders.append(("none", _(u"Do not install a bootloader. (System may be unbootable!)")))
964 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")
965 code, menuitem = self._d.menu(boot_string1, choices=boot_loaders, height=16, width=74)
966 if code != self._DLG_OK:
967 return
968 try:
969 self._install_profile.set_boot_loader_pkg(None, menuitem, None)
970 except:
971 self._d.msgbox(_(u"ERROR! Could not set boot loader pkg! ")+menuitem)
972 if menuitem != "none" and self.advanced_mode:
973 #Reset the Yes/No labels.
974 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
975 self._d.add_persistent_args(["--no-label",_(u"No")])
976 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)")
977 if self._d.yesno(boot_string2, height=13, width=55) == self._DLG_YES:
978 self._install_profile.set_boot_loader_mbr(None, True, None)
979 else:
980 self._install_profile.set_boot_loader_mbr(None, False, None)
981 if self._install_profile.get_boot_loader_mbr(): #If we're installing to MBR gotta check the device.
982 if self.advanced_mode or (boot_device[-1] != 'a'):
983 #show the menu.
984 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
985 boot_string3 = _(u" Please confirm your boot device by choosing it from the menu.")
986 if not self.advanced_mode:
987 boot_string3 = boot_string3_std + boot_string3
988 #grab choies from the partiton list.
989 boot_drive_choices = []
990 for device in parts:
991 boot_drive_choices.append(device)
992 if not boot_drive_choices:
993 self._d.msgbox(_(u"ERROR: No drives set up. Please complete the Partitioning screen first!"))
994 return
995 code, boot_drive_choice = self._d.menu(boot_string3, choices=self._dmenu_list_to_choices(boot_drive_choices), height=16, width=70)
996 if code != self._DLG_OK:
997 return
998 boot_drive_choice = boot_drive_choices[int(boot_drive_choice)-1]
999 try:
1000 self._install_profile.set_boot_device(None,boot_drive_choice,None)
1001 except:
1002 self._d.msgbox(_(u"ERROR! Could not set the boot device!")+boot_drive_choice)
1003 if self.advanced_mode:
1004 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, init=kernel_params)
1005 if code == self._DLG_OK:
1006 try:
1007 self._install_profile.set_bootloader_kernel_args(None, bootloader_kernel_args, None)
1008 except:
1009 self._d.msgbox(_(u"ERROR! Could not set bootloader kernel arguments! ")+bootloader_kernel_args)
1010 elif kernel_params: #If we are in standard mode but have the dosci to add.
1011 try:
1012 self._install_profile.set_bootloader_kernel_args(None, kernel_params, None)
1013 except:
1014 self._d.msgbox(_(u"ERROR! Could not set bootloader kernel arguments! ")+bootloader_kernel_args)
1015
1016
1017 def set_timezone(self):
1018 # This section will be for setting the timezone.
1019 zonepath = "/usr/share/zoneinfo"
1020 skiplist = ["zone.tab","iso3166.tab","posixrules"]
1021 while 1:
1022 tzlist = []
1023 for entry in os.listdir(zonepath):
1024 if entry not in skiplist:
1025 if os.path.isdir(zonepath + "/" + entry): entry += "/"
1026 tzlist.append(entry)
1027 tzlist.sort()
1028 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.")
1029 code, tznum = self._d.menu(timezone_string, choices=self._dmenu_list_to_choices(tzlist), height=20, cancel="Back")
1030 if code == self._DLG_OK:
1031 zonepath = os.path.join(zonepath,tzlist[int(tznum)-1])
1032 if tzlist[int(tznum)-1][-1:] != "/":
1033 break
1034 else:
1035 if zonepath == "/usr/share/zoneinfo":
1036 return
1037 slashloc = zonepath[:-1].rfind("/")
1038 zonepath = zonepath[:slashloc]
1039 try:
1040 self._install_profile.set_time_zone(None, zonepath[20:], None)
1041 except:
1042 self._d.msgbox(_(u"ERROR: Could not set that timezone!"))
1043
1044 def set_networking(self):
1045 # This section will be for setting up network interfaces
1046 interfaces = self._install_profile.get_network_interfaces()
1047 CC_iface = self._client_profile.get_network_interface()
1048 if CC_iface and (CC_iface not in interfaces):
1049 #The CC has a network config that's not already there. Preload it.
1050 CC_net_type = self._client_profile.get_network_type()
1051 if CC_net_type == 'dhcp':
1052 try:
1053 interfaces[CC_iface] = ('dhcp', self._client_profile.get_network_dhcp_options(), None)
1054 except:
1055 pass
1056 else:
1057 try:
1058 interfaces[CC_iface] = (self._client_profile.get_network_ip(), self._client_profile.get_network_broadcast(), self._client_profile.get_network_netmask())
1059 except:
1060 pass
1061
1062 while 1:
1063 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.")
1064 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:")
1065 choice_list = []
1066 for iface in interfaces:
1067 if interfaces[iface][0] == 'dhcp':
1068 choice_list.append((iface, _(u"Settings: DHCP. Options: ")+ interfaces[iface][1]))
1069 else:
1070 choice_list.append((iface, _(u"IP: ")+interfaces[iface][0]+_(u" Broadcast: ")+interfaces[iface][1]+_(u" Netmask: ")+interfaces[iface][2]))
1071 choice_list.append(("Add",_(u"Add a new network interface")))
1072 code, iface_choice = self._d.menu(net_string1, choices=choice_list, cancel=_(u"Save and Continue"), height=18, width=77)
1073 if code != self._DLG_OK:
1074 try:
1075 self._install_profile.set_network_interfaces(interfaces)
1076 except:
1077 self_d.msgbox(_(u"ERROR! Could not set the network interfaces!"))
1078 break #This should hopefully move the user down to part two of set_networking
1079 if iface_choice == "Add":
1080 if self.local_install:
1081 device_list = GLIUtility.get_eth_devices()
1082 newchoice_list = []
1083 for device in device_list:
1084 if device not in interfaces:
1085 newchoice_list.append((device, GLIUtility.get_interface_realname(device)))
1086 newchoice_list.append((_(u"Other"),_(u"Type your own.")))
1087 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)
1088 else:
1089 newnic == _(u"Other")
1090 if newnic == _(u"Other"):
1091 code, newnic = self._d.inputbox(_(u"Enter name for new interface (eth0, ppp0, etc.)"))
1092 if code != self._DLG_OK:
1093 continue
1094 if newnic in interfaces:
1095 self._d.msgbox(_(u"An interface with the name is already defined."))
1096 continue
1097 #create the interface in the data structure.
1098 #interfaces[newnic] = ("", "", "")
1099 #Change the Yes/No buttons to new labels for this question.
1100 self._d.add_persistent_args(["--yes-label", _(u"DHCP")])
1101 self._d.add_persistent_args(["--no-label", _(u"Static IP/Manual")])
1102 if self._d.yesno(net_string2, height=15, width=60) == self._DLG_YES: #DHCP
1103 dhcp_options = ""
1104 if self.advanced_mode:
1105 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)
1106 interfaces[newnic] = ('dhcp', dhcp_options, None)
1107 else:
1108 network_type = 'static'
1109 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!'),
1110 ((_(u'Enter your IP address:'), 15),
1111 (_(u'Enter your Broadcast address:'), 15),
1112 (_(u'Enter your Netmask:'),15,'255.255.255.0')))
1113 (ip_address, broadcast, netmask) = data[:-1].split('\n')
1114 if code != self._DLG_OK:
1115 continue
1116 #Set the info now that it's all gathered.
1117 interfaces[newnic] = (ip_address, broadcast, netmask)
1118 else: #they have chosen an interface, present them with edit/delete
1119 #Change the Yes/No buttons to new labels for this question.
1120 self._d.add_persistent_args(["--yes-label", _(u"Edit")])
1121 self._d.add_persistent_args(["--no-label", _(u"Delete")])
1122 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:
1123 #Edit
1124 #Change the Yes/No buttons to new labels for this question.
1125 self._d.add_persistent_args(["--yes-label", _(u"DHCP")])
1126 self._d.add_persistent_args(["--no-label", _(u"Static IP/Manual")])
1127 if self._d.yesno(net_string2, height=15, width=60) == self._DLG_YES: #DHCP
1128 dhcp_options = ""
1129 if self.advanced_mode:
1130 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)
1131 interfaces[iface_choice] = ('dhcp', dhcp_options, None)
1132 else:
1133 network_type = 'static'
1134 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!'),
1135 ((_(u'Enter your IP address:'), 15, interfaces[iface_choice][0]),
1136 (_(u'Enter your Broadcast address:'), 15, interfaces[iface_choice][1]),
1137 (_(u'Enter your Netmask:'),15,interfaces[iface_choice][2])))
1138 (ip_address, broadcast, netmask) = data[:-1].split('\n')
1139 if code != self._DLG_OK:
1140 continue
1141 #Set the info now that it's all gathered.
1142 interfaces[iface_choice] = (ip_address, broadcast, netmask)
1143 else:
1144 #Delete
1145 #Reset the Yes/No buttons
1146 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
1147 self._d.add_persistent_args(["--no-label", _(u"No")])
1148 if self._d.yesno(_(u"Are you sure you want to remove the interface ") + iface_choice + "?") == self._DLG_YES:
1149 del interfaces[iface_choice]
1150
1151 #This section is for defining DNS servers, default routes/gateways, hostname, etc.
1152 #First ask for the default gateway device and IP
1153 interfaces = self._install_profile.get_network_interfaces()
1154 choice_list = []
1155 for iface in interfaces:
1156 if interfaces[iface][0] == 'dhcp':
1157 choice_list.append((iface, _(u"Settings: DHCP. Options: ")+ interfaces[iface][1],0))
1158 else:
1159 choice_list.append((iface, _(u"IP: ")+interfaces[iface][0]+_(u" Broadcast: ")+interfaces[iface][1]+_(u" Netmask: ")+interfaces[iface][2],0))
1160 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:")
1161 if choice_list:
1162 code, gateway_iface = self._d.radiolist(net_string3, choices=choice_list, height=20, width=67)
1163 if (code == self._DLG_OK) and gateway_iface: #They made a choice. Ask the IP if not DHCP.
1164 while interfaces[gateway_iface][0] != 'dhcp':
1165 code, ip = self._d.inputbox(_(u"Enter the gateway IP address for ") + gateway_iface, init=interfaces[gateway_iface][0])
1166 if code != self._DLG_OK:
1167 break
1168 if not GLIUtility.is_ip(ip):
1169 self._d.msgbox(_(u"Invalid IP Entered! Please try again."))
1170 continue
1171 try:
1172 self._install_profile.set_default_gateway(None, ip,{'interface': gateway_iface})
1173 except:
1174 self._d.msgbox(_(u"ERROR! Coult not set the default gateway with IP %s for interface %s") % (ip, gateway_iface))
1175 break
1176 #Now ask for the other info in a large form.
1177 error = True
1178 hostname = ""
1179 domainname = ""
1180 nisdomainname = ""
1181 primary_dns = ""
1182 backup_dns = ""
1183 http_proxy = ""
1184 ftp_proxy = ""
1185 rsync_proxy = ""
1186 while error:
1187 error = False
1188 if self.advanced_mode:
1189 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!'),
1190 ((_(u'Enter your Hostname:'), 25, self._install_profile.get_hostname()),
1191 (_(u'Enter your Domain Name:'), 25, self._install_profile.get_domainname()),
1192 (_(u'Enter your NIS Domain Name:'),25,self._install_profile.get_nisdomainname()),
1193 (_(u'Enter a primary DNS server:'),15),
1194 (_(u'Enter a backup DNS server:'),15),
1195 (_(u'Enter a HTTP Proxy IP:'), 15,self._install_profile.get_http_proxy()),
1196 (_(u'Enter a FTP Proxy IP:'), 15, self._install_profile.get_ftp_proxy()),
1197 (_(u'Enter a RSYNC Proxy:'),15,self._install_profile.get_rsync_proxy())))
1198 if code != self._DLG_OK:
1199 return
1200 (hostname, domainname, nisdomainname, primary_dns, backup_dns, http_proxy, ftp_proxy, rsync_proxy) = data[:-1].split('\n')
1201 else: #standard mode
1202 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!'),
1203 ((_(u'Enter your Hostname:'), 25, self._install_profile.get_hostname()),
1204 (_(u'Enter your Domain Name:'), 25, self._install_profile.get_domainname()),
1205 (_(u'Enter a primary DNS server:'),15),
1206 (_(u'Enter a backup DNS server:'),15)))
1207 if code != self._DLG_OK:
1208 return
1209 (hostname, domainname, primary_dns, backup_dns) = data[:-1].split('\n')
1210 #Check the data before entering it.
1211 if hostname:
1212 if type(hostname) != str:
1213 self._d.msgbox(_(u"Incorrect hostname! It must be a string. Not saved."))
1214 error = True
1215 else:
1216 try:
1217 self._install_profile.set_hostname(None, hostname, None)
1218 except:
1219 self._d.msgbox(_(u"ERROR! Could not set the hostname:")+hostname)
1220 error = True
1221 if domainname:
1222 if type(domainname) != str:
1223 self._d.msgbox(_(u"Incorrect domainname! It must be a string. Not saved."))
1224 error = True
1225 else:
1226 try:
1227 self._install_profile.set_domainname(None, domainname, None)
1228 except:
1229 self._d.msgbox(_(u"ERROR! Could not set the domainname:")+domainname)
1230 error = True
1231 if nisdomainname:
1232 if type(nisdomainname) != str:
1233 self._d.msgbox(_(u"Incorrect nisdomainname! It must be a string. Not saved."))
1234 error = True
1235 else:
1236 try:
1237 self._install_profile.set_nisdomainname(None, nisdomainname, None)
1238 except:
1239 self._d.msgbox(_(u"ERROR! Could not set the nisdomainname:")+nisdomainname)
1240 error = True
1241 if primary_dns:
1242 if not GLIUtility.is_ip(primary_dns):
1243 self._d.msgbox(_(u"Incorrect Primary DNS Server! Not saved."))
1244 error = True
1245 else:
1246 if backup_dns:
1247 if not GLIUtility.is_ip(backup_dns):
1248 self._d.msgbox(_(u"Incorrect Backup DNS Server! Not saved."))
1249 error = True
1250 else:
1251 primary_dns = primary_dns + " " + backup_dns
1252 try:
1253 self._install_profile.set_dns_servers(None, primary_dns, None)
1254 except:
1255 self._d.msgbox(_(u"ERROR! Could not set the DNS Servers:")+primary_dns)
1256 error = True
1257 if http_proxy:
1258 if not GLIUtility.is_uri(http_proxy):
1259 self._d.msgbox(_(u"Incorrect HTTP Proxy! It must be a uri. Not saved."))
1260 error = True
1261 else:
1262 try:
1263 self._install_profile.set_http_proxy(None, http_proxy, None)
1264 except:
1265 self._d.msgbox(_(u"ERROR! Could not set the HTTP Proxy:")+http_proxy)
1266 error = True
1267 if ftp_proxy:
1268 if not GLIUtility.is_uri(ftp_proxy):
1269 self._d.msgbox(_(u"Incorrect FTP Proxy! It must be a uri. Not saved."))
1270 error = True
1271 else:
1272 try:
1273 self._install_profile.set_ftp_proxy(None, ftp_proxy, None)
1274 except:
1275 self._d.msgbox(_(u"ERROR! Could not set the FTP Proxy:")+ftp_proxy)
1276 error = True
1277 if rsync_proxy:
1278 if not GLIUtility.is_uri(rsync_proxy):
1279 self._d.msgbox(_(u"Incorrect RSYNC Proxy! It must be a uri. Not saved."))
1280 error = True
1281 else:
1282 try:
1283 self._install_profile.set_rsync_proxy(None, rsync_proxy, None)
1284 except:
1285 self._d.msgbox(_(u"ERROR! Could not set the RSYNC Proxy:")+rsync_proxy)
1286 error = True
1287
1288
1289 def set_cron_daemon(self):
1290 if self._networkless: return
1291 cron_daemons = (("vixie-cron", _(u"Paul Vixie's cron daemon, fully featured, RECOMMENDED.")),
1292 ("dcron",_(u"A cute little cron from Matt Dillon.")),
1293 ("fcron", _(u"A scheduler with extended capabilities over cron & anacron")),
1294 ("None", _(u"Don't use a cron daemon. (NOT Recommended!)")))
1295 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:")
1296 code, menuitem = self._d.menu(cron_string, choices=cron_daemons, height=21, width=77)
1297 if code == self._DLG_OK:
1298 if menuitem == "None":
1299 menuitem = ""
1300 self._install_profile.set_cron_daemon_pkg(None, menuitem, None)
1301
1302 def set_logger(self):
1303 if self._networkless: return
1304 loggers = (("syslog-ng", _(u"An advanced system logger.")),
1305 ("metalog", _(u"A Highly-configurable system logger.")),
1306 ("syslogkd", _(u"The traditional set of system logging daemons.")))
1307 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:")
1308 code, menuitem = self._d.menu(logger_string, choices=loggers, height=21, width=68)
1309 if code == self._DLG_OK:
1310 self._install_profile.set_logging_daemon_pkg(None, menuitem, None)
1311
1312 def set_extra_packages(self):
1313 #d.msgbox("This section is for selecting extra packages (pcmcia-cs, rp-pppoe, xorg-x11, etc.) and setting them up")
1314 if self._install_profile.get_install_packages():
1315 install_packages = self._install_profile.get_install_packages()
1316 if isinstance(install_packages, str):
1317 install_packages = install_packages.split()
1318 else:
1319 install_packages = []
1320 package_list = self._install_profile.get_install_package_list()
1321 highlevel_menu = []
1322 for group in package_list:
1323 highlevel_menu.append( (group, package_list[group][0]) )
1324 highlevel_menu.append( ("Manual", "Type your own space-separated list of packages.") )
1325
1326 while 1:
1327 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'.")
1328 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)
1329 if code != self._DLG_OK: #Save and move on.
1330 try:
1331 packages = string.join(install_packages, ' ')
1332 if packages:
1333 self._install_profile.set_install_packages(None, packages, None)
1334 except:
1335 self._d.msgbox(_(u"ERROR! Could not set the install packages! List of packages:"))
1336 return
1337 #Popular Desktop Applications
1338 choices_list = []
1339 #pkgs = {}
1340
1341 #Special case first.
1342 if submenu == "Manual":
1343 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)
1344 if code == self._DLG_OK:
1345 install_packages = tmp_install_packages.split()
1346 continue
1347
1348 #All other cases load pkgs and GRP
1349 pkgs = package_list[submenu][1]
1350 grp_list = GLIUtility.get_grp_pkgs_from_cd()
1351 for pkg in pkgs:
1352 if pkg in grp_list:
1353 choices_list.append((pkg, "(GRP) "+pkgs[pkg], int(pkg in install_packages)))
1354 else:
1355 if not self._networkless:
1356 choices_list.append((pkg, pkgs[pkg], int(pkg in install_packages)))
1357 if not choices_list: continue
1358 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)
1359 if code != self._DLG_OK:
1360 continue
1361 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.
1362 for i, tmppkg in enumerate(install_packages):
1363 if tmppkg == pkg:
1364 del install_packages[i]
1365
1366 for package in choices:
1367 install_packages.append(package)
1368 #special cases for desktop environments
1369 if package in ["xorg-x11", "gnome","kde","blackbox","enlightenment","fluxbox","xfce4"]: #ask about X
1370 #Reset the Yes/No buttons
1371 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
1372 self._d.add_persistent_args(["--no-label", _(u"No")])
1373 if not self.advanced_mode or self._d.yesno(_(u"Do you want to start X on bootup?")) == self._DLG_YES:
1374 services = self._install_profile.get_services() or 'xdm'
1375 if isinstance(services, list):
1376 services = string.join(services, ',')
1377 if 'xdm' not in services:
1378 services += ',xdm'
1379 try:
1380 self._install_profile.set_services(None, services, None)
1381 except:
1382 self._d.msgbox(_(u"ERROR! Could not set the services list."))
1383 #rc.conf changes specific to packages.
1384 if package == "gnome":
1385 etc_files = self._install_profile.get_etc_files()
1386 if not "rc.conf" in etc_files:
1387 etc_files['rc.conf'] = {}
1388 etc_files['rc.conf']['DISPLAYMANAGER'] = "gdm"
1389 self._install_profile.set_etc_files(etc_files)
1390 if package == "kde":
1391 etc_files = self._install_profile.get_etc_files()
1392 if not "rc.conf" in etc_files:
1393 etc_files['rc.conf'] = {}
1394 etc_files['rc.conf']['DISPLAYMANAGER'] = "kdm"
1395 self._install_profile.set_etc_files(etc_files)
1396 if package == "enlightenment":
1397 etc_files = self._install_profile.get_etc_files()
1398 if not "rc.conf" in etc_files:
1399 etc_files['rc.conf'] = {}
1400 etc_files['rc.conf']['DISPLAYMANAGER'] = "entrance"
1401 self._install_profile.set_etc_files(etc_files)
1402 if package == "fluxbox":
1403 etc_files = self._install_profile.get_etc_files()
1404 if not "rc.conf" in etc_files:
1405 etc_files['rc.conf'] = {}
1406 etc_files['rc.conf']['XSESSION'] = "fluxbox"
1407 self._install_profile.set_etc_files(etc_files)
1408
1409
1410
1411 def set_services(self):
1412 if self._install_profile.get_services():
1413 services = self._install_profile.get_services()
1414 if isinstance(services, str):
1415 services = services.split(',')
1416 else:
1417 services = []
1418 choice_list = [("alsasound", _(u"ALSA Sound Daemon"),int("alsasound" in services)),
1419 ("apache", _(u"Common web server (version 1.x)"),int("apache" in services)),
1420 ("apache2", _(u"Common web server (version 2.x)"),int("apache2" in services)),
1421 ("distccd", _(u"Distributed Compiling System"),int("distccd" in services)),
1422 ("esound", _(u"ESD Sound Daemon"),int("esound" in services)),
1423 ("hdparm", _(u"Hard Drive Tweaking Utility"),int("hdparm" in services)),
1424 ("local", _(u"Run scripts found in /etc/conf.d/local.start"),int("local" in services)),
1425 ("portmap", _(u"Port Mapping Service"),int("portmap" in services)),
1426 ("proftpd", _(u"Common FTP server"),int("proftpd" in services)),
1427 ("sshd", _(u"SSH Daemon (allows remote logins)"),int("sshd" in services)),
1428 ("xfs", _(u"X Font Server"),int("xfs" in services)),
1429 ("xdm", _(u"X Daemon"),int("xdm" in services)),
1430 (_(u"Other"),_(u"Manually specify your services in a comma-separated list."),0)]
1431 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.")
1432 code, services_list = self._d.checklist(services_string, choices=choice_list, height=21, list_height=12, width=77)
1433 if code != self._DLG_OK:
1434 return
1435 services = []
1436 for service in services_list:
1437 services.append(service)
1438 if _(u"Other") in services_list:
1439 code, services = self._d.inputbox(_(u"Enter a comma-separated list of services to start on boot"), init=string.join(services, ','))
1440 if code != self._DLG_OK:
1441 return
1442 try:
1443 services = string.join(services, ',')
1444 if services:
1445 self._install_profile.set_services(None, services, None)
1446 except:
1447 self._d.msgbox(_(u"ERROR! Could not set the services list."))
1448 return
1449
1450 def set_rc_conf(self):
1451 # This section is for editing /etc/rc.conf
1452 if not self.advanced_mode:
1453 return
1454 etc_files = self._install_profile.get_etc_files()
1455 keymap = ""
1456 windowkeys = ""
1457 ext_keymap = ""
1458 font = ""
1459 trans = ""
1460 clock = ""
1461 editor = ""
1462 disp_manager = ""
1463 xsession = ""
1464 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!")
1465 menulist = [("KEYMAP",_(u"Use KEYMAP to specify the default console keymap.")),
1466 ("SET_WINDOWSKEYS", _(u"Decision to first load the 'windowkeys' console keymap")),
1467 ("EXTENDED_KEYMAPS", _(u"maps to load for extended keyboards. Most users will leave this as is.")),
1468 ("CONSOLEFONT", _(u"Specifies the default font that you'd like Linux to use on the console.")),
1469 ("CONSOLETRANSLATION", _(u"The charset map file to use.")),
1470 ("CLOCK", _(u"Set the clock to either UTC or local")),
1471 ("EDITOR", _(u"Set EDITOR to your preferred editor.")),
1472 ("DISPLAYMANAGER", _(u"What display manager do you use ? [ xdm | gdm | kdm | entrance ]")),
1473 ("XSESSION", _(u"a new variable to control what window manager to start default with X"))]
1474 while 1:
1475 code, variable = self._d.menu(rc_string1, choices=menulist, cancel=_(u"Save and Continue"), width=77, height=19)
1476 if code != self._DLG_OK:
1477 break
1478 if variable == "KEYMAP":
1479 keymap_list = GLIUtility.generate_keymap_list()
1480 code, keymap = self._d.menu(_(u"Choose your desired keymap:"), choices=self._dmenu_list_to_choices(keymap_list), height=19)
1481 if code != self._DLG_OK:
1482 continue
1483 keymap = keymap_list[int(keymap)-1]
1484
1485 elif variable == "SET_WINDOWSKEYS":
1486 #Reset the Yes/No buttons
1487 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
1488 self._d.add_persistent_args(["--no-label", _(u"No")])
1489 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:
1490 windowkeys = "yes"
1491 else:
1492 windowkeys = "no"
1493 elif variable == "EXTENDED_KEYMAPS":
1494 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)
1495 elif variable == "CONSOLEFONT":
1496 font_list = GLIUtility.generate_consolefont_list()
1497 code, font = self._d.menu(_(u"Choose your desired console font:"), choices=self._dmenu_list_to_choices(font_list), height=19)
1498 if code != self._DLG_OK:
1499 continue
1500 font = font_list[int(font)-1]
1501 elif variable == "CONSOLETRANSLATION":
1502 trans_list = GLIUtility.generate_consoletranslation_list()
1503 code, trans = self._d.menu(_(u"Choose your desired console translation:"), choices=self._dmenu_list_to_choices(trans_list), height=19)
1504 if code != self._DLG_OK:
1505 continue
1506 trans = trans_list[int(trans)-1]
1507 elif variable == "CLOCK":
1508 #Change the Yes/No buttons to new labels for this question.
1509 self._d.add_persistent_args(["--yes-label", "UTC"])
1510 self._d.add_persistent_args(["--no-label", "local"])
1511 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:
1512 clock = "UTC"
1513 else:
1514 clock = "local"
1515 elif variable == "EDITOR":
1516 choice_list = [("/bin/nano", _(u"Default editor.")), ("/usr/bin/vim", _(u"vi improved editor.")), ("/usr/bin/emacs", _(u"The emacs editor."))]
1517 code, editor = self._d.menu(_(u"Choose your default editor: "), choices=choice_list)
1518 elif variable == "DISPLAYMANAGER":
1519 choice_list = [("xdm", _(u"X Display Manager")),
1520 ("gdm", _(u"Gnome Display Manager")),
1521 ("kdm", _(u"KDE Display Manager")),
1522 ("entrance", _(u"Login Manager for Enlightenment"))]
1523 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)
1524 elif variable == "XSESSION":
1525 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)
1526
1527 if not "conf.d/keymaps" in etc_files:
1528 if keymap or windowkeys or ext_keymap:
1529 etc_files['conf.d/keymaps'] = {}
1530 if not "conf.d/consolefont" in etc_files:
1531 if font or trans:
1532 etc_files['conf.d/consolefont'] = {}
1533 if not "conf.d/clock" in etc_files:
1534 if clock:
1535 etc_files['conf.d/clock'] = {}
1536 if not "rc.conf" in etc_files:
1537 if editor or disp_manager or xsession:
1538 etc_files['rc.conf'] = {}
1539 if keymap:
1540 etc_files['conf.d/keymaps']['KEYMAP'] = keymap
1541 if windowkeys:
1542 etc_files['conf.d/keymaps']['SET_WINDOWSKEYS'] = windowkeys
1543 if ext_keymap:
1544 etc_files['conf.d/keymaps']['EXTENDED_KEYMAPS'] = ext_keymap
1545 if font:
1546 etc_files['conf.d/consolefont']['CONSOLEFONT'] = font
1547 if trans:
1548 etc_files['conf.d/consolefont']['CONSOLETRANSLATION'] = trans
1549 if clock:
1550 etc_files['conf.d/clock']['CLOCK'] = clock
1551 if editor:
1552 etc_files['rc.conf']['EDITOR'] = editor
1553 if disp_manager:
1554 etc_files['rc.conf']['DISPLAYMANAGER'] = disp_manager
1555 if xsession:
1556 etc_files['rc.conf']['XSESSION'] = xsession
1557 self._install_profile.set_etc_files(etc_files)
1558
1559 def set_root_password(self):
1560 # The root password will be set here
1561 while 1:
1562 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.):"))
1563 if code != self._DLG_OK:
1564 return
1565 code, passwd2 = self._d.passwordbox(_(u"Enter the new root password again for confirmation"))
1566 if code != self._DLG_OK:
1567 return
1568 if passwd1 != passwd2:
1569 self._d.msgbox(_(u"The passwords do not match. Please try again or cancel."))
1570 else:
1571 try:
1572 self._install_profile.set_root_pass_hash(None, GLIUtility.hash_password(passwd1), None)
1573 except:
1574 self._d.msgbox(_(u"ERROR! Could not set the new system root password!"))
1575 self._d.msgbox(_(u"Password saved. Press Enter to continue."))
1576 return
1577
1578 def set_additional_users(self):
1579 # This section will be for adding non-root users
1580 users = {}
1581 for user in self._install_profile.get_users():
1582 users[user[0]] = (user[0], user[1], user[2], user[3], user[4], user[5], user[6])
1583 while 1:
1584 menu_list = []
1585 for user in users:
1586 menu_list.append(user)
1587 menu_list.sort()
1588 menu_list.append(_(u"Add user"))
1589 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:")
1590 code, menuitem = self._d.menu(users_string1, choices=self._dmenu_list_to_choices(menu_list), cancel="Save and Continue", height=19)
1591 if code != self._DLG_OK:
1592 #if self._d.yesno("Do you want to save changes?") == self._DLG_YES:
1593 tmpusers = []
1594 for user in users:
1595 tmpusers.append(users[user])
1596 try:
1597 self._install_profile.set_users(tmpusers)
1598 except:
1599 self._d.msgbox(_(u"ERROR! Could not set the additional users!"))
1600 break
1601 menuitem = menu_list[int(menuitem)-1]
1602 if menuitem == _(u"Add user"):
1603 code, newuser = self._d.inputbox(_(u"Enter the username for the new user"))
1604 if code != self._DLG_OK:
1605 continue
1606 if newuser in users:
1607 self._d.msgbox(_(u"A user with that name already exists"))
1608 continue
1609 code, passwd1 = self._d.passwordbox(_(u"Enter the new password for user ")+ newuser)
1610 code, passwd2 = self._d.passwordbox(_(u"Enter the new password again for confirmation"))
1611 if code == self._DLG_OK:
1612 if passwd1 != passwd2:
1613 self._d.msgbox(_(u"The passwords do not match! Go to the menu and try again."))
1614 #Create the entry for the new user
1615 new_user = [newuser, GLIUtility.hash_password(passwd1), ('users',), '/bin/bash', '/home/' + newuser, '', '']
1616 users[newuser] = new_user
1617 menuitem = newuser
1618 while 1:
1619 menulist = [_(u"Password"), _(u"Group Membership"), _(u"Shell"), _(u"Home Directory"), _(u"UID"), _(u"Comment"), _(u"Delete")]
1620 code, menuitem2 = self._d.menu(_(u"Choose an option for user ") + menuitem, choices=self._dmenu_list_to_choices(menulist), cancel=_(u"Back"))
1621 if code != self._DLG_OK:
1622 break
1623 menuitem2 = menulist[int(menuitem2)-1]
1624 if menuitem2 == _(u"Password"):
1625 code, passwd1 = self._d.passwordbox(_(u"Enter the new password"))
1626 if code != self._DLG_OK:
1627 continue
1628 code, passwd2 = self._d.passwordbox(_(u"Enter the new password again"))
1629 if code != self._DLG_OK:
1630 continue
1631 if passwd1 != passwd2:
1632 self._d.msgbox(_(u"The passwords do not match! Try again."))
1633 continue
1634 self._d.msgbox(_(u"Password saved. Press Enter to continue."))
1635 users[menuitem][1] = GLIUtility.hash_password(passwd1)
1636 elif menuitem2 == _(u"Group Membership"):
1637 prechk = users[menuitem][2]
1638 choice_list = [("users", _(u"The usual group for normal users."), int("users" in prechk)),
1639 ("wheel", _(u"Allows users to attempt to su to root."), int("wheel" in prechk)),
1640 ("audio", _(u"Allows access to audio devices."), int("audio" in prechk)),
1641 ("games", _(u"Allows access to games."), int("games" in prechk)),
1642 ("apache", _(u"For users who know what they're doing only."), int("apache" in prechk)),
1643 ("cdrom", _(u"For users who know what they're doing only."), int("cdrom" in prechk)),
1644 ("ftp", _(u"For users who know what they're doing only."), int("ftp" in prechk)),
1645 ("video", _(u"For users who know what they're doing only."), int("video" in prechk)),
1646 (_(u"Other"), _(u"Manually specify your groups in a comma-separated list."), 0)]
1647 users_string2 = _(u"Select which groups you would like the user %s to be in." % menuitem)
1648 code, group_list = self._d.checklist(users_string2, choices=choice_list, height=19, list_height=10, width=77)
1649 if code != self._DLG_OK:
1650 break
1651 groups = ""
1652 for group in group_list:
1653 groups += group + ","
1654 if groups:
1655 groups = groups[:-1]
1656 if _(u"Other") in group_list:
1657 code, groups = self._d.inputbox(_(u"Enter a comma-separated list of groups the user is to be in"), init=",".join(users[menuitem][2]))
1658 if code != self._DLG_OK: continue
1659 users[menuitem][2] = string.split(groups, ",")
1660 elif menuitem2 == _(u"Shell"):
1661 code, shell = self._d.inputbox(_(u"Enter the shell you want the user to use. default is /bin/bash. "), init=users[menuitem][3])
1662 if code != self._DLG_OK:
1663 continue
1664 users[menuitem][3] = shell
1665 elif menuitem2 == _(u"Home Directory"):
1666 code, homedir = self._d.inputbox(_(u"Enter the user's home directory. default is /home/username. "), init=users[menuitem][4])
1667 if code != self._DLG_OK:
1668 continue
1669 users[menuitem][4] = homedir
1670 elif menuitem2 == _(u"UID"):
1671 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)
1672 if code != self._DLG_OK:
1673 continue
1674 if type(uid) != int:
1675 continue
1676 users[menuitem][5] = uid
1677 elif menuitem2 == _(u"Comment"):
1678 code, comment = self._d.inputbox(_(u"Enter the user's comment. This is completely optional."), init=users[menuitem][6])
1679 if code != self._DLG_OK:
1680 continue
1681 users[menuitem][6] = comment
1682 elif menuitem2 == _(u"Delete"):
1683 #Reset the Yes/No buttons
1684 self._d.add_persistent_args(["--yes-label", _(u"Yes")])
1685 self._d.add_persistent_args(["--no-label", _(u"No")])
1686 if self._d.yesno(_(u"Are you sure you want to delete the user ") + menuitem + "?") == self._DLG_YES:
1687 del users[menuitem]
1688 break
1689
1690
1691 def save_install_profile(self, xmlfilename="", askforfilename=True):
1692 code = 0
1693 filename = xmlfilename
1694 if askforfilename:
1695 code, filename = self._d.inputbox(_(u"Enter a filename for the XML file. Use full path!"), init=xmlfilename)
1696 if code != self._DLG_OK or not filename:
1697 return None
1698 if GLIUtility.is_file(filename):
1699 if not self._d.yesno(_(u"The file %s already exists. Do you want to overwrite it?") % filename) == self._DLG_YES:
1700 return None
1701 try:
1702 configuration = open(filename ,"w")
1703 configuration.write(self._install_profile.serialize())
1704 configuration.close()
1705 except:
1706 self._d.msgbox(_(u"Error. File couldn't be saved. It will be saved automatically to /tmp before the install."))
1707 return filename
1708 def show_settings(self):
1709 settings = _(u"Look carefully at the following settings to check for mistakes.\nThese are the installation settings you have chosen:\n\n")
1710 #Partitioning
1711 settings += "Partitioning: \n Key: Minor, Pri/Ext, Filesystem, MkfsOpts, Mountpoint, MountOpts, Size.\n"
1712 devices = self._install_profile.get_partition_tables()
1713 drives = devices.keys()
1714 drives.sort()
1715 for drive in drives:
1716 settings += " Drive: " + drive + devices[drive].get_model() + "\n"
1717 partlist = devices[drive].get_ordered_partition_list()
1718 tmpparts = devices[drive] #.get_partitions()
1719 for part in partlist:
1720 tmppart = tmpparts[part]
1721 entry = " "
1722 if tmppart.get_type() == "free":
1723 #partschoice = "New"
1724 entry += _(u" - Unallocated space (")
1725 if tmppart.is_logical():
1726 entry += _(u"logical, ")
1727 entry += str(tmppart.get_mb()) + "MB)"
1728 elif tmppart.get_type() == "extended":
1729 entry += str(int(tmppart.get_minor()))
1730 entry += _(u" - Extended Partition (") + str(tmppart.get_mb()) + "MB)"
1731 else:
1732 entry += str(int(tmppart.get_minor())) + " - "
1733 if tmppart.is_logical():
1734 entry += _(u"Logical (")
1735 else:
1736 entry += _(u"Primary (")
1737 entry += tmppart.get_type() + ", "
1738 entry += (tmppart.get_mkfsopts() or "none") + ", "
1739 entry += (tmppart.get_mountpoint() or "none") + ", "
1740 entry += (tmppart.get_mountopts() or "none") + ", "
1741 entry += str(tmppart.get_mb()) + "MB)"
1742 settings += entry + "\n"
1743
1744 #Network Mounts:
1745 network_mounts = copy.deepcopy(self._install_profile.get_network_mounts())
1746 settings += "\nNetwork Mounts: \n"
1747 for mount in network_mounts:
1748 settings += " "+mount['host']+":"+mount['export']+"\n"
1749
1750 #Install Stage:
1751 settings += "\nInstall Stage: " + str(self._install_profile.get_install_stage()) + "\n"
1752 if self._install_profile.get_dynamic_stage3():
1753 settings += " Tarball will be generated on the fly from the CD.\n"
1754 else:
1755 settings += " Tarball URI: " + self._install_profile.get_stage_tarball_uri() + "\n"
1756
1757 #Portage Tree Sync Type:
1758 settings += "\nPortage Tree Sync Type: " + self._install_profile.get_portage_tree_sync_type() + "\n"
1759 if self._install_profile.get_portage_tree_sync_type() == "snapshot":
1760 settings += " Portage snapshot URI: " + self._install_profile.get_portage_tree_snapshot_uri() + "\n"
1761
1762 #Kernel Settings:
1763 settings += "\nKernel Settings:\n"
1764 settings += " Kernel Sources: " + self._install_profile.get_kernel_source_pkg() + "\n"
1765 if self._install_profile.get_kernel_source_pkg() != "livecd-kernel":
1766 settings += " Kernel Build Method: " + self._install_profile.get_kernel_build_method() + "\n"
1767 if self._install_profile.get_kernel_build_method() == "genkernel":
1768 settings += " Kernel Bootsplash Option: " + str(self._install_profile.get_kernel_bootsplash()) + "\n"
1769 if self._install_profile.get_kernel_config_uri():
1770 settings += " Kernel Configuration URI: " + self._install_profile.get_kernel_config_uri() + "\n"
1771
1772 #Bootloader Settings:
1773 settings += "\nBootloader Settings:\n"
1774 settings += " Bootloader package: " + self._install_profile.get_boot_loader_pkg() + "\n"
1775 if self._install_profile.get_boot_loader_pkg() != "none":
1776 settings += " Install bootloader to MBR: " + str(self._install_profile.get_boot_loader_mbr()) + "\n"
1777 settings += " Bootloader kernel arguments: " +self._install_profile.get_bootloader_kernel_args() + "\n"
1778
1779 #Timezone:
1780 settings += "\nTimezone: " + self._install_profile.get_time_zone() + "\n"
1781
1782 #Networking Settings:
1783 settings += "\nNetworking Settings: \n"
1784 interfaces = self._install_profile.get_network_interfaces()
1785 for iface in interfaces:
1786 if interfaces[iface][0] == 'dhcp':
1787 settings += " " + iface + _(u": Settings: DHCP. Options: ") + interfaces[iface][1] + "\n"
1788 else:
1789 settings += " " + iface + _(u"IP: ") + interfaces[iface][0] + _(u" Broadcast: ") + interfaces[iface][1] + _(u" Netmask: ") + interfaces[iface][2] + "\n"
1790 default_gateway = self._install_profile.get_default_gateway()
1791 if default_gateway:
1792 settings += " Default Gateway: " + default_gateway[0] + "/" + default_gateway[1] + "\n"
1793 settings += " Hostname: " + self._install_profile.get_hostname() + "\n"
1794 if self._install_profile.get_domainname():
1795 settings += " Domainname: " +self._install_profile.get_domainname() + "\n"
1796 if self._install_profile.get_nisdomainname():
1797 settings += " NIS Domainname: " +self._install_profile.get_nisdomainname() + "\n"
1798 if self._install_profile.get_dns_servers():
1799 for dns_server in self._install_profile.get_dns_servers():
1800 settings += " DNS Server: " +dns_server + "\n"
1801 if self._install_profile.get_http_proxy():
1802 settings += " HTTP Proxy: " +self._install_profile.get_http_proxy() + "\n"
1803 if self._install_profile.get_ftp_proxy():
1804 settings += " FTP Proxy: " +self._install_profile.get_ftp_proxy() + "\n"
1805 if self._install_profile.get_rsync_proxy():
1806 settings += " RSYNC Proxy: " +self._install_profile.get_rsync_proxy() + "\n"
1807
1808 #Cron Daemon:
1809 settings += "\nCron Daemon: " + self._install_profile.get_cron_daemon_pkg() + "\n"
1810
1811 #Logger:
1812 settings += "\nLogging Daemon: " + self._install_profile.get_logging_daemon_pkg() + "\n"
1813
1814 #Extra packages:
1815 if self._install_profile.get_install_packages():
1816 install_packages = self._install_profile.get_install_packages()
1817 else:
1818 install_packages = []
1819 settings += "\nExtra Packages: "
1820 for package in install_packages:
1821 settings += package + " "
1822 settings += "\n"
1823 #Services:
1824 if self._install_profile.get_services():
1825 services = self._install_profile.get_services()
1826 else:
1827 services = []
1828 settings += "\nAdditional Services: "
1829 for service in services:
1830 settings += service + " "
1831 settings += "\n"
1832
1833 #Other Configuration Settings (rc.conf):
1834 #Make.conf Settings:
1835 settings += "\nConfiguration Files Settings:\n"
1836 etc_files = self._install_profile.get_etc_files()
1837 for etc_file in etc_files:
1838 settings += " File:" + etc_file + "\n"
1839 if isinstance(etc_files[etc_file], dict):
1840 for name in etc_files[etc_file]:
1841 settings += " Variable: " + name + " Value: " + etc_files[etc_file][name] + "\n"
1842 else:
1843 for entry in etc_files[etc_file]:
1844 settings += " Value: "+ entry + "\n"
1845
1846 #Additional Users:
1847 settings += "\nAdditional Users:\n"
1848 users = {}
1849 for user in self._install_profile.get_users():
1850 users[user[0]] = (user[0], user[1], user[2], user[3], user[4], user[5], user[6])
1851 for user in users:
1852 settings += " Username: " + user
1853 settings += "\n Group Membership: " + string.join(users[user][2], ",")
1854 settings += "\n Shell: " + users[user][3]
1855 settings += "\n Home Directory: " + users[user][4]
1856 if users[user][5]:
1857 settings += "\n User Id: " + users[user][5]
1858 if users[user][6]:
1859 settings += "\n User Comment: " + users[user][6]
1860
1861 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