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

Contents of /trunk/src/GLIGenDialog.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1509 - (show annotations) (download) (as text)
Sat Sep 2 23:54:46 2006 UTC (11 years, 9 months ago) by codeman
File MIME type: text/x-python
File size: 95692 byte(s)
  Lots of internationalization fixes.  Point to a translation path called
  languages in the dialog directory.  Generated and added .pot files.
  Added gettext to GLIIP for package descriptions.

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